X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Enter Quanity or Even Numbers (https://forum.x-cart.com/showthread.php?t=36781)

kini25 01-16-2008 06:01 AM

Enter Quanity or Even Numbers
 
Hey all

I have been looking at these forums for days. Found a few things that may help but here is the question.

Is there any way to change the quanity drop down to only even numbers - but only for 1 specific catagory? Or maybe have them enter the quanity instead.

The reason being that wallpaper is priced in single rolls but you must purchase them in double rolls. I have tried varients but it is not working.

Thanks for any help.

PhilJ 01-16-2008 06:18 AM

Re: Enter Quanity or Even Numbers
 
In skin1/customer/main/product.tpl

Change...
Code:

{section name=quantity loop=$mq start=$start_quantity}
To...
Code:

{if $cat eq "123"}
{section name=quantity loop=$mq start=$start_quantity step=2 start=2}
{else}
{section name=quantity loop=$mq start=$start_quantity}
{/if}

"123" being the category ID.

kini25 01-16-2008 06:23 AM

Re: Enter Quanity or Even Numbers
 
Hi
Thanks for the quick reply. Quick question -
"123 being category id" - The catagory wallpaper has many sub categories. Will this still work

PhilJ 01-16-2008 06:26 AM

Re: Enter Quanity or Even Numbers
 
Use a range of category ID's like this, say 123-130...
Code:

{if $cat gte "123" && $cat lte "130"}
Or, specific category ID's like this...
Code:

{if $cat eq "123" || $cat eq "130" || $cat eq "135"}
etc.

PhilJ 01-16-2008 06:41 AM

Re: Enter Quanity or Even Numbers
 
Alternatively, if you want an input box rather than a dropdown...
http://forum.x-cart.com/showthread.php?t=2428

kini25 01-16-2008 07:32 AM

Re: Enter Quanity or Even Numbers
 
Hello

I have tried to get this working but I keep coming up with this :

Error: Smarty error: [in customer/main/product.tpl line 146]: syntax error: unexpected {else} (Smarty_Compiler.class.php, line 468) in /home/amwallc/public_html/store/Smarty-2.6.12/Smarty.class.php on line 1095

The code on the org page looks like this before I change anything.
Quote:

<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="selected"{/if}>{%quantity.index%}</option>
{/section}
</select>
{else}
<script type="text/javascript" language="JavaScript 1.2">

PhilJ 01-16-2008 07:42 AM

Re: Enter Quanity or Even Numbers
 
ok, replace...
Code:

<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="selected"{/if}>{%quantity.index%}</option>
{/section}
</select>


With...
Code:

{if $current_category.categoryid eq "123"}
<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 start=2 step=2}
<option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected"{/if}>{%quantity.index%}</option>
{/section}
</select>
{else}
<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="selected"{/if}>{%quantity.index%}</option>
{/section}
</select>
{/if}


kini25 01-16-2008 08:26 AM

Re: Enter Quanity or Even Numbers
 
This worked out GREAT!

Thank you so Much!


All times are GMT -8. The time now is 07:26 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.