Price Rule Provider does not work in Basket and Checkout
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!
Price Rule Provider does not work in Basket and Checkout
Hi everyone,
I successfully set up a Price Rule Provider as described here: https://aimeos.org/docs/latest/providers/rules/ In our case it calculates country specific tax rates taken from session data which is filled by the user making his/her selection in a globally available delivery destination selector in frontend.
The calculation works perfectly on catalog pages but inside the basket (mini and standard) and on checkout pages it has no effect. Do I miss some configuration or do I have to integrate the same logic as a Basket Plugin in parallel?
We are on TYPO3 10.4.21 and Aimeos 21.7.3
Best
Robert.
I successfully set up a Price Rule Provider as described here: https://aimeos.org/docs/latest/providers/rules/ In our case it calculates country specific tax rates taken from session data which is filled by the user making his/her selection in a globally available delivery destination selector in frontend.
The calculation works perfectly on catalog pages but inside the basket (mini and standard) and on checkout pages it has no effect. Do I miss some configuration or do I have to integrate the same logic as a Basket Plugin in parallel?
We are on TYPO3 10.4.21 and Aimeos 21.7.3
Best
Robert.
Re: Price Rule Provider does not work in Basket and Checkout
The catalog rule provider does only work on products shown in the catalog list/detail component. They don't have an effect on the basket. Nevertheless, the prices modified by the catalog rule provider will be also used in the basket and this should be also true for modified tax rates (but we haven't tested that yet).
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: Price Rule Provider does not work in Basket and Checkout
Thanks for your response.
Currently this the not the case with my provider. Changed tax rates are not reflected in the basket.
I just set it up as own provider type and did not add the default catalog provider name. Is it necessary to add the catalog provider or do I additionally have to inherit my provider from the catalog provider class?
Best
Robert.
Currently this the not the case with my provider. Changed tax rates are not reflected in the basket.
I just set it up as own provider type and did not add the default catalog provider name. Is it necessary to add the catalog provider or do I additionally have to inherit my provider from the catalog provider class?
Best
Robert.
Re: Price Rule Provider does not work in Basket and Checkout
Can you post your code so we can see the implementation?
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: Price Rule Provider does not work in Basket and Checkout
Code: Select all
<?php
namespace Aimeos\MShop\Rule\Provider\Catalog;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
class UvcTax
extends \Aimeos\MShop\Rule\Provider\Base
implements \Aimeos\MShop\Rule\Provider\Catalog\Iface, \Aimeos\MShop\Rule\Provider\Factory\Iface
{
public function apply(\Aimeos\MShop\Product\Item\Iface $product): bool
{
$context = $this->getContext();
$session = $context->getSession();
$localeStr = $session->get('aimeos/basket/locale');
$localeArray = explode('|', $localeStr);
$locale = $localeArray[1];
$taxes = $context->getConfig()->get('client/html/basket/tax');
if ($locale !== 'de' && is_array($taxes) === true && array_key_exists($locale, $taxes) === true) {
foreach ($product->getRefItems('price') as $price) {
$taxrate = $taxes[ $locale ];
/** @var \Aimeos\MShop\Price\Item\Standard $price */
$price->setTaxRate($taxrate);
$netPrice = $price->getValue() / 1.19;
$price->setValue($netPrice * ( 1 + $taxrate / 100));
}
}
return $this->isLast();
}
}
Re: Price Rule Provider does not work in Basket and Checkout
Maybe the tax rate gets overwritten by one of the basket plugins. You should check that first.
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: Price Rule Provider does not work in Basket and Checkout
Yes that did something. I deactivated the Taxrates and ProductPrice Plugin. Now changed prices find there way to the basket.
But I have some weird caching issues in the catalog although we are in Dev mode and TYPO3 caches are disabled and we force the client not to cache via nginx.
But thanks for your tip that helped with the core issue of my post!
But I have some weird caching issues in the catalog although we are in Dev mode and TYPO3 caches are disabled and we force the client not to cache via nginx.
But thanks for your tip that helped with the core issue of my post!