Product Page Add To Wish List Link Not Working ** Important **

Hi,



I recently modified the look of the product page to show 3 columns. First column is to show pictures, second column is to show title, product code, review and social icons, third column is showing the price, availability, quantity, add to cart, add to wish list and reward points. For some reason my Add to Wish List link is not working.



I added a brand new template under the my_changes folder called custom_template.tpl which is a copy of the product_templates/default_template.tpl. I had to add a table to have it display all information in 3 different columns. Looks like the Add to Wish List Link stopped working after I added the

code inside the template, if i remove the table variable the link starts working but than it breaks the whole table into one column. Here is the code, please let me know what I'm doing wrong that is causing the add to wish list not to work using a table structure.



{script src=“js/tygh/exceptions.js”}




{hook name="products:view_main_info"}

{if $product}
{assign var="obj_id" value=$product.product_id}
{include file="common/product_data.tpl" product=$product separate_buttons=$separate_buttons|default:true but_role="big" but_text=__("add_to_cart")}











{if !$no_images}


{assign var="discount_label" value="discount_label_`$obj_prefix``$obj_id`"}
{$smarty.capture.$discount_label nofilter}

{include file="views/products/components/product_images.tpl" product=$product show_detailed_link="Y" image_width=$settings.Thumbnails.product_details_thumbnail_width image_height=$settings.Thumbnails.product_details_thumbnail_height}

{/if}





{hook}
{if !$hide_title}

{$product.product nofilter}

{/if}



{include file="views/products/components/product_features_short_list.tpl" features=$product.header_features}

{/hook}







{assign var="sku" value="sku_`$obj_id`"}
{$smarty.capture.$sku nofilter}





{hook name="products:main_info_title"}
{/hook}



{hook name="products:image_wrap" }
{/hook}


{assign var="form_open" value="form_open_`$obj_id`"}
{$smarty.capture.$form_open nofilter}


{assign var="old_price" value="old_price_`$obj_id`"}
{assign var="price" value="price_`$obj_id`"}
{assign var="clean_price" value="clean_price_`$obj_id`"}
{assign var="list_discount" value="list_discount_`$obj_id`"}
{assign var="discount_label" value="discount_label_`$obj_id`"}

{hook name="products:promo_text"}

{$product.promo_text nofilter}

{/hook}

{if $smarty.capture.$old_price|trim || $smarty.capture.$clean_price|trim || $smarty.capture.$list_discount|trim}

{if $smarty.capture.$old_price|trim}{$smarty.capture.$old_price nofilter} {/if}
{/if}

{if !$smarty.capture.$old_price|trim || $details_page}

{/if}
{$smarty.capture.$price nofilter}
{if !$smarty.capture.$old_price|trim || $details_page}

{/if}

{if $smarty.capture.$old_price|trim || $smarty.capture.$clean_price|trim || $smarty.capture.$list_discount|trim}
{$smarty.capture.$clean_price nofilter}
{$smarty.capture.$list_discount nofilter}

{/if}






{assign var="product_amount" value="product_amount_`$obj_id`"}
{$smarty.capture.$product_amount nofilter}

{assign var="qty" value="qty_`$obj_id`"}
{$smarty.capture.$qty nofilter}

{assign var="min_qty" value="min_qty_`$obj_id`"}
{$smarty.capture.$min_qty nofilter}




{if $capture_options_vs_qty}{capture name="product_options"}{$smarty.capture.product_options nofilter}{/if}

{if $capture_options_vs_qty}{/capture}{/if}

{assign var="product_edp" value="product_edp_`$obj_id`"}
{$smarty.capture.$product_edp nofilter}

{if $show_descr}
{assign var="prod_descr" value="prod_descr_`$obj_id`"}

{__("description")}


{$smarty.capture.$prod_descr nofilter}


{/if}



{if $capture_buttons}{capture name="buttons"}{/if}


{if $show_details_button}
{include file="buttons/button.tpl" but_href="products.view?product_id=`$product.product_id`" but_text=__("view_details") but_role="submit"}
{/if}

{assign var="add_to_cart" value="add_to_cart_`$obj_id`"}
{$smarty.capture.$add_to_cart nofilter}

{assign var="list_buttons" value="list_buttons_`$obj_id`"}
{$smarty.capture.$list_buttons nofilter}




{if $capture_buttons}{/capture}{/if}

{assign var="form_close" value="form_close_`$obj_id`"}
{$smarty.capture.$form_close nofilter}

{if $show_product_tabs}
{include file="views/tabs/components/product_popup_tabs.tpl"}
{$smarty.capture.popupsbox_content nofilter}
{/if}


{assign var="product_options" value="product_options_`$obj_id`"}
{$smarty.capture.$product_options nofilter}

{if $capture_options_vs_qty}{/capture}{/if}



{if $capture_options_vs_qty}{capture name="product_options"}{$smarty.capture.product_options nofilter}{/if}
{assign var="advanced_options" value="advanced_options_`$obj_id`"}
{$smarty.capture.$advanced_options nofilter}
{if $capture_options_vs_qty}{/capture}{/if}



{if $capture_options_vs_qty}{capture name="product_options"}{$smarty.capture.product_options nofilter}{/if}


{/if}
{/hook}


{if $smarty.capture.hide_form_changed == "Y"}
{assign var="hide_form" value=$smarty.capture.orig_val_hide_form}
{/if}

{if $show_product_tabs}

{include file="views/tabs/components/product_tabs.tpl"}

{if $blocks.$tabs_block_id.properties.wrapper}
{include file=$blocks.$tabs_block_id.properties.wrapper content=$smarty.capture.tabsbox_content title=$blocks.$tabs_block_id.description}
{else}
{$smarty.capture.tabsbox_content nofilter}
{/if}

{/if}





{capture name="mainbox_title"}{assign var="details_page" value=true}{/capture}

Thank you.

screenshot.jpg

hi,



the first reason might be that the button is outside the FORM so please check it with developer console.

in addition, please check for Javascript errors in developer console on clicking - is there any?



best regards,

WSA team

Hi,



Please let me know how to check for javascript errors and if button code is outside the form using the developer console?



Where would I find the developer console and are there instructions on how to use it?



Thanks.

Please PM me the url to the product. Our specialists will check it

I currently have it on my local machine so not sure how to PM the url to you? Would you happen to have a way to check for errors or broken loops? Also where would i find the developer console, is the developer console the same as the debugger that comes with cs-cart?



Thanks.

Where do i find the developer console so I can find the problem with my button not working?



Thanks.

I already added the code in this article and can't seem to find that the add to wish list code is outside of the form. Please let me know as soon as possible?



Thanks.

According to your code the button is located inside the form. About developers console, please check



https://developer.mozilla.org/en-US/docs/Tools/Web_Console

Hi,



I attached a screenshot of the errors on the product page. Would you please let me know what the problem might be as I'm not able to determine why the button is still not working.



Thanks.

screenshot.png

Please let me know whenever I remove the

from the default_template.tpl that was added by me the add to wish list button starts working but whenever I add the add to wish list inside the
code it stops working?

Something wrong with the closed tags. Please pay attention into the following part of code:


```php




```

The [b]div [/b]should not be closed between the [b]td [/b]and [b]tr [/b]tags

Corrected the closed tags and still the add to wish list button not working. Here is the revised code. Please let me know what the problem might be so I can fix it?



{script src=“js/tygh/exceptions.js”}




{hook name="products:view_main_info"}

{if $product}
{assign var="obj_id" value=$product.product_id}
{include file="common/product_data.tpl" product=$product separate_buttons=$separate_buttons|default:true but_role="big" but_text=__("add_to_cart")}










{if !$no_images}


{assign var="discount_label" value="discount_label_`$obj_prefix``$obj_id`"}
{$smarty.capture.$discount_label nofilter}

{include file="views/products/components/product_images.tpl" product=$product show_detailed_link="Y" image_width=$settings.Thumbnails.product_details_thumbnail_width image_height=$settings.Thumbnails.product_details_thumbnail_height}

{/if}





{hook}
{if !$hide_title}

{$product.product nofilter}

{/if}



{include file="views/products/components/product_features_short_list.tpl" features=$product.header_features}

{/hook}







{assign var="sku" value="sku_`$obj_id`"}
{$smarty.capture.$sku nofilter}





{hook name="products:main_info_title"}
{/hook}



{hook name="products:image_wrap" }
{/hook}


{assign var="form_open" value="form_open_`$obj_id`"}
{$smarty.capture.$form_open nofilter}


{assign var="old_price" value="old_price_`$obj_id`"}
{assign var="price" value="price_`$obj_id`"}
{assign var="clean_price" value="clean_price_`$obj_id`"}
{assign var="list_discount" value="list_discount_`$obj_id`"}
{assign var="discount_label" value="discount_label_`$obj_id`"}

{hook name="products:promo_text"}

{$product.promo_text nofilter}

{/hook}

{if $smarty.capture.$old_price|trim || $smarty.capture.$clean_price|trim || $smarty.capture.$list_discount|trim}

{if $smarty.capture.$old_price|trim}{$smarty.capture.$old_price nofilter} {/if}
{/if}

{if !$smarty.capture.$old_price|trim || $details_page}

{/if}
{$smarty.capture.$price nofilter}
{if !$smarty.capture.$old_price|trim || $details_page}

{/if}

{if $smarty.capture.$old_price|trim || $smarty.capture.$clean_price|trim || $smarty.capture.$list_discount|trim}
{$smarty.capture.$clean_price nofilter}
{$smarty.capture.$list_discount nofilter}

{/if}






{assign var="product_amount" value="product_amount_`$obj_id`"}
{$smarty.capture.$product_amount nofilter}

{assign var="qty" value="qty_`$obj_id`"}
{$smarty.capture.$qty nofilter}

{assign var="min_qty" value="min_qty_`$obj_id`"}
{$smarty.capture.$min_qty nofilter}




{if $capture_options_vs_qty}{capture name="product_options"}{$smarty.capture.product_options nofilter}{/if}

{if $capture_options_vs_qty}{/capture}{/if}

{assign var="product_edp" value="product_edp_`$obj_id`"}
{$smarty.capture.$product_edp nofilter}

{if $show_descr}
{assign var="prod_descr" value="prod_descr_`$obj_id`"}

{__("description")}


{$smarty.capture.$prod_descr nofilter}


{/if}



{if $capture_buttons}{capture name="buttons"}{/if}


{if $show_details_button}
{include file="buttons/button.tpl" but_href="products.view?product_id=`$product.product_id`" but_text=__("view_details") but_role="submit"}
{/if}

{assign var="add_to_cart" value="add_to_cart_`$obj_id`"}
{$smarty.capture.$add_to_cart nofilter}

{assign var="list_buttons" value="list_buttons_`$obj_id`"}
{$smarty.capture.$list_buttons nofilter}




{if $capture_buttons}{/capture}{/if}

{assign var="form_close" value="form_close_`$obj_id`"}
{$smarty.capture.$form_close nofilter}

{if $show_product_tabs}
{include file="views/tabs/components/product_popup_tabs.tpl"}
{$smarty.capture.popupsbox_content nofilter}
{/if}


{assign var="product_options" value="product_options_`$obj_id`"}
{$smarty.capture.$product_options nofilter}

{if $capture_options_vs_qty}{/capture}{/if}



{if $capture_options_vs_qty}{capture name="product_options"}{$smarty.capture.product_options nofilter}{/if}
{assign var="advanced_options" value="advanced_options_`$obj_id`"}
{$smarty.capture.$advanced_options nofilter}
{if $capture_options_vs_qty}{/capture}{/if}



{if $capture_options_vs_qty}{capture name="product_options"}{$smarty.capture.product_options nofilter}{/if}


{/if}
{/hook}



{if $smarty.capture.hide_form_changed == "Y"}
{assign var="hide_form" value=$smarty.capture.orig_val_hide_form}
{/if}

{if $show_product_tabs}

{include file="views/tabs/components/product_tabs.tpl"}

{if $blocks.$tabs_block_id.properties.wrapper}
{include file=$blocks.$tabs_block_id.properties.wrapper content=$smarty.capture.tabsbox_content title=$blocks.$tabs_block_id.description}
{else}
{$smarty.capture.tabsbox_content nofilter}
{/if}

{/if}





{capture name="mainbox_title"}{assign var="details_page" value=true}{/capture}

Thanks for your help!

It is hard to say anything here. Try to format the file according to CS-Cart standards and make sure that all opened tags are closed

I double checked the whole code and fixed all closing tags and still button is not working. If i remove the table from the code the button starts working. Please please help me get this problem fixed?



Thanks.

Any fixes?

If I add the code before the product add to cart and add to wish list button it works but I don't want the social icons to be right next to my add to wish list button:





{hook name=“products:image_wrap” }

{/hook}





{assign var=“form_open” value=“form_open_$obj_id”}

{$smarty.capture.$form_open nofilter}



Please help!



Thanks.

Still waiting on a reply/solution?

Hello?

The reason why you are not getting any responses is because it is not easy to figure out the issue when you have made your own modifications. I suggest you upload the original file and start again with your modifications being careful on what you modify.