Add To Cart Button To View Product

Hi All!

Sorry if this has been asked but I cant seem to find it. I would like the ADD TO CART button in category view to link into the product instead of adding to the cart.

Is there a way to do this?

thanks in advance

Stand way it’s to click the name of the product to go to product details.

Hi,

Thanks for that. which file does the change need to be made to...

thanks

design/themes/THEME/templates/common/product_data.tpl

replace

        {if $product.has_options && !$show_product_options && !$details_page}
            {if $but_role == "text"}
                {$opt_but_role="text"}
            {else}
                {$opt_but_role="action"}
            {/if}
            {include file="buttons/button.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_text=__("select_options") but_href="products.view?product_id=`$product.product_id`" but_role=$opt_but_role but_name="" but_meta="ty-btn__primary ty-btn__big"}
        {else}
            {if $extra_button}{$extra_button nofilter} {/if}
                {include file="buttons/add_to_cart.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_name="dispatch[checkout.add..`$obj_id`]" but_role=$but_role block_width=$block_width obj_id=$obj_id product=$product but_meta=$add_to_cart_meta}
        {assign var="cart_button_exists" value=true}
    {/if}

with

        {if !$details_page}
            {if $but_role == "text"}
                {$opt_but_role="text"}
            {else}
                {$opt_but_role="action"}
            {/if}
            {include file="buttons/button.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_text=__("add_to_cart") but_href="products.view?product_id=`$product.product_id`" but_role=$opt_but_role but_name="" but_meta="ty-btn__primary ty-btn__big"}
        {else}
            {if $extra_button}{$extra_button nofilter} {/if}
                {include file="buttons/add_to_cart.tpl" but_id="button_cart_`$obj_prefix``$obj_id`" but_name="dispatch[checkout.add..`$obj_id`]" but_role=$but_role block_width=$block_width obj_id=$obj_id product=$product but_meta=$add_to_cart_meta}
        {assign var="cart_button_exists" value=true}
    {/if}

Then clear cache

If you are familiar with hooks, use the My changes module and products:add_to_cart hook

Thanks very much for that eCom Lab! Worked a treat!!

You are welcome!