Integrating DHL Service

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
davin
Posts: 3
Joined: 08 Aug 2023, 12:20

Integrating DHL Service

Post by davin » 08 Aug 2023, 13:28

Hi,

Aimeos Version: "2023.04",
PHP Version : "8.0.11",
Laravel version: "^10.0"


I want to use DHL Delivery Service in my Aimeos project. I created a service provider named as DhlServiceProvider.php.

Code: Select all

	public function push(iterable $orders): \Aimeos\Map
    	{
                Log::debug('Push method started');
        	$responseMap = new \Aimeos\Map();
        	foreach ($orders as $order) {
         	   if ($order instanceof OrderItem) {
                	Log::debug('Processing order: ' . $order->getId());
           	   }
        	}
        	Log::debug('Push method finished');
        	return $responseMap;
         }
I also add provide in config/service.php file. This is my service.php file code:->

Code: Select all

 'services' => [
        'shipping' => [
            'dhl' => [
                'decorator' => [
                    'Dhl' => ['Aimeos\\MShop\\Service\\Provider\\Delivery\\DhlServiceProvider']
                ]
            ],
        ],
    ],
After that In adminpanel for my DHL service, I selected provider as DHLServiceProvider. I have added Log::debug in my provider to debug whether it is reaching there at time of checkout. But it isn't.

Can you please guide if I am missing anything?

Thankyou

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Integrating DHL Service

Post by aimeos » 09 Aug 2023, 07:38

davin wrote: 08 Aug 2023, 13:28 I also add provide in config/service.php file. This is my service.php file code:->

Code: Select all

 'services' => [
        'shipping' => [
            'dhl' => [
                'decorator' => [
                    'Dhl' => ['Aimeos\\MShop\\Service\\Provider\\Delivery\\DhlServiceProvider']
                ]
            ],
        ],
    ],
This is unnecessary and won't have any effect.
davin wrote: 08 Aug 2023, 13:28 After that In adminpanel for my DHL service, I selected provider as DHLServiceProvider. I have added Log::debug in my provider to debug whether it is reaching there at time of checkout. But it isn't.
The push() method is called when you execute the order/service/delivery job controller. For Laravel, it's:

Code: Select all

php artisan aimeos:jobs order/service/delivery
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

davin
Posts: 3
Joined: 08 Aug 2023, 12:20

Re: Integrating DHL Service

Post by davin » 09 Aug 2023, 09:53

Which method should I use then? I just need to hit an API to send orderdata to DHL when order is completed and delivery service is DHL?
Can you please let me know, what changes I need to do to achieve this?

Thanks
Last edited by davin on 09 Aug 2023, 09:54, edited 1 time in total.

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Integrating DHL Service

Post by aimeos » 09 Aug 2023, 14:17

Everything is correct, you only have to execute the mentioned job controller.
Aimeos uses async cronjobs for performance and reliability reasons instead of performing potentially long running tasks in user requests.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

davin
Posts: 3
Joined: 08 Aug 2023, 12:20

Re: Integrating DHL Service

Post by davin » 10 Aug 2023, 05:00

Okay, so I have to run following on cronjob where it will check for new orders and call API for each. Right?

Code: Select all

	php artisan aimeos:jobs order/service/delivery

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Integrating DHL Service

Post by aimeos » 10 Aug 2023, 06:29

Correct
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

davin
Posts: 3
Joined: 08 Aug 2023, 12:20

Re: Integrating DHL Service

Post by davin » 10 Aug 2023, 07:10

Thanks

Post Reply