View Single Post
  #2  
Old 08-25-2008, 04:30 PM
 
gary02140 gary02140 is offline
 

Advanced Member
  
Join Date: Apr 2008
Posts: 58
 

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

Quote:
Originally Posted by VelocityKurt
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.

I followed your instruction and coding, but mine seems not work. In each line to be changed, you add a symbol of "-->". Should I put this code in my files as well? Meanwhile, x-cart v4.1.10 does not have include/process/product.php, but only has include/process_product.php.
__________________
Version 4.1.12
Reply With Quote