Jump to content

Change Add to cart button to view button


Guorilla

Recommended Posts

Hello,
 
In the product list, I want to change the add to cart button to a"view" button... So customers always have to view the product firts, before ordering...
 
I think it's about this code:

 

{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="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}", true)}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{else}
<a class="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}", true)} title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{/if} 
{else}
<span class="exclusive">{l s='Add to cart'}</span>
{/if}
{/if}
<a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>   

I've tried a lot of things by adding:
 

<a class="button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>

But no view button is shown then...
 
Could someone please put me in the right direction?
 
Thanks,
 
Marco

Link to comment
Share on other sites

Hi Marco,

 

I think that you can just take out the whole Add to cart code:


{*              <-- add comment-start here

{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="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}", true)}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{else}
<a class="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}", true)} title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{/if} 
{else}
<span class="exclusive">{l s='Add to cart'}</span>
{/if}
{/if}

           and a comment-end below
*}

<a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>

This will just remove the whole Add to cart button from the list, and leaves the View button intact.

 

Hope this is what you want,

pascal.

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

Hi Marco,

 

I think that you can just take out the whole Add to cart code:


{*              <-- add comment-start here

{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="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}", true)}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{else}
<a class="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}", true)} title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{/if} 
{else}
<span class="exclusive">{l s='Add to cart'}</span>
{/if}
{/if}

           and a comment-end below
*}

<a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>

This will just remove the whole Add to cart button from the list, and leaves the View button intact.

 

Hope this is what you want,

pascal.

 

Hello Pascal,

 

I tried that, but the problem then is that the button isn't showing...

Link to comment
Share on other sites


{* {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="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}", true)}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>

{else}

<a class="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}", true)} title="{l s='Add to cart'}">{l s='Add to cart'}</a>

{/if}

{else}

<a class="button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>

{/if}

{/if} *}

<a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>

Link to comment
Share on other sites

Hi Marco,

 

For some reason, somewhere in your css files (maybe just themes<your theme folder>/css/global.css, but can be somewhere else. (Can't really see where exactly as you have some optimization settings turned on (the CCC settings in Advanced Parameters->Performance) ) you have this piece of code:

 

.grid li .center_block .product_flags,

.grid li .center_block .product_desc,

.grid li .right_block .on_sale,

.grid li .right_block .discount,

.grid li .right_block .button {
    display: none;
}

 

If you take out the display: none; line

you will see this on your pages:

 

post-455771-0-91178300-1396413783_thumb.png

 

 

Hope this helps,

pascal

 

 

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