X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   free mod - How to Change Product Availability from Admin Search (https://forum.x-cart.com/showthread.php?t=41581)

VelocityKurt 08-06-2008 08:57 AM

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.

gary02140 08-25-2008 04:30 PM

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.

VelocityKurt 08-26-2008 08:15 AM

Re: free mod - How to Change Product Availability from Admin Search
 
gary - skip the -->
I was just using those as tags. to show the code in my post.

CultTVman 09-06-2008 09:39 AM

Re: free mod - How to Change Product Availability from Admin Search
 
Any suggestions for implementing this in 4.1.9?

I ended up getting an error.

Steve

VelocityKurt 09-08-2008 08:04 AM

Re: free mod - How to Change Product Availability from Admin Search
 
Sorry but I do not know what changes x-cart may have made in later versions. Just remember that the arrows that I put in "-->" were just to mark my code in the post and should not be copied over.

chris.barber 09-10-2008 02:06 PM

Re: free mod - How to Change Product Availability from Admin Search
 
CultTVman, the only difference for 4.1.9 is that the file in step 1.0 is

1. open: include/process_product.php

Following the steps above as is after that then this works perfectly, and a very nice mod, thanks VelocityKurt, simple mod, but very effective, really pleased, it also gave me the opportunity to change the truncation of the Product Titles in the view.

CultTVman 09-11-2008 06:45 AM

Re: free mod - How to Change Product Availability from Admin Search
 
I will give it another shot and see what happens.

Thanks
Steve

collings26 10-14-2008 01:13 PM

Re: free mod - How to Change Product Availability from Admin Search
 
Anybody know how to use this mod so that the RRP or MSRP can appear and be edited from within the search results?

Chris

AG9V 03-05-2009 03:59 PM

Re: free mod - How to Change Product Availability from Admin Search
 
Awesome mod! However, I did find something that should be added in the installation instructions:

Take care not to delete the semicolon at the end of step 3. If neglected, you will get this error:
Quote:

Parse error: syntax error, unexpected T_IF in **siteroot**\include\process_product.php on line 92

gtwing 01-13-2010 11:53 AM

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

Originally Posted by collings26
Anybody know how to use this mod so that the RRP or MSRP can appear and be edited from within the search results?

Chris


In line with Chris' post, anyone know how Weight can appear and be edited from within the search results?


All times are GMT -8. The time now is 11:41 AM.

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