2

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$

1

Maybe you are doing the conversion wrong. Instead of $price * $rate you are doing $price / $rate (or the other way around).

I say this because 1.28 / 1 = 1/0.78 (aproximately)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.