Getting site code giving error

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
adityabanerjee
Posts: 24
Joined: 05 Oct 2019, 06:42

Getting site code giving error

Post by adityabanerjee » 11 Jan 2020, 10:29

Hi I have extended the getSession and setSession methods from the Base.php. I have created my own php file named Ebdaa.php

my Ebdaa.php looks like

Code: Select all

<?php

namespace Aimeos\MShop\Order\Manager\Base;

class Ebdaa extends Standard
{
	public function getSession($type = 'default') 
    {	
    	$context = $this->getContext();
        $session = $context->getSession();
        $locale = $context->getLocale();
        $currency = $locale->getCurrencyId();
        $language = $locale->getLanguageId();
        $sitecode = $locale->getSiteItem()->getCode();
        $key = 'aimeos/basket/lock-' . $sitecode . '-' . $language . '-' . $currency . '-' . strval( $type );
        if( ( $value = $session->get( $key ) ) !== null ) {
            return (int) $value;
        }
        return \Aimeos\MShop\Order\Manager\Base\Base::LOCK_DISABLE;
    }	

    /**
	 * Saves the current shopping basket of the customer.
	 *
	 * @param \Aimeos\MShop\Order\Item\Base\Iface $order Shopping basket
	 * @param string $type Order type if a customer can have more than one order at once
	 * @return \Aimeos\MShop\Order\Manager\Base\Iface Manager object for chaining method calls
	 */
    public function setSession( \Aimeos\MShop\Order\Item\Base\Iface $order, $type = 'default')
    {
    	dd('in set session');
    }	
}
Now I am facing an error-:
Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Aimeos\MShop\Locale\Item\Standard::getSiteItem() in file /Users/adityabanerjee/code/ebdaa-ecommerce-beta/ext/ebdaa/lib/custom/src/MShop/Order/Manager/Base/Ebdaa.php on line 14
Please assist.

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

Re: Getting site code giving error

Post by aimeos » 12 Jan 2020, 17:50

You are using the code from the master branch but your installed version is 2019.10.
The getSite() method in 2019.10 has been renamed to getSiteItem() in master.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply