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

Enter Quanity or Even Numbers

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-16-2008, 06:01 AM
 
kini25 kini25 is offline
 

Advanced Member
  
Join Date: Mar 2007
Posts: 30
 

Default 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.
__________________
ver. 4.1.9
Reply With Quote
  #2  
Old 01-16-2008, 06:18 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default 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.
__________________
xcartmods.co.uk
Reply With Quote
  #3  
Old 01-16-2008, 06:23 AM
 
kini25 kini25 is offline
 

Advanced Member
  
Join Date: Mar 2007
Posts: 30
 

Default 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
__________________
ver. 4.1.9
Reply With Quote
  #4  
Old 01-16-2008, 06:26 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default 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.
__________________
xcartmods.co.uk
Reply With Quote
  #5  
Old 01-16-2008, 06:41 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default 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
__________________
xcartmods.co.uk
Reply With Quote
  #6  
Old 01-16-2008, 07:32 AM
 
kini25 kini25 is offline
 

Advanced Member
  
Join Date: Mar 2007
Posts: 30
 

Default 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 46 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">
__________________
ver. 4.1.9
Reply With Quote
  #7  
Old 01-16-2008, 07:42 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default 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}
__________________
xcartmods.co.uk
Reply With Quote
  #8  
Old 01-16-2008, 08:26 AM
 
kini25 kini25 is offline
 

Advanced Member
  
Join Date: Mar 2007
Posts: 30
 

Default Re: Enter Quanity or Even Numbers

This worked out GREAT!

Thank you so Much!
__________________
ver. 4.1.9
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 11:24 AM.

   

 
X-Cart forums © 2001-2020