MobyDarcy Posted September 26, 2010 Share Posted September 26, 2010 Hello,Since I am making a website like shopstyle.com which introduces items from other websites and redirects the customer to items' original websites, I am wondering if I can replace the check-out option with a new function that customers could get to the original websites' URL by clicking it other than add it to cart. Thanks a lot! Link to comment Share on other sites More sharing options...
rocky Posted September 27, 2010 Share Posted September 27, 2010 See here. Link to comment Share on other sites More sharing options...
MobyDarcy Posted September 27, 2010 Author Share Posted September 27, 2010 Thanks. I changed action="{$base_dir}cart.php" to action="{$product->location}"under product.tpl and put a link like www.google.com in product location under catalog in back office, but it doesn't work. Link to comment Share on other sites More sharing options...
rocky Posted September 27, 2010 Share Posted September 27, 2010 Try this instead. Link to comment Share on other sites More sharing options...
MobyDarcy Posted September 28, 2010 Author Share Posted September 28, 2010 Thanks again rocky, but I do not want to change to that function. I just want to pop up another link rather than adding it to cart (If the "add to cart" function and the cart could be removed, that would be awesome). I think the previous one you said which is putting the link in product location is what I am expecting, however, it just doesn't work. How should it execute the function of opening the link by click add to cart? Link to comment Share on other sites More sharing options...
rocky Posted September 28, 2010 Share Posted September 28, 2010 The code I linked to replaces the "Add to cart" button with a "Supplier page" button that goes to the supplier page when clicked instead of adding to cart: <a href="{$product.location}" class="button">{l s='Supplier page'} Link to comment Share on other sites More sharing options...
MobyDarcy Posted September 28, 2010 Author Share Posted September 28, 2010 Do I put this code in product.tpl under the following codes or somewhere else?<!-- add to cart form--><form id="buy_block" action="{$base_dir}cart.php" method="post">Also, where can I add link under supplier page in back office? I only saw name, description and logo for supplier. Link to comment Share on other sites More sharing options...
rocky Posted September 28, 2010 Share Posted September 28, 2010 Change line 283 of product.tpl (in PrestaShop v1.3.1): quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p> to: <a href="{$product->location}" class="button">{l s='Supplier page'} The supplier page URL needs to be entered in the "Location" field on the "1. Info." tab of the product editor, since there is no-where to enter it on the Catalog > Suppliers tab. Link to comment Share on other sites More sharing options...
MobyDarcy Posted September 28, 2010 Author Share Posted September 28, 2010 I just tried for several times, but it still doesn't work.. Link to comment Share on other sites More sharing options...
MobyDarcy Posted September 28, 2010 Author Share Posted September 28, 2010 Do I need to reinstall prestashop after I changed the code? I actually only updated the revised file through FTP software. Does it matter? Link to comment Share on other sites More sharing options...
lomfords Posted September 28, 2010 Share Posted September 28, 2010 I'm also trying to change the Add to Cart to link. I followed the instructions in another post to place the link in the Location field, which works for normal urls, but I want to use afflilate links which are longer, and get the message too many characters. (too long) Any suggestions?Also I'd like to change the name of that button from Add To Cart to another name. Can that be done? Link to comment Share on other sites More sharing options...
rocky Posted September 29, 2010 Share Posted September 29, 2010 @MobyDarcyNo, you don't need to reinstall PrestaShop. Just updating the files should work. I don't understand why it isn't working for you.@lomfordsThe location field is limited to 64 characters. To increase that limit, you will need to edit the ps_product table using phpMyAdmin, go to the "Structure" tab, edit the "Location" field and change the "Length/Values" field to however many characters you need.Once you've done that, edit classes/Product.php and change line 157: protected $fieldsSize = array('reference' => 32, 'supplier_reference' => 32, 'location' => 64, 'ean13' => 13); Change the 64 to the number of characters you increased the field to. Link to comment Share on other sites More sharing options...
lomfords Posted September 29, 2010 Share Posted September 29, 2010 Thanks for that, still getting an error message possibly because my affiliate link has invalid characters? Example below Link to comment Share on other sites More sharing options...
rocky Posted September 29, 2010 Share Posted September 29, 2010 Yes, the = sign is not allowed. To make it allowed, change line 413 of classes/Validate.php (in PrestaShop v1.3.1) from: return preg_match('/^[^<>;={}]*$/ui', $reference); to: return preg_match('/^[^<>;{}]*$/ui', $reference); Link to comment Share on other sites More sharing options...
lomfords Posted September 29, 2010 Share Posted September 29, 2010 Got it! Also discovered that <> wasn't allowed. Ican now link from the products page but the button on the featured products still goes to the cart. Can't see anywhere to edit on homefeatured.tpl is it somewhere else?This forum is great! Really helpful. Link to comment Share on other sites More sharing options...
rocky Posted September 30, 2010 Share Posted September 30, 2010 @MobyDarcyOops, I realised that I made a mistake in my code above. I've now corrected it. In product.tpl, it should be {$product->location} and in other files it should be {$product.location}.@lomfordsChange lines 20-24 of modules/homefeatured/homefeatured.tpl (in PrestaShop v1.3.1) from: {if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2} {l s='Add to cart' mod='homefeatured'} {else} {l s='Add to cart' mod='homefeatured'} {/if} to: {l s='Supplier page'} Link to comment Share on other sites More sharing options...
lomfords Posted October 1, 2010 Share Posted October 1, 2010 Arrgh! Have now discovered that although I can place an affiliate link in the location field, and link it to the renamed Add to cart button, it just goes to the home page of the affiliate site (in this case affiliate window) It seems to ignore everything after the .comExample link Your code above links to a supplier page, is there another field other than product location which might work?Regards Link to comment Share on other sites More sharing options...
rocky Posted October 2, 2010 Share Posted October 2, 2010 I'm not sure why that is happening. I'd need a link to your website so I can check the URL. Link to comment Share on other sites More sharing options...
MobyDarcy Posted October 3, 2010 Author Share Posted October 3, 2010 To lomfords:I still cannot make it work. But you said yours works fine, did you use the following method?"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"> " Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now