...
Code Block |
---|
composer require "creativestyle/magesuite-packstation-dh;dhl" ^2.0.0 |
User guide
4.5. DHL Packstation shipping 2.0
Admin settings
In Stores -> Configuration -> Sales -> Delivery methods
a new tab - Packstation DHL
is available.
...
The following options can be configured:
Name | Value | Comment |
---|---|---|
Enabled | Yes/No | |
Method Name | ||
Title | ||
Mode | Live/Sandbox | |
API Key | Provide API Key for Location Finder - Unified API. It can be found in your DHL developer account in aplication details under 'Credential' section | |
Enable Debug | Yes/No | Enable this option to log requests |
Price | ||
Minimum subtotal for free shipping | ||
Maximum subtotal | ||
Maximum weight | ||
Sort Order | ||
Type | None/ Per Order / Per Item | Use system value |
Ship to Applicable Countries | All Allowed Countries/Specific Countries | Use system value |
Ship to Specific Countries | ||
Displayed Error Message | Default value: |
Backend
List of Packstations
vendor/creativestyle/magesuite-packstation-dhl/Controller/Packstation/Listing.php:26
Code Block |
---|
class Listing extends \Magento\Framework\App\Action\Action implements \Magento\Framework\App\Action\HttpGetActionInterface
{
public function execute()
{
$zip = (string)$this->getRequest()->getParam(self::FORM_ZIP_FIELD);
.....
$response = $this->getPackstationLocations->execute($zip);
.....
return $resultJson->setData($response);
}
} |
Get Packstation Locations
vendor/creativestyle/magesuite-packstation-dhl/Service/GetPackstationLocations.php:31
Code Block |
---|
class GetPackstationLocations
{
public function execute(string $zip):? array
{
.....
try {
$requestData = $this->prepareCallParameter($zip);
$response = $this->dhlApiClient->getPackstationsByAddress($requestData);
return $response[self::API_RESPONSE_LOCATION_FIELD];
}
.....
}
} |
Api for Dhl
vendor/creativestyle/magesuite-packstation-dhl/Service/DhlApiClient.php:38
Code Block |
---|
class DhlApiClient
{
public function getPackstationsByAddress($data): array
{
return $this->sendRequest(self::API_METHOD_FIND_BY_ADDRESS, $data);
}
} |
Frontend
Frontend screens
In the checkout delivery method section a new method is displayed:
...