Jump to content

How to replace check-out (add in cart) function with a URL to another website


Recommended Posts

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

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

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

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

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

@MobyDarcy

No, you don't need to reinstall PrestaShop. Just updating the files should work. I don't understand why it isn't working for you.

@lomfords

The 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

@MobyDarcy

Oops, 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}.

@lomfords

Change 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

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 .com
Example 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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...