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)
-   -   Unique Quantities (https://forum.x-cart.com/showthread.php?t=29386)

RobinBraves 03-05-2007 07:24 AM

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

RobinBraves 03-05-2007 07:26 AM

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/

carpeperdiem 03-05-2007 07:40 AM

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.

RobinBraves 03-05-2007 07:48 AM

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?

delphi 02-07-2008 07:51 AM

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!


All times are GMT -8. The time now is 02:39 PM.

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