0
votes

Magento 1.7.0.2

2 websites with 2 Store Views per website. 1 website is 'shop' and 1 is 'website'. 'Website' does not have cart or customer/log in functionality but I want to add a button "Shop now!" to the product page view that links to the same product in the 'shop' and it should also be the corresponding Store View (Store Views are Swedish and English).

How can I get the link to the same product as the page "I'm on" but in another Store View (store id)? I have something like this in mind but I don't know how to finish it;

if store id == 1
<a class="button" href="<?php echo $this->getBaseUrl(store id3).$_product->getUrlKey() ?>">Shop now!</a>
else
<a class="button" href="<?php echo $this->getBaseUrl(store id4).$_product->getUrlKey() ?>">Shop now!</a>
endif

Any ideas or tips greatly appreciated!

Peter

1

1 Answers

0
votes
<?php if($this->storeid == "1") { ?>

<a class="button" href="<?php echo $this->getBaseUrl(store id3).$_product->getUrlKey() ?>">Shop now!</a>

<?php } else { ?>

<a class="button" href="<?php echo $this->getBaseUrl(store id4).$_product->getUrlKey() ?>">Shop now!</a>

<?php } ?>

Something like this.. I used $this->storeid as an example variable, don't know which variable you've set with the store ID to do the check :)