Extend Base Classes in Typo3
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Re: Extend Base Classes in Typo3
Ok i solve it now like this:
what must i now do to root aimoes to this subclass so i dont have to change every update the core.
i try this:
but dosent work...
Code: Select all
namespace Mantik\MShop\Customer\Item;
class Base extends \Aimeos\MShop\Customer\Item\Base {
/**
* Initializes the customer item object
*
* @param \Aimeos\MShop\Common\Item\Address\Iface $address Payment address item object
* @param array $values List of attributes that belong to the customer item
* @param \Aimeos\MShop\Common\Lists\Item\Iface[] $listItems List of list items
* @param \Aimeos\MShop\Common\Item\Iface[] $refItems List of referenced items
* @param \Aimeos\MShop\Common\Item\Address\Iface[] $addresses List of referenced address items
*/
public function __construct( \Aimeos\MShop\Common\Item\Address\Iface $address, array $values = [],
array $listItems = [], array $refItems = [], $addresses = [] )
{
parent::__construct( 'customer.', $values, $listItems, $refItems );
foreach( $values as $name => $value )
{
switch( $name )
{
case 'customer.salutation': $address->setSalutation( $value ); break;
case 'customer.company': $address->setCompany( $value ); break;
case 'customer.vatid': $address->setVatId( $value ); break;
case 'customer.title': $address->setTitle( $value ); break;
case 'customer.firstname': $address->setFirstname( $value ); break;
case 'customer.lastname': $address->setLastname( $value ); break;
case 'customer.address1': $address->setAddress1( $value ); break;
case 'customer.address2': $address->setAddress2( $value ); break;
case 'customer.address3': $address->setAddress3( $value ); break;
case 'customer.postal': $address->setPostal( $value ); break;
case 'customer.city': $address->setCity( $value ); break;
case 'customer.state': $address->setState( $value ); break;
// MANTIK
case 'customer.languageid':
switch($value){
case 0:
$value = 'de';
break;
case 1:
$value = 'fr';
break;
case 2:
$value = 'it';
break;
}
$address->setLanguageId( $value );
break;
// MANTIK
case 'customer.countryid': $address->setCountryId( $value ); break;
case 'customer.telephone': $address->setTelephone( $value ); break;
case 'customer.telefax': $address->setTelefax( $value ); break;
case 'customer.website': $address->setWebsite( $value ); break;
case 'customer.longitude': $address->setLongitude( $value ); break;
case 'customer.latitude': $address->setLatitude( $value ); break;
case 'customer.email': $address->setEmail( $value ); break;
}
}
// set modified flag to false
$address->setId( $this->getId() );
parent::billingaddress($address);
parent::addresses($addresses);
parent::data($values);
}
}
i try this:
Code: Select all
config.tx_extbase {
persistence {
classes {
Aimeos\MShop\Customer\Item\Base {
subclasses {
0 = Mantik\MShop\Customer\Item\Base
}
}
}
}
}
Re: Extend Base Classes in Typo3
You should better solve the problem where it's really rooted and that seems to be where the language is handed over from TYPO3 to Aimeos. There, the languageid already needs to be a two letter ISO string.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Extend Base Classes in Typo3
i think the problem here is cus i've a field "language" in the user table and that works with the numbers of typo3 (like in the switch statement).
but for generally information if i want extend this class how can i do it?
but for generally information if i want extend this class how can i do it?
Re: Extend Base Classes in Typo3
If that's the problem and you can't use the ISO language codes in your fe_users table (or join with another table in the SQL statement that contains the ID:code mapping: https://github.com/aimeos/ai-typo3/blob ... r.php#L329), you can extend from the TYPO3 customer manager and overwrite the createItemBase() method: https://github.com/aimeos/ai-typo3/blob ... 3.php#L580
You can find the details there: https://aimeos.org/docs/Developers/Libr ... gers_items
You can find the details there: https://aimeos.org/docs/Developers/Libr ... gers_items
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Extend Base Classes in Typo3
is it posible to extend direct from the base?
Re: Extend Base Classes in Typo3
You mean from the customer manager base class instead of the TYPO3 customer manager? Sure that's possible but then you would have to reimplement the code from the TYPO3 customer manager so we don't suggest that way!
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
