Checkout process-update shipping cost

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!
khizar
Posts: 99
Joined: 19 Jan 2021, 09:51

Re: Checkout process-update shipping cost

Post by khizar » 10 Mar 2021, 05:42

aimeos wrote: 09 Mar 2021, 18:00 Click on the "+" symbol right of the "Provider" field to add your decorator to the service:
https://aimeos.org/docs/latest/manual/s ... ors/#usage
Here you can see there is no Costdecorator which i have made(mentioned above).Do i have to add that decorator in configuration if that so how can i do that
Image

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

Re: Checkout process-update shipping cost

Post by aimeos » 10 Mar 2021, 11:20

You have used the wrong decorator namespace because in your code its for HTML client decorators, not for service decorators. The correct code would be:

Code: Select all

<?php

namespace \Aimeos\MShop\Service\Provider\Decorator;

class Costdecorator
	extends \Aimeos\MShop\Service\Provider\Decorator\Base
	implements \Aimeos\MShop\Service\Provider\Decorator\Iface
{
    public function calcPrice(\Aimeos\MShop\Order\Item\Base\Iface $basket)
    {   dd('ok');
        // do something before
        $price = $this->getProvider()->calcPrice($basket);
        // do something after
        
        return $price;
    }
}
Then, your class should be listed in the service panel of the admin backend.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply