Jump to content

Change "ADD TO CART" to "VIEW" function on product list.


Recommended Posts

Hi there,

 

We run PS 1.5.6

 

The "ADD TO CART" button still displays on product lists, even though it's been set to not display if a product has attributes.

 

I MUST have my clients choosing the products attributes BEFORE adding to cart.

 

In my old PS 1.2.5 store I simply replaced the "ADD TO CART" button and function with the "VIEW" button and function.

 

Can anyone assist me with how to do this in PS 1.5.6?

 

Kind regards,

Link to comment
Share on other sites

so if this doesn't work there are three possibilities

1) it's a cache problem in your store, so you can try to clear it

2) you use non default theme which doesnt support this feature

3) you use default theme, but you changed something in the theme .tpl files

 

 

i suppose that it's second option :) am i right?

Link to comment
Share on other sites

Hahaha yep. The theme does however support this feature.

My hassle was that I have used an external service to migrate my products over.

A fix is to go product by product and save the attributes :(

Not a decent solution at all :(

 

Soooo, if you or someone could please explain how to replace "add to cart" with "view" in product listing, I would be much appreciated.

 

The following is what I did on my old PS 1.2.5 shopping cart:

 

t is the following section starting on line 20 of modules/homefeatured/homefeatured.tpl that you should modify:

{if ($product.quantity OR $product.allow_oosp) AND $product.customizable != 2}
    <class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$base_dir}cart.php?qty=1&id_product={$product.id_product}&token={$static_token}&add" title="{l s='Add to cart' mod='homefeatured'}">{l s='Add to cart' mod='homefeatured'}</a>
{else}
    <span class="exclusive">{l s='Add to cart' mod='homefeatured'}</span>
{/if}

You could {* comment out *} this code to remove the “Add to cart” button altogether, or change its link to {$product.link} so that it acts like the “View” button. You could also disable the “Add to cart” button when the product has attributes by changing the first line to:

{if ($product.quantity OR $product.allow_oosp) AND $product.customizable != AND $product.id_product_attribute == 0}

Link to comment
Share on other sites

It's definitely something in the product-list.tpl that I need to change:

 

{capture name="pro_a_cart"}
                    {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=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Add to Cart'}"><i class="icon-basket icon-1x icon-mar-lr2"></i><span>{l s='Add to Cart'}</span></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=1&id_product={$product.id_product|intval}", false)|escape:'html'}" title="{l s='Add to Cart'}"><i class="icon-basket icon-1x icon-mar-lr2"></i><span>{l s='Add to Cart'}</span></a>
                            {/if}                
                        {else}
                            <a class="button exclusive view_button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}"><i class="icon-eye-2 icon-1x icon-mar-lr2"></i><span>{l s='View'}</span></a>
                        {/if}
                    {/if}
                {/capture}

Link to comment
Share on other sites

Yay, fixed it.

All I had to do was - in the themes product-list.tpl file - was comment out the two "ADD TO CART" lines and copy and past the "VIEW" line on top of them.

 

Like so:

{capture name="pro_a_cart"}
                    {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 exclusive view_button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}"><i class="icon-eye-2 icon-1x icon-mar-lr2"></i><span>{l s='View'}</span></a>
        						{*<a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Add to Cart'}"><i class="icon-basket icon-1x icon-mar-lr2"></i><span>{l s='Add to Cart'}</span></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=1&id_product={$product.id_product|intval}", false)|escape:'html'}" title="{l s='Add to Cart'}"><i class="icon-basket icon-1x icon-mar-lr2"></i><span>{l s='Add to Cart'}</span></a>*}
        					{/if}				
    					{else}
                            <a class="button exclusive view_button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}"><i class="icon-eye-2 icon-1x icon-mar-lr2"></i><span>{l s='View'}</span></a>
    					{/if}
    				{/if}
                {/capture}
Link to comment
Share on other sites

×
×
  • Create New...