How to add a Decorator to catalog detail bought-together and suggest subparts
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!
How to add a Decorator to catalog detail bought-together and suggest subparts
Hi all,
I would like to add my Decorator to the catalog detail bought-together and suggest subparts but it seems there's no configuration option to do so.
My goal is price manipulation and it already works in the basket, the checkout and the catalog in general. I also have a Price Rule available but that doesn't affect these subparts either.
Do I have any other chance?
Thanks
Robert.
I would like to add my Decorator to the catalog detail bought-together and suggest subparts but it seems there's no configuration option to do so.
My goal is price manipulation and it already works in the basket, the checkout and the catalog in general. I also have a Price Rule available but that doesn't affect these subparts either.
Do I have any other chance?
Thanks
Robert.
Re: How to add a Decorator to catalog detail bought-together and suggest subparts
There's no way to add a decorator for that parts in the templates because they are not provided by an own subpart.
The price rules should affect all product prices, regardless where they are used. Unfortunately, this isn't the case for related products yet because only the price of the main product is modified:
https://github.com/aimeos/aimeos-core/b ... hp#L73-L78
Can you create a PR that loops over the referenced products and applies the rules too?
The price rules should affect all product prices, regardless where they are used. Unfortunately, this isn't the case for related products yet because only the price of the main product is modified:
https://github.com/aimeos/aimeos-core/b ... hp#L73-L78
Can you create a PR that loops over the referenced products and applies the rules too?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: How to add a Decorator to catalog detail bought-together and suggest subparts
Hi and thanks once again for pointing me in the right direction.
Did it like so:
$taxrate is of course a dynamic value here. Simplified it for the post.
Did it like so:
Code: Select all
if ( ! ($boughTogetherProducts = $product->getRefItems('product', null, 'bought-together'))->isEmpty()) {
foreach ($boughTogetherProducts->getRefItems('price') as $price) {
$taxrate = 19;
/** @var \Aimeos\MShop\Price\Item\Standard $price */
$price->setTaxRate($taxrate);
$price->setValue($price->getValue()->first() * (1 + $taxrate / 100));
}
}