1
votes

I have a multisite Magento install with one website and four stores, and would like to display the store the product was added into the cart from in the cart next to each product (similar to how Gap.com does it). So customers know what store each item came from.

Any ideas how I would go about doing this?

Cheers,

Dave

1
Sounds like you would like all of the items grouped by store as well, not just a rendered output per store. Correct?benmarks

1 Answers

0
votes

One possible way would be, to use $_item->getStoreId() to differ the stores of each item within your template at template/checkout/cart/render/default.phtml.

In the standard Magento default.phtml template, $_item gets assigned the current item to be rendered (at the very top of the template code).

<?php $_item = $this->getItem() ?>

Thereafter you can easily assign the items proper store name to a variable, like this:

<?php
$aStore = array(
    '1' => 'Red Store',
    '2' => 'Green Store',
    '3' => 'Blue Store',
    '4' => 'Yummy Store'
);
$sStore = $aStore[$_item->getStoreId()];
?>

This allows you to output the name wherever you want, using <?php echo $sStore; ?>.

Another possibility would be to override Mage_Sales_Model_Quote_Item and create a public getter method, returning the store name of the given item.

But that's another story and maybe like using a sledgehammer to crack a nut^^