View Single Post
  #9  
Old 01-21-2004, 12:51 PM
 
gfiebich gfiebich is offline
 

Senior Member
  
Join Date: Feb 2003
Location: St. Paul, MN
Posts: 108
 

Default

I realize this is an older thread, but I thought this post might be worthwhile to someone. I had a similar need as the original poster, but decided that adding the "Availiablity" field to the "Admin / Search Products" page would make disabling products very simple - vs. using the existing "Quantity" levels to disable products as others had suggested. To do this, you need to edit two files: "skin1 / main / products.tpl" and "include / process_product.php". I did this on a 3.3.5 install - so no guarantees on it working with any other version. The following code snippets begin with existing code for placement reference.

Step 1: edit "skin1 / main / products.tpl" - add the new column header
Code:
{section name=cat_num loop=$products} { if %cat_num.first% } <table border=0> <tr class=TableHead> <td>SKU</td> <td>Product</td> {if $usertype eq "A" or $active_modules.Simple_Mode ne ""} <TD>Pos.</TD> {/if} <TD>Quantity</TD> <td colspan=2>Shop price</td> <td nowrap>Your price</td> <td>Live?</td>

Step 2: edit "skin1 / main / products.tpl" - add the new "Availablity" field
Code:
<td nowrap align=right> <input type="text" size="7" value="{$products[cat_num].price}" name="product_price[{$products[cat_num].productid}]"> </td> <td> <input type="text" size="3" value="{$products[cat_num].forsale}" name="product_forsale[{$products[cat_num].productid}]"> </td>

Step 3: edit "include / process_product.php" - add the code that saves changes to "forsale"
Code:
if ($product_orderby) { foreach ($product_orderby as $key1 => $value) db_query ("UPDATE $sql_tbl[products] SET orderby='$value' WHERE productid='$key1'"); } if ($product_forsale) { foreach ($product_forsale as $key1 => $value) db_query ("UPDATE $sql_tbl[products] SET forsale='$value' WHERE productid='$key1'"); }

That's it! Now you can do a product search in Admin and update the availability of a batch of products in one pass - vs. opening each product detail, changing the availability, saving, etc.

-Glen
Reply With Quote