Extend Address Manager and Item

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!
clearmedia
Posts: 8
Joined: 17 Aug 2018, 09:18

Extend Address Manager and Item

Post by clearmedia » 01 Nov 2018, 08:45

Hello,
I have to extend some files. I did not find a way to extend Base class :|
Can you help me with some solution? I need to add "Tax ID" and "Company registration number" in addition to "VAT ID".

I have modified my original files, but that's wrong :roll:

Code: Select all

vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Customer/Item/Base.php
...
$list['customer.vatid'] = $this->getPaymentAddress()->getVatID();
$list['customer.taxid'] = $this->getPaymentAddress()->getTaxId();
$list['customer.coc'] = $this->getPaymentAddress()->getCoc();

Code: Select all

vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Item/Address/Base.php
...
case $this->prefix . 'vatid': $this->setVatID( $value ); break;
case $this->prefix . 'taxid': $this->setTaxId( $value ); break;
case $this->prefix . 'coc': $this->setCoc( $value ); break;

Code: Select all

vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Item/Address/Standard.php
...
case $this->prefix . 'parentid': $this->setParentId( $value ); break;
case $this->prefix . 'position': $this->setPosition( $value ); break;
case $this->prefix . 'taxid': $this->setTaxId( $value ); break;
case $this->prefix . 'coc': $this->setCoc( $value ); break; 

Code: Select all

vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Manager/Address/Base.php
...
$stmt->bind( 2, $item->getCompany() );
$stmt->bind( 3, $item->getCoc() );
$stmt->bind( 4, $item->getTaxId() );
$stmt->bind( 5, $item->getVatId() );
Thanks!

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

Re: Extend Address Manager and Item

Post by aimeos » 02 Nov 2018, 09:17

That's one of the problems of OOP, that you can't extend base classes and inherit your changes to the sub-classes. So you have to extend all sub-classes instead.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply