1
votes

I have a Magento store which needs different prices for each site, which restricts me to using different websites for each, as stores or views won't let me set different prices for the same items.

However, I need to be able to allow the customer to switch store, and for their current basket to stay with them. This would include updating the prices to those in the new website.

I've set Share Customer Accounts to Global and Catalog Price Scope to Website.

I also have an initial changer:

<?php $websites=Mage::app()->getWebsites();?>
<?php if(count($websites)>1): ?>
<fieldset class="store-switcher">
    <label for="select-store"><?php echo $this->__('Select Store') ?>:</label>
    <select id="select-store" onchange="location.href=this.value">
    <?php foreach ($websites as $website): ?>
        <?php $_selected = ($website->getCode() == Mage::app()->getWebsite()->getCode()) ? ' selected="selected"' : '' ?>
        <option value="<?php echo $website->getDefaultStore()->getBaseUrl()?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($website->getName()) ?></option>
    <?php endforeach; ?>
    </select>
</fieldset>
<?php endif; ?>

Is this achievable? Or is it back to the drawing board?

Info: Magento ver. 1.6.2.0

Also: The websites I wish to share the cart between are on the same domain, and have the same frontend cookie value. (which I assume is the SID).

2

2 Answers

0
votes

This is an old fix to share cart contents (1.3 or 1.4) I used and may no longer be valid for 1.6, but give it a shot.

Edit the following template for your theme: template/page/switch/stores.phtml

Add to stores.phtml

$sessionID = Mage::getModel('core/session')->getSessionId();

Paste the new option value I included below over the the existing option value

<option value="<?php if(strpos($_group->getHomeUrl(),"?")===false){ echo $_group->getHomeUrl()."?SID=".$sessionID; }else{ if(strpos($_group->getHomeUrl(),"&SID=")===false){ echo $_group->getHomeUrl()."&SID=".$sessionID; }else{ echo $_group->getHomeUrl();}} ?>" <?php echo $_selected ?>><?php echo $this->htmlEscape($_group->getName()) ?></option>

Then create or modify a template to include static links to the individual stores to switch back and forth (eg: in the header). This fix did not work for the store switcher itself, but worked fine with these links.

You are in store A.  <a href="<?php echo Mage::app()->getStore('yoursecondstorecode')->getUrl() ?>">Goto Store B</a>.
0
votes

As best I can tell it is not possible to share carts between websites by design. Though by store within a website works fine.