2

I have a Magento site with several stores. Each store displays products in different currency. I'm trying to load products from one of the stores using product collection.

$_col = Mage::getModel('catalog/product')->getCollection();
$_col->addAttributeToSelect('*');
$_col->addIdFilter($product_ids_to_be_loaded);
$_col->setStoreId($store_id);
$_col->addFinalPrice();

Unfortunately when I try to 'display' the price using:

for($_col as $p) {
    echo $this->getPriceHtml($p, true);
}

it displays wrong price (I assume it's price in default currency).

When I load products using:

$model = Mage::getModel('catalog/product');
for($_col as $p) {
    $p = $model->load($_product->getId());
    echo $this->getPriceHtml($p, true);
}

it works fine. How come? What am I doing wrong?

1
  • Curious, why are you using addAttributeToFilter('*') instead of addAttributeToSelect('*')?
    – pspahn
    Aug 8, 2014 at 1:32

2 Answers 2

2

I use the following which works well:

$collection = Mage::getResourceModel('catalog/product_collection');
$collection ->addMinimalPrice()
            ->addFinalPrice()
            ->addTaxPercents();

Try it without the store id filter, then with it.

Magento has also got the following method which can be used as filter:

public function addPriceData($customerGroupId = null, $websiteId = null)
0

By using this code you can get the Final price of the products

$_col = Mage::getModel('catalog/product')->getCollection();
$_col->addAttributeToSelect('*');
$_col->setStoreId($store_id);
$_col->addFinalPrice();

foreach($_col as $p) {
    echo $p->getFinalPrice();
}
1
  • Unfortunately getFinalPrice() also returns price in wrong currency
    – matt
    Aug 8, 2014 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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