简体   繁体   中英

Magento - How to add extra button like “Add to cart” and Redirect to external url from grid view, list view and product page view.

I want to add extra button like "Add to cart" for example "Live Demo". Then, as their are no of products each one have unique demo link that I will add from "Manage attributes" section of admin. I want to redirect "Live Demo" button to that particular product page demo url and after their should be also a button at header section for "Buy now".

Currently I have added a extra button in product page.
How can I do this on grid view and list view.

在此处输入图片说明

By making changes in /var/www/magentodemo/app/design/frontend/base/default/template/catalog/product/view/addtocart.phtml

<button type="button" title="<?php echo $Demo ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $Demo ?></span></span></button>

But which class name and onclick function I should call for this button to redirect to external url (to call external url attribute.)

Anyone have done this before. please let me know your thoughts.

Thanks in advance.

First of of you need to make your new attribute used in

product listing under manage attributes

and after that you can make use of this new attribute in grid pages in list.phtml file of your current theme by calling that new attribute as other you can see in your file like name etc.

thanks and let me know if you have any issues

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM