Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Add to Wishlist and Buy it Now buttons not working

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-17-2008, 12:17 PM
 
fireflight fireflight is offline
 

Member
  
Join Date: Jun 2008
Posts: 10
 

Unhappy Add to Wishlist and Buy it Now buttons not working

Hi folks. I'm hoping someone can help me here. I've been banging my head against this problem for ages and can't seem to make any headway.

I've got Add to wishlist and Buy it now buttons in the products displayed in my featured.tpl and subcategories.tpl. They're not behaving the way I'd expected however. Clicking on either one will take you to a page that says "Your shopping cart"/"Your wishlist is empty". This occurs whether or not the user is logged in or not.

In the featured.tpl > products.tpl and subcategories.tpl > products.tpl I'm using the following to call the buttons:
Code:
{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y"} {include file="customer/main/buy_now.tpl" product=$products[product]} {/if}

What I'd like is to have the registration/login page appear if they aren't logged in, then run through the process to register/login and add things to the cart or wishlist. I don't know if this behaviour is possible. At the minimum I'd like products to get added to the wishlist or cart.

In the event that I've edited my buynow.tpl without realizing it, here it is:
Code:
{* $Id: buy_now.tpl,v 1.1.2.28 2007/09/03 09:30:59 max Exp $ *} {if $product.price gt 0} {if $config.Product_Options.buynow_with_options_enabled eq 'Y' || ($product.avail eq 0 && $product.variantid && $product.product_type ne 'C')} {assign var="buynow_enabled" value=false} {else} {assign var="buynow_enabled" value=true} {/if} <form name="orderform_{$product.productid}_{$product.add_date}" method="post" action="{if $product.is_product_options eq 'Y' && !$buynow_enabled}product.php?productid={$product.productid}{else}cart.php?mode=add{/if}"> <input type="hidden" name="productid" value="{$product.productid}" /> <input type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}" /> <input type="hidden" name="page" value="{$smarty.get.page|escape:"html"}" /> {/if} {if $product.price eq 0} {assign var="button_href" value=$smarty.get.page|escape:"html"} {include file="buttons/buy_now.tpl" style="button" href="product.php?productid=`$product.productid`&cat=`$cat`&page=`$button_href`"} {else} {if $product.is_product_options ne 'Y' || $buynow_enabled} {if $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount) && $product.variantid} {elseif $product.distribution eq "" && !($active_modules.Subscriptions ne "" and $products[product].catalogprice)} <!--td class="BuyNowQuantity">{$lng.lbl_quantity}</td--> {if $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount)} <b> {$lng.txt_out_of_stock} </b> {else} {if $config.General.unlimited_products eq "Y"} {assign var="mq" value=$config.Appearance.max_select_quantity} {else} {math equation="x/y" x=$config.Appearance.max_select_quantity y=$product.min_amount assign="tmp"} {if $tmp<2} {assign var="minamount" value=$product.min_amount} {else} {assign var="minamount" value=1} {/if} {math equation="min(maxquantity+minamount, productquantity+1)" assign="mq" maxquantity=$config.Appearance.max_select_quantity minamount=$minamount productquantity=$product.avail} {/if} {if $product.min_amount le 1} {assign var="start_quantity" value=1} {else} {assign var="start_quantity" value=$product.min_amount} {/if} {if $config.General.unlimited_products eq "Y"} {math equation="x+y" assign="mq" x=$mq y=$start_quantity} {/if} <!--select name="amount"> {section name=quantity loop=$mq start=$start_quantity} <option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected"{/if}>{%quantity.index%}</option> {/section} </select--> {/if} {else} <input type="hidden" name="amount" value="1" /> </td> {/if} <input type="hidden" name="mode" value="add" /> {include file="customer/main/product_prices.tpl" no_span=true} {elseif $product.distribution eq "" && !($active_modules.Subscriptions ne "" and $products[product].catalogprice) && $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount) && !$product.variantid} <b> {$lng.txt_out_of_stock} </b><> {else} <br /> {/if} {if $config.General.unlimited_products eq "Y" || ($product.avail gt 0 and $product.avail ge $product.min_amount) || $product.variantid} {if $js_enabled} {if $special_offers_add_to_cart eq 'Y'} {include file="buttons/add_to_cart.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"} {else} {include file="buttons/buy_now.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"} {/if} {if ($login ne "" || $config.Wishlist.add2wl_unlogged_user eq 'Y') && $active_modules.Wishlist ne "" && $special_offers_add_to_cart eq "" && ($product.is_product_options ne 'Y' || $buynow_enabled)} {include file="buttons/add_to_wishlist.tpl" style="button" href="javascript:document.orderform_`$product.productid`_`$product.add_date`.mode.value='add2wl'; document.orderform_`$product.productid`_`$product.add_date`.submit()"} {/if} {else} {include file="submit_wo_js.tpl" value=$lng.lbl_buy_now} {/if} {/if} {if $product.min_amount gt 1} <font class="ProductDetailsTitle"> {$lng.txt_need_min_amount|substitute:"items":$product.min_amount} </font> {/if} {/if} {if $product.price gt 0} </form> {/if}
Any help is greatly appreciated!
__________________
Version 4.1.9
Reply With Quote
  #2  
Old 10-18-2008, 08:27 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Add to Wishlist and Buy it Now buttons not working

By default, Add to Wishlist will take the customer to the login page, if they are not logged in. This actually makes sense. What good is a "wishlist" if it is temporary?

Add to Cart should either take the customer to the "Cart Checkout" page or "nowhere, adds the item to their cart" depending on how you have your options set in admin.

If you have modified the templates, it appears you may have changed this behavior.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:48 AM.

   

 
X-Cart forums © 2001-2020