Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

free mod - How to Change Product Availability from Admin Search

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #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
  #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
  #3  
Old 08-26-2008, 08:15 AM
 
VelocityKurt VelocityKurt is offline
 

Newbie
  
Join Date: Nov 2007
Posts: 3
 

Default 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.
__________________
VelocityArtAndDesign.com
X-Cart v. 4.1.6
Reply With Quote
  #4  
Old 09-06-2008, 09:39 AM
 
CultTVman CultTVman is offline
 

Member
  
Join Date: Feb 2008
Posts: 16
 

Default 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
__________________
xcart 4.1.9
Preorder/Back Order
ezUpsell
Reply With Quote
  #5  
Old 09-08-2008, 08:04 AM
 
VelocityKurt VelocityKurt is offline
 

Newbie
  
Join Date: Nov 2007
Posts: 3
 

Default 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.
__________________
VelocityArtAndDesign.com
X-Cart v. 4.1.6
Reply With Quote
  #6  
Old 09-10-2008, 02:06 PM
 
chris.barber chris.barber is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 74
 

Default 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.
__________________
Chris Barber
Version 4.1.9
MOD - BCSE Shipping Estimator
MOD - Shopzilla Feed
MOD - Price Match with Captcha
MOD - Links Manager 2008
MOD - One Page Checkout
MOD - Sitemap
Reply With Quote
  #7  
Old 09-11-2008, 06:45 AM
 
CultTVman CultTVman is offline
 

Member
  
Join Date: Feb 2008
Posts: 16
 

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

I will give it another shot and see what happens.

Thanks
Steve
__________________
xcart 4.1.9
Preorder/Back Order
ezUpsell
Reply With Quote
  #8  
Old 10-14-2008, 01:13 PM
 
collings26 collings26 is offline
 

Senior Member
  
Join Date: Dec 2007
Posts: 149
 

Default 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
__________________
X-Cart v4.1.9 [unix]
Reply With Quote
  #9  
Old 03-05-2009, 03:59 PM
 
AG9V AG9V is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 73
 

Default 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
__________________
X-Cart Gold 4.1.10
XCSEO Pro 1.1.7
IIS 7 / Windows 2008
PHP Version 5.2.6
MySQL Version 5.0.51a
Reply With Quote
  #10  
Old 01-13-2010, 11:53 AM
  gtwing's Avatar 
gtwing gtwing is offline
 

Advanced Member
  
Join Date: Jan 2006
Location: Running Springs, CA
Posts: 66
 

Default 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?
__________________
Gary M. Twing
Eagle Mountain Outfitters
eaglemtnoutfitters.com
Version 4.3.0 Gold
4.4.4 in operibus
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:54 AM.

   

 
X-Cart forums © 2001-2020