View Single Post
  #12  
Old 12-10-2004, 05:13 PM
 
CountyPaintball CountyPaintball is offline
 

Newbie
  
Join Date: Dec 2004
Location: NJ
Posts: 8
 

Default

I have what looks like a solution.

Note: This is not thoroughly tested. Make any changes at your own risk. Be sure to make backups of your files before changing anything.

The change required 3 file updates:

/skin1/customer/main/product.tpl
This displays the product info. You need to avoid having it write "OUT OF STOCK" where you want the qty and add to cart button.
Near line 92 you'll see code that looks like this:
{if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)}

You'll want to comment that line out as well as the resulting {/if} around line 111.

Be careful and count your "if" "/if" to make sure you get the correct pairing.

Move the code that displays "OUT OF STOCK" further up beneath the product details. It's your choice where to put it. I put it below the pricing info. This will let a customer know that there's an extra delay with this product, but they can still order it. You could also remove that code completely if you choose.
The "OUT OF STOCK" code looks something like this:
<tr><td>
{if $config.General.unlimited_products eq "N" and ($product.avail le 0 or $product.avail lt $product.min_amount)}
{$lng.txt_out_of_stock}
{/if}
</td></tr>

/customer/cart.php
Near line 150, you'll need to comment out 3 lines. They look like this:
if ($config["General"]["unlimited_products"]=="N" && $added_product["product_type"]!="C")
if ($amount > $added_product["avail"])
$amount = $added_product["avail"];

Near line 284, you need to fix the "$amount_max" so you won't have your item immediately disappear from the cart once you add it.
I added "$amount_max=100;" below the following:

if ($config["General"]["unlimited_products"]=="N" || $cart["products"][$productindex]["product_type"] == "C")
$amount_max=array_pop(func_query_first("select avail from $sql_tbl[products] where productid='$productid'"));
else
$amount_max=$updates_array[$productindex]["total_quantity"]+1;

Adding that line of code basically makes the lines above a waste, but I didn't want to delete those lines in case I need to change back. Also, setting to a hard-coded 100 is not considered good programming, but it seems to get the job done.

Finally:
/customer/func.php
In the following line, (near 1949)
$products_array = func_query_first("select $sql_tbl[products].*, min($sql_tbl[pricing].price) as price from $sql_tbl[products], $sql_tbl[pricing] where $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[products].productid='$productid' and $avail_condition $sql_tbl[pricing].quantity<=$amount and ($sql_tbl[pricing].membership='$membership' or $sql_tbl[pricing].membership='') group by $sql_tbl[products].productid order by $sql_tbl[pricing].quantity desc");

Remove the phrase "$avail_condition" so it will not perform that check anymore. The new line should look like this:
$products_array = func_query_first("select $sql_tbl[products].*, min($sql_tbl[pricing].price) as price from $sql_tbl[products], $sql_tbl[pricing] where $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[products].productid='$productid' and $sql_tbl[pricing].quantity<=$amount and ($sql_tbl[pricing].membership='$membership' or $sql_tbl[pricing].membership='') group by $sql_tbl[products].productid order by $sql_tbl[pricing].quantity desc");

Now, I repeat - this has not been thoroughly tested but it seems to work so far. I don't know if it will cause any new problems down the road so keep your backups handy. If you do find a problem with this method, please let me know. If I find any problems or better methods, I will post them here.

Thank you.
__________________
Mike Everland
CountyPaintball.com
Reply With Quote