Jump to content

add link to 'add to cart' button


Recommended Posts

Hi,

 

Im looking for at solution to have product that people can buy but also have product that link to seller. as affiliate.

 

 

In the following topic I was wondering if it is possible to have both.

example if colonne available_for_order is 2 then "add to cart" button is different and with a link to the owner of the product by taking the link in the colonne "location" instead of adding product to cart.

http://www.prestasho...he-cart-button/

 

Hope im making sense

 

Really hope someone can lead me to a solution.

 

Michael

Link to comment
Share on other sites

Hi Michael,

 

In /themes/default/product.tpl change in line 432 {if (!$allow_oosp && $product->quantity <= 0) OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}

<span class="exclusive">

<span></span>

{l s='Add to cart'}

</span>

{elseif !$product->available_for_order}

<a href="{$product->location}" target="_blank">{l s='Link To seller'}</a>

{else}

 

to

 

{if (!$allow_oosp && $product->quantity <= 0) OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}

<span class="exclusive">

<span></span>

{l s='Add to cart'}

</span>

{elseif !$product->available_for_order}

<a href="{$product->location}" target="_blank">{l s='Link To seller'}</a>

{else}

 

And in

 

/themes/default/product-list.tpl after

 

{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}

{if ($product.allow_oosp || $product.quantity > 0)}

{if isset($static_token)}

<a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}&token={$static_token}", false)}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>

{else}

<a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}", false)} title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>

{/if}

{else}

<span class="exclusive"><span></span>{l s='Add to cart'}</span><br />

{/if}

{/if}

 

add

 

{if !$product.available_for_order}

<a href="{$product->location}" target="_blank">{l s='Link To seller'}</a>

{/if}

 

This will work if available for order attribute is set.

As it works for PrestaShop 1.5, but 1.4 should be similar.

 

Best regards

Edited by valerie_BelVG (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...