Magento. Experienced. | by sneako

Feb/10

18

Add “Add to Cart” Button To “Related Products”

Tired of the little check boxes within the “Related Products” sidebar?  Wish the customer would just have an “Add to Cart” button?  Now you can!———————————————-

1) Open to edit:

app/design/frontend/YOUR THEME HERE/template/catalog/product/view.phtml

———————————————-

2) Change:

<?php echo $this->getPriceHtml($_item, true) ?>
</div>
<?php if ($this->helper('wishlist')->isAllow()) : ?>

———————————————-

3) To:

<?php echo $this->getPriceHtml($_item, true) ?>
<p><button onclick="setLocation('<?php echo $this->getAddToCartUrl($_item) ?>')" type="button"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button></p>
</div>
<?php echo $this->getChildHtml('addtocart') ?>
<?php if ($this->helper('wishlist')->isAllow()) : ?>

———————————————-

4) Save, (upload if you didn’t edit within FTP)

———————————————-

5) Clear your cache

———————————————-

Visit any product page that you have a related product setup for.  You should now notice an “Add To Cart” button next to each product in the “Related Products” sidebar!

RSS Feed

1 Comment for Add “Add to Cart” Button To “Related Products”

PaperStreet | April 21, 2010 at 12:54 am

Great idea, I just wish it still worked out-of-the-box on Magento 1.4 – it looks like they’ve modified things enough that the above code snipped no longer works. Let me know if you update it! In the meantime I’ll tinker around and see if I can get it going. Thanks!

Leave a comment!

<<

>>

Find it!

Theme Design by devolux.org