Skip to main content
edited body
Source Link
TBI Infotech
  • 4.8k
  • 1
  • 14
  • 30

In my store iI need to calculate dynamic prices. I found the following code in several tutorials.

checkout_cart_product_add_after

$item = $obs->getQuoteItem();
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$price = "your custom price logic";
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
$item->getProduct()->setIsSuperMode(true);

For storeviews where BaseCurrency=StoreCurrency it works. But when the store Currency differs from the base currency i get unexpected results.

Example:

BaseCurrency = EUR
StoreCurrency = USD

now iNow I set the Price in my code to 1.

I would expect that magento displays either ~1.28$ or 1$

But it comes up with 0.78$

In my store i need to calculate dynamic prices. I found the following code in several tutorials.

checkout_cart_product_add_after

$item = $obs->getQuoteItem();
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$price = "your custom price logic";
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
$item->getProduct()->setIsSuperMode(true);

For storeviews where BaseCurrency=StoreCurrency it works. But when the store Currency differs from the base currency i get unexpected results.

Example:

BaseCurrency = EUR
StoreCurrency = USD

now i set the Price in my code to 1.

I would expect that magento displays either ~1.28$ or 1$

But it comes up with 0.78$

In my store I need to calculate dynamic prices. I found the following code in several tutorials.

checkout_cart_product_add_after

$item = $obs->getQuoteItem();
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$price = "your custom price logic";
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
$item->getProduct()->setIsSuperMode(true);

For storeviews where BaseCurrency=StoreCurrency it works. But when the store Currency differs from the base currency i get unexpected results.

Example:

BaseCurrency = EUR
StoreCurrency = USD

Now I set the Price in my code to 1.

I would expect that magento displays either ~1.28$ or 1$

But it comes up with 0.78$

Source Link
wutzebaer
  • 207
  • 1
  • 6

Dynamic Price with currency which differs from base currency

In my store i need to calculate dynamic prices. I found the following code in several tutorials.

checkout_cart_product_add_after

$item = $obs->getQuoteItem();
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$price = "your custom price logic";
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
$item->getProduct()->setIsSuperMode(true);

For storeviews where BaseCurrency=StoreCurrency it works. But when the store Currency differs from the base currency i get unexpected results.

Example:

BaseCurrency = EUR
StoreCurrency = USD

now i set the Price in my code to 1.

I would expect that magento displays either ~1.28$ or 1$

But it comes up with 0.78$