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

Almost finished mod for drop ship, then this broke

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-06-2007, 10:30 PM
 
gkeraunen gkeraunen is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 37
 

Default Almost finished mod for drop ship, then this broke

I put in some code to to check extra fields for drop_ship_allow and and inventory=0 then allow add to cart button and emulate "unlimited products". Strange, it worked when testing, but today when updating inventory (about to open the store again) it stops adding to cart only when inventory is set to 0. Grr.

What's strange is when I diff the generated source of the pages (inventory set to 1 places the product in the cart and inventory set to 0 does not) the only difference I can find is that var product_avail = 1 in the page that does add to cart. I tested forcing var product_avail = 1 and still no product sent to cart. Is there something else I should be looking for that is required for the form to POST the proper data to the cart?

This page has a product set to allow drop_ship_ordering, and inventory is set to 0: http://brainwavestoys.com/product.php?productid=1035

For the bold, here's my product.tpl code. Thanks for any pointers to my error.

-Michael

Code:
{* $Id: product.tpl,v 1.96.2.18 2005/03/23 08:16:03 max Exp $ *} {if $active_modules.Special_Offers} {include file="modules/Special_Offers/customer/product_offers_short_list.tpl" product=$product} {/if} {include file="form_validation_js.tpl"} {if $product.product_type eq "C"} {include file="modules/Product_Configurator/pconf_customer_product.tpl"} {else} {capture name=dialog} <TABLE border="0" width="100%"> <FORM name="orderform" method="post" action="cart.php?mode=add" onsubmit="javascript: return FormValidation();"> <TR> <TD valign="top" align="left" rowspan="2" width="100"> {include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail"}&nbsp; </TD> <TD valign="top"> <SPAN class=> {if $product.fulldescr ne ""}{$product.fulldescr}{else}{$product.descr}{/if} </SPAN> <P> <TABLE width="100%" cellpadding="0" cellspacing="0" border="0"> <TR><TD colspan="2"><B><FONT class="ProductDetailsTitle">{$lng.lbl_details}</FONT></B></TD></TR> <TR><TD class="Line" height="1" colspan="2"><IMG src="{$ImagesDir}/spacer.gif" width="1" height="1" border="0"></TD></TR> <TR><TD colspan="2">&nbsp;</TD></TR> {if $config.Appearance.show_in_stock eq "Y" and $config.General.unlimited_products ne "Y" and $product.distribution eq ""} <TR><TD width="30%">{$lng.lbl_quantity}</TD><TD nowrap><SPAN id="product_avail_txt">{if $product.avail gt 0}{$product.avail}</SPAN>{else}{$lng.txt_no}{/if} {$lng.txt_items_available}</TD></TR> {/if} {if $product.weight ne "0.00"}<TR><TD width="30%">{$lng.lbl_weight}</TD><TD nowrap><SPAN id="product_weight">{$product.weight}</SPAN> {$config.General.weight_symbol}</TD></TR>{/if} {if $active_modules.Extra_Fields ne ""} {include file="modules/Extra_Fields/product.tpl"} {* begin Michael's Modification to include affiliate products in X-Cart June 26 2007 *} {section name=field loop=$extra_fields} {if $extra_fields[field].field eq 'AffiliateVendorProductURL'} {if $extra_fields[field].field_value ne ''} {assign var=aff_url value=`$extra_fields[field].field_value`}{/if} {/if} {if $extra_fields[field].field eq 'DropShipMessage'} {if $extra_fields[field].field_value ne ''} {assign var=drop_ship_message value=`$extra_fields[field].field_value`} {/if} {/if} {if $extra_fields[field].field eq 'AllowDropShip'} {if $extra_fields[field].field_value eq "Y"} {assign var=allow_drop_ship value=`$extra_fields[field].field_value`}{/if} {/if} {/section} {* end Michael's Modification to include affiliate products in X-Cart June 26 2007 *} {/if} {*snip for post size *} </TABLE> <P> <TABLE border="0" width="100%" cellpadding="0" cellspacing="0"> <TR><TD colspan="2"> <B><FONT class="ProductDetailsTitle">{$lng.lbl_options}</FONT></B> </TD></TR> <TR><TD class="Line" height="1" colspan="2"><IMG src="{$ImagesDir}/spacer.gif" width="1" height="1" border="0"></TD></TR> <TR><TD colspan="2">&nbsp;</TD></TR> {if $active_modules.Product_Options ne ""} { include file="modules/Product_Options/customer_options.tpl"} {/if} <TR><TD height="25" width="30%">{$lng.lbl_quantity}{if $product.min_amount gt 1}<BR><FONT class="ProductDetailsTitle">{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>{/if}</TD> <TD> {if $config.General.unlimited_products eq "N" and ($product.avail le 0 or $product.avail lt $product.min_amount) and $variants eq '' and $allow_drop_ship ne "Y"} <SCRIPT type="text/javascript" language="JavaScript 1.2"> var min_avail = 1; var avail = 0; var product_avail = 0; </SCRIPT> <B>{$lng.txt_out_of_stock}</B> {else} {if $config.General.unlimited_products eq "Y" or $allow_drop_ship eq "Y"} {math equation="x+1" assign="mq" x=$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.distribution eq ""} {if $product.min_amount le 1} {assign var="start_quantity" value=1} {else} {assign var="start_quantity" value=$product.min_amount} {/if} <SCRIPT type="text/javascript" language="JavaScript 1.2"> var min_avail = {$start_quantity|default:1}; var avail = {$mq|default:1}-1; var product_avail = {$product.avail|default:"0"}; </SCRIPT> <SELECT id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_wholesale(this.value);"{/if}> {section name=quantity loop=$mq start=$start_quantity} <OPTION value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</OPTION> {/section} </SELECT> {else} <FONT class="ProductDetailsTitle">1</FONT><INPUT type="hidden" name="amount" value="1"> {$lng.txt_product_downloadable} {/if} {/if} </TD></TR> <TR><TD colspan="2"> <INPUT type="hidden" name="mode" value="add"> {if $variants eq ''} {include file="customer/main/product_prices.tpl"} {/if} {if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount) or $allow_drop_ship eq "Y"} {if $js_enabled} <BR> {if $smarty.get.pconf ne ""} <INPUT type="hidden" name="slot" value="{$smarty.get.slot}"> <INPUT type="hidden" name="addproductid" value="{$product.productid}"> {* begin Michael's Modification to include affiliate products in X-Cart June 26 2007 *} {if $aff_url ne ''} {include file="buttons/add_to_cart.tpl" button_title=$lng.lbl_pconf_add_to_configuration style="button" href="$aff_url"} {else} {include file="buttons/button.tpl" button_title=$lng.lbl_pconf_add_to_configuration style="button" href="javascript:if (FormValidation()) `$ldelim`document.orderform.productid.value='`$smarty.get.pconf`'; document.orderform.action='pconf.php';document.orderform.submit()`$rdelim`"} {if $allow_drop_ship eq "Y" and $product.avail le 0} <b>{$drop_ship_message}</b><br><br> {/if} {/if} {/if} {if $product.forsale ne "B"} {* begin Michael's Modification to include affiliate products in X-Cart June 26 2007 *} {if $aff_url ne ''} {include file="buttons/add_to_cart.tpl" style="button" href="$aff_url"} {else} {include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"} {if $allow_drop_ship eq "Y" and $product.avail le 0} <b>{$drop_ship_message}</b><br><br> {/if} {/if} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {if $login ne "" and $active_modules.Wishlist ne ""} {include file="customer/add2wl.tpl"} {/if} {else} {$lng.txt_pconf_product_is_bundled} {/if} {else} {include file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart} {/if} {/if} {if $active_modules.Feature_Comparison ne ""} {include file="modules/Feature_Comparison/product_buttons.tpl"} {/if} <BR><INPUT type="image" src="{$ImagesDir}/null.gif" width="10" height="10" border="0" valign="top"><BR> </TD> </TR></TABLE> </TD> <TD align="right" valign="top" width="60"> {if $product.list_price gt 0 and $product.taxed_price lt $product.list_price}<TABLE border="0" width="60"><TR><TD width="55" height="56" class="SaveMoneyLabel" background="{$ImagesDir}/save_money.gif" align="center" valign="middle"> <BR> {math equation="100-(price/lprice)*100" price=$product.taxed_price lprice=$product.list_price format="%d" assign=discount} &nbsp;<SPAN id="save_percent">{ $discount }</SPAN>% </TD></TR></TABLE>{/if} </TD> </TR> <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"}"> </FORM> </TABLE> {/capture} {include file="dialog.tpl" title=$product.producttitle content=$smarty.capture.dialog extra="width=100%"} {/if} <P> {include file="customer/main/send_to_friend.tpl" } {if $active_modules.Detailed_Product_Images ne ""} <P> {include file="modules/Detailed_Product_Images/product_images.tpl" } {/if} {if $active_modules.Upselling_Products ne ""} <P> {include file="modules/Upselling_Products/related_products.tpl" } {/if} {if $active_modules.Recommended_Products ne ""} <P> {include file="modules/Recommended_Products/recommends.tpl" } {/if} {if $active_modules.Customer_Reviews ne ""} <P> {include file="modules/Customer_Reviews/vote_reviews.tpl" } {/if} {if $active_modules.Product_Options ne '' && $product_options ne '' && $allow_drop_ship ne "Y"} <SCRIPT type="text/javascript" language="JavaScript 1.2"> check_options(); </SCRIPT> {/if}
__________________
X-Cart 4.1.9
PHP 4.4.1
MySQL 4.0.27
Linux
Apache
Reply With Quote
  #2  
Old 11-07-2007, 06:32 AM
 
gkeraunen gkeraunen is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 37
 

Default Re: Almost finished mod for drop ship, then this broke

Ah. Hold up. I believe my procuct.tpl is doing what is intended. I believe my next step is in cart.php or cart.tpl. Will keep you posted.
__________________
X-Cart 4.1.9
PHP 4.4.1
MySQL 4.0.27
Linux
Apache
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 02:24 PM.

   

 
X-Cart forums © 2001-2020