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

Unique Quantities

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-05-2007, 07:24 AM
 
RobinBraves RobinBraves is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: FL
Posts: 98
 

Cool Unique Quantities

I have searched all through the forums for this answer, but haven't had any success.

I need to have unique quantity amounts for different products. These are not in any increments or even pattern. Here is a sample of what I need:

Product 1:
100
250
500
1000
2000
3000

Product 2:
100
250
500
1000
1500
2000
2500
3000
4000
5000

So, my products don't each have the same amounts in them. I can do this easily using "product options" and created an option group, but this will effect my discounts based on quantity.

So, my question is.. is there a way to change the quantity amounts per product to set amounts? If so, how can this be done?

~Robin
__________________
Version 4.1.11
Reply With Quote
  #2  
Old 03-05-2007, 07:26 AM
 
RobinBraves RobinBraves is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: FL
Posts: 98
 

Default Re: Unique Quantities

Hmm, I just realized... I can't do it this way. I don't have a set base price that just gets multiplied by the quantity either. So, I guess I will stick with using the "product options and variants" way which works great, but now I need to know how to get rid of the quantity box from everywhere/
__________________
Version 4.1.11
Reply With Quote
  #3  
Old 03-05-2007, 07:40 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Unique Quantities

If you are going to use variants (good choice) fix the max qty to 1 in your admin. The customer will be buying 1 SKU of 2,000 pieces. You can HIDE the display of the pulldown in product.tpl, but don't hide the underlying math --

Or don't hide the qty -- this will make it very clear that the customer is buying a single sku of many pieces.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #4  
Old 03-05-2007, 07:48 AM
 
RobinBraves RobinBraves is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: FL
Posts: 98
 

Default Re: Unique Quantities

Okay, that's a good idea. Can you assist me in what code to comment out in the product.tpl file to HIDE the quantity text and drop down?
__________________
Version 4.1.11
Reply With Quote
  #5  
Old 02-07-2008, 07:51 AM
 
delphi delphi is offline
 

Senior Member
  
Join Date: Jul 2004
Posts: 185
 

Default Re: Unique Quantities

Quote:
Originally Posted by RobinBraves
Okay, that's a good idea. Can you assist me in what code to comment out in the product.tpl file to HIDE the quantity text and drop down?

Okay, the way I do it for my site is this. You open file product.tpl in customer/main folder

Then do a few if else statement. I have on my site only 1 product that has variant options, but if you have more than 1 then you need to do a few more if else

Look for this line:
PHP Code:
<tr><td height="25" width="30%">{$lng.lbl_quantity}{if $product.min_amount gt 1}<br /><font class="ProductDetailsTitle">{$lng.txt_need_min_amount|substitute:"items":$product.min_amount}</font>{/if}</td

then insert a first if before line above, in this case, my product id is 9:
PHP Code:
{if $product.productid ne "9"

Then go to this line:
PHP Code:
<font class="ProductDetailsTitle">1</font><input type="hidden" name="amount" value="1" /> {if $product.distribution ne ""}{$lng.txt_product_downloadable}{/if}
{/if}
{/if}
</
td></tr

put a {else} after it, then paste this code after {else}

PHP Code:
<tr><td height="25" width="30%">{$lng.lbl_quantity}{if $product.min_amount gt 1}<br /><font class="ProductDetailsTitle">{$lng.txt_need_min_amount|substitute:"items":$product.min_amount}</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 ''}
<
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"}
{
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.distribution eq "" and !($active_modules.Subscriptions ne "" and $subscription)}
{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}
<
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="selected"{/if}>{%quantity.index%}</option>
{/
section}
</
select>
{else}
<
script type="text/javascript" language="JavaScript 1.2">
<!--
var 
min_avail 1;
var 
avail 1;
var 
product_avail 1;
-->
</
script>
<
font class="ProductDetailsTitle">1</font><input type="hidden" name="amount" value="1" /> {if $product.distribution ne ""}{$lng.txt_product_downloadable}{/if}
{/if}
{/if}
</
td></tr

Now put a {/if} after it.

The trick to make your "real" quantity box disappear is, find this code:
PHP 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

and replace it with:
PHP Code:
<input value="1" name="amount" id="product_avail" type="hidden"

voila!
__________________
X-Cart Gold version 4.4.4
X-Cart directory /home/web/u/ugchweb/cart
PHP 5
MySQL server 5
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 02:44 PM.

   

 
X-Cart forums © 2001-2020