kingoftheworld_87 Posted May 19, 2010 Share Posted May 19, 2010 Im having a bit of a dilemma, I was wondering if there is a module or a way of doing the following:Changing the cart button, so instead of clicking on 'add to cart' and going to a new page like normal, I want to be able to add a unique link to that button, that will open up another site. Is this possible?Thanks Link to comment Share on other sites More sharing options...
rocky Posted May 20, 2010 Share Posted May 20, 2010 Sure, it is possible, but I need more information about this unique link and how it is created. For example, can you use a link with the product ID like http://www.external.com/page.php?id_product={$id_product}? Link to comment Share on other sites More sharing options...
kingoftheworld_87 Posted May 20, 2010 Author Share Posted May 20, 2010 I have a list of the links for each product in an Excel Spreadsheet, it would just be a matter of pasting it in. Link to comment Share on other sites More sharing options...
rocky Posted May 20, 2010 Share Posted May 20, 2010 You'd need to put the link somewhere on the product editor in a field you are not using like the Location field, then you can replace the "Add to cart" link with {$product->location}. Link to comment Share on other sites More sharing options...
kingoftheworld_87 Posted May 20, 2010 Author Share Posted May 20, 2010 Il give this a try thanks. Link to comment Share on other sites More sharing options...
kingoftheworld_87 Posted June 11, 2010 Author Share Posted June 11, 2010 "You’d need to put the link somewhere on the product editor in a field you are not using like the Location field, then you can replace the “Add to cart” link with {$product->location}"Where exactly do I find the add to cart link to replace? Link to comment Share on other sites More sharing options...
rocky Posted June 11, 2010 Share Posted June 11, 2010 Now that I look at it, the "Add to cart" button on the product page is actually a form submission, not a link. I think you'll need to change line 117 of product.tpl: <form id="buy_block" action="{$base_dir}cart.php" method="post"> to: <form id="buy_block" action="{$product->location}" method="get"> This will go to the link in the product location field and add the data at the end of the url like ?qty= Link to comment Share on other sites More sharing options...
kingoftheworld_87 Posted June 14, 2010 Author Share Posted June 14, 2010 Works a treat, thanks. Link to comment Share on other sites More sharing options...
kingoftheworld_87 Posted June 14, 2010 Author Share Posted June 14, 2010 Is there anyway I can keep the cart button adding products to the cart and have a seperate link to the supplier underneath? Link to comment Share on other sites More sharing options...
rocky Posted June 14, 2010 Share Posted June 14, 2010 In that case, you'll have to change the form code back and add a link like the following below the "Add to cart" button: <a href="{$product.location}" class="button">{l s='Supplier page'} Link to comment Share on other sites More sharing options...
kingoftheworld_87 Posted June 15, 2010 Author Share Posted June 15, 2010 Thanks for the help but i cant get the link to show up, everytime it just shows txt e.g a href: and thats it! Any ideas? Link to comment Share on other sites More sharing options...
jkmagic Posted September 1, 2010 Share Posted September 1, 2010 Hi!i tested this link with $product->location as Rocky said,and it is succesfull.but when i tryed with another link :http://localhost/rest/category.php?id_category=5prestashop answers that1 error1. the field location is invalidit seems that some special characters are not allowedhow can i put the link to add to cart button?i am not a developer and i do not know how to code it Link to comment Share on other sites More sharing options...
lomfords Posted September 29, 2010 Share Posted September 29, 2010 I've got this working with Add to Cart going to a link from the product page, but the Add to Cart button on the featured products page still goes to the cart. I have the same problem as the post above with invalid characters (affiliate links) Any suggestions? Link to comment Share on other sites More sharing options...
CraigMeade Posted August 6, 2011 Share Posted August 6, 2011 I need to perform this same operation, but this tip doesn't seem to work anymore. Maybe it's the 1.4 version it doesn't work with. It would be great if you could update this patch. Link to comment Share on other sites More sharing options...
CraigMeade Posted August 6, 2011 Share Posted August 6, 2011 From Rocky, updated code for this task in 1.4. I suggest entering the unique URL for each product in the Location field of the product, then change the "Add to cart" button in product.tpl to something like this: <a href="{$product->location}" target="_blank">{l s='Add to cart'}</a> and in product-list.tpl: <a href="{$product.location}" target="_blank">{l s='Add to cart'}</a> This will open the URL entered in the location field in a new window. The customer will then need to close the window to return to your site. Thank you Rocky! Link to comment Share on other sites More sharing options...
JasonDurian Posted February 12, 2016 Share Posted February 12, 2016 Can anyone please update this patch for 1.6 ? It would be very appreciated. Thanks. Link to comment Share on other sites More sharing options...
JasonDurian Posted February 14, 2016 Share Posted February 14, 2016 Done it, just to test, I insert the URL on the description_short field (import from CSV) (you can change description_short for any other field) on prouct.tpl Change <form id="buy_block"{if $PS_CATALOG_MODE && !isset($groups) && $product->quantity > 0} class="hidden"{/if} action="{$link->getPageLink('cart')|escape:'html':'UTF-8'}" method="post"> to <form id="buy_block"{if $PS_CATALOG_MODE && !isset($groups) && $product->quantity > 0} class="hidden"{/if} action="{$product->description_short|escape:'html':'UTF-8'}" method="post" target="_blank"> this will open the link on a new window. If you want to open it in the same window, delete target="_blank" on produc-tlist.tpl change current line to this one (line 157) <a class="button ajax_add_to_cart_button btn btn-default" href="{$product.description_short|escape:'html':'UTF-8'}" method="post" target="_blank"> Link to comment Share on other sites More sharing options...
Recommended Posts