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)
#3347 by brunojti
05 Sep 2016, 19:32
I made a little of progress trying to add custom fields to address part in checkout.

Now I am getting the following error:

Undefined property: Aimeos\MShop\Order\Item\Base\Address\MyExt::$prefix

(even if I use the Standard manager):

Undefined property: Aimeos\MShop\Order\Item\Base\Address\Standard::$prefix

It starts here:
https://github.com/aimeos/ai-controller ... d.php#L303

And breaks here:
https://github.com/aimeos/aimeos-core/b ... se.php#L66

And here is the var_dump of $address object:
Code: Select all/var/www/e-commerce/2marchio/vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Order/Item/Base/Base.php:282:
object(Aimeos\MShop\Order\Item\Base\Address\Standard)[335]
  private 'values' =>
    array (size=2)
      'order.base.address.siteid' => int 1
      'order.base.address.type' => string 'payment' (length=7)
  private 'prefix' (Aimeos\MShop\Common\Item\Address\Base) => string 'order.base.address.' (length=19)
  private 'modified' (Aimeos\MShop\Common\Item\Base) => boolean true
  private 'values' (Aimeos\MShop\Common\Item\Address\Base) =>
    array (size=12)
      'order.base.address.siteid' => int 1
      'order.base.address.firstname' => string 'xxxxx' (length=5)
      'order.base.address.lastname' => string 'xxxxx' (length=9)
      'order.base.address.vatid' => string 'xxxxx' (length=11)
      'order.base.address.address1' => string 'xxxxxx' (length=18)
      'order.base.address.address2' => string 'uhehe' (length=5)
      'order.base.address.address3' => string '931' (length=3)
      'order.base.address.city' => string 'xxxx' (length=5)
      'order.base.address.state' => string 'xx' (length=2)
      'order.base.address.postal' => string '53444-222' (length=9)
      'order.base.address.email' => string 'xxxxxx' (length=32)
      'order.base.address.telephone' => string '3242312312' (length=10)
  private 'prefix' (Aimeos\MShop\Common\Item\Base) => string 'order.base.address.' (length=19)
  private 'values' (Aimeos\MShop\Common\Item\Base) =>
    array (size=1)
      'order.base.address.siteid' => int 1


Any hints on what I am missing?
#3349 by brunojti
06 Sep 2016, 00:27
I haven't overwritten the constructor...
I tried to overwrite it (calling the parent constructor but the error is the same).

I have debugged and the code goes all way up to `Common/Item/Base.php` setting the value for $prefix value correctly.
https://github.com/aimeos/aimeos-core/b ... se.php#L37

But the error keeps popping up in the same line as described in the first item of this thread :cry: :cry:
#3350 by aimeos
06 Sep 2016, 11:38
If you post the code of your item class, we can maybe tell you what's wrong :-)
#3354 by aimeos
06 Sep 2016, 13:02
Seems to be OK too. Which PHP version do you use? If PHP 7 is it at least PHP 7.0.4?
#3357 by brunojti
06 Sep 2016, 13:13
Code: Select allvagrant@vagrant-ubuntu-trusty-64:~$ php -v
PHP 5.5.36-1+donate.sury.org~trusty+1 (cli) (built: May 26 2016 13:10:45)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
#3360 by aimeos
06 Sep 2016, 15:33
Hm, PHP 5.5 is usually not problematic (early versions of PHP 7 are) and I hope you didn't find a PHP bug.

brunojti wrote:And here is the var_dump of $address object:
Code: Select all/var/www/e-commerce/2marchio/vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Order/Item/Base/Base.php:282:
  private 'prefix' (Aimeos\MShop\Common\Item\Base) => string 'order.base.address.' (length=19)
  private 'values' (Aimeos\MShop\Common\Item\Base) =>



The strange thing is that Aimeos\MShop\Common\Item\Base contains the "prefix" property including the right value in your var_dump() output. Can you try to add
Code: Select allprivate $prefix

to your own class and see if this works? If not you can try to initialize it with "order.base.address."