View Single Post
  #1  
Old 08-06-2008, 08:57 AM
 
VelocityKurt VelocityKurt is offline
 

Newbie
  
Join Date: Nov 2007
Posts: 3
 

Default free mod - How to Change Product Availability from Admin Search

Hi All,
I've been working with X-Cart for about a year now and have been slowly modifying things to make my daily job managing products easier. This tweak will allow you to change the product Availability directly from the Admin Product Search Results page without needing to go into the individual products.
Here is what you need to change:

Of course back up your files first before changing them.

1. open: include/process/product.php
2. around line 89 fine
--># Perform SQL query to update products
if (!empty($update))
db_query("UPDATE $sql_tbl[products] SET ".implode(",", $update)." WHERE productid='$k'")

3. Change it to
--># Perform SQL query to update products
if (!empty($update))
db_query("UPDATE $sql_tbl[products] SET ".implode(",", $update).", forsale='".$v["forsale"]."' WHERE productid='$k'")

4. Save the file

5. Open: skin1/main/products.tpl
6. Add a new column to the header row around line 38 or the line above {$lng.lbl_in_stock}
I just hard coded it with --> <td nowrap="nowrap">Availability</td>

7. Now fine the block
-->{if $main eq "category_products"}
<td><input type="text" size="9" maxlength="10" name="posted_data[{$products[prod].productid}][orderby]" value="{$products[prod].orderby}" /></td>
{/if}

and after it add
-->
<td class="ProductDetails">
<select name="posted_data[{$products[prod].productid}][forsale]">
<option value="Y"{if $products[prod].forsale eq "Y"} selected="selected"{/if}>{$lng.lbl_avail_for_sale}</option>
<option value="H"{if $products[prod].forsale eq "H"} selected="selected"{/if}>{$lng.lbl_hidden}</option>
<option value="N"{if $products[prod].forsale ne "Y" && $product.forsale ne "H" && ($products[prod].forsale ne "B" || not $active_modules.Product_Configurator)} selected="selected"{/if}>{$lng.lbl_disabled}</option>
{if $active_modules.Product_Configurator}
<option value="B"{if $products[prod].forsale eq "B"} selected="selected"{/if}>{$lng.lbl_bundled}</option>
{/if}
</select>
</td>

8. Save it and you are done.

I know you can do a batch update by selecting the group of results and doing the batch modify from within the product modification page but this saves a little time; which for me adds up to hours a week.
__________________
VelocityArtAndDesign.com
X-Cart v. 4.1.6
Reply With Quote