Questions around the TYPO3 integration and plugins as well as Flow and NeosCMS
Forum rules: Always add your TYPO3/Flow, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#5356 by mantik
05 Jan 2018, 15:49
i understand....

...all this method are needed in the own Itemclass that the basket works....
(all methods who something do with the private property $locale or $price)
Code: Select all
   /**
    * Clones internal objects of the order base item.
    */
   public function __clone()
   {
      $this->price = clone $this->price;
      $this->locale = clone $this->locale;
   }


   /**
    * Returns the locales for the basic order item.
    *
    * @return \Aimeos\MShop\Locale\Item\Iface Object containing information
    *  about site, language, country and currency
    */
   public function getLocale()
   {
      return $this->locale;
   }

   /**
    * Returns a price item with amounts calculated for the products, costs, etc.
    *
    * @return \Aimeos\MShop\Price\Item\Iface Price item with price, costs and rebate the customer has to pay
    */
   public function getPrice(){
      if( $this->price->getValue() === '0.00' ){
         $this->price->clear();
         $currencyId = $this->price->getCurrencyId();

         foreach( $this->getServices() as $service ) {
            $this->price->addItem( $service->getPrice()->setCurrencyId( $currencyId ) );
         }

         foreach( $this->getProducts() as $product ) {
            $this->price->addItem( $product->getPrice()->setCurrencyId( $currencyId ), $product->getQuantity() );
         }
      }

      return $this->price;
   }

   /**
    * Checks if the price uses the same currency as the price in the basket.
    *
    * @param \Aimeos\MShop\Price\Item\Iface $item Price item
    */
   protected function checkPrice( \Aimeos\MShop\Price\Item\Iface $item )
   {
      $price = clone $this->price;
      $price->addItem( $item );
   }


   /**
    * Tests if the order object was modified.
    *
    * @return bool True if modified, false if not
    */
   public function isModified(){
      return ( parent::isModified() === false ? $this->modified : true );
   }

   /**
    * Sets the modified flag of the object.
    */
   public function setModified()
   {
      $this->modified = true;
      $this->price->clear();
   }


hope you can maybe specially make an documentaion for this kind of Managers/Items so we can again be friends.

May its something special if the property is from type \Aimeos\MShop\*\Item\Iface

just one thing: how can i actiavete my new property as checked by default in the backend modules filter?
#5359 by aimeos
06 Jan 2018, 18:57
I think the problem is that you've stored $price and $locale in your own class again with the same name as the base class. Maybe the PHP interpreter has a problem with that because the error you mentioned before (site object not found) makes no sense if the interpreter would work correctly. Can remove both properties and all your methods incl. __clone()? The locale and price items are available nevertheless using getLocale() and getPrice() from the parent class as long as you call parent::__construct() with them as parameter.

Can you explain a bit more or post a screenshot of what you mean by activating the new property in the backend module filter by default?
#5360 by mantik
08 Jan 2018, 07:40
aimeos wrote:I think the problem is that you've stored $price and $locale in your own class again with the same name as the base class. Maybe the PHP interpreter has a problem with that because the error you mentioned before (site object not found) makes no sense if the interpreter would work correctly. Can remove both properties and all your methods incl. __clone()? The locale and price items are available nevertheless using getLocale() and getPrice() from the parent class as long as you call parent::__construct() with them as parameter.


I try this after i check that all methods who something do with the local properties must have the methods implemented but it dosen't work. same error. so i let it like it is.

very wired is that when i debug the $locale in the file: typo3conf/ext/aimeos/Resources/Private/Extensions/ai-controller-frontend/controller/frontend/src/Controller/Frontend/Basket/Base.php->checkLocale()

if i \Typo3\CMS\Extbase\Utility\DebuggerUtility::var_dump ($this->get) then i hav ethe whole object inclusiv the locale with the truth locale subobject (i make an A-B Testing with my own Manager and without) BUT
\Typo3\CMS\Extbase\Utility\DebuggerUtility::var_dump ($locale->get->getLocale()) then i got Null.

and just to know i also rename the properties name in myLoclae, myPrice etc. this dosen't help too.

Code: Select allCan you explain a bit more or post a screenshot of what you mean by activating the new property in the backend module filter by default?

i mean the filter on the rioght side. how can i say to any field that i wan it see it by default (exmpla my field)
Image
#5364 by aimeos
08 Jan 2018, 15:14
mantik wrote:I try this after i check that all methods who something do with the local properties must have the methods implemented but it dosen't work. same error. so i let it like it is.


Strange. We will do some tests on our own if we can reproduce that.

mantik wrote:very wired is that when i debug the $locale in the file: typo3conf/ext/aimeos/Resources/Private/Extensions/ai-controller-frontend/controller/frontend/src/Controller/Frontend/Basket/Base.php->checkLocale()

if i \Typo3\CMS\Extbase\Utility\DebuggerUtility::var_dump ($this->get) then i hav ethe whole object inclusiv the locale with the truth locale subobject (i make an A-B Testing with my own Manager and without) BUT
\Typo3\CMS\Extbase\Utility\DebuggerUtility::var_dump ($locale->get->getLocale()) then i got Null.


Is the complete locale object available in __construct() of your own order base item when you store it?

mantik wrote:i mean the filter on the rioght side. how can i say to any field that i wan it see it by default (exmpla my field)


You can do this by configuration:
- https://aimeos.org/docs/Configuration/Core/admin/jqadm/order/fields
- https://github.com/aimeos/ai-admin-jqadm/blob/master/admin/jqadm/templates/order/list-standard.php#L97