Here's some code you might find useful if you have skus that are 
not being reordered when they are out of stock.  I am setting them 
Inactive so they do not show up on the website.  THen, if all skus 
of an item are marked inactive, I'm setting the whole item inactive 
so it doesn't show up on the website either.  This goes immediately 
after the inventory is decremented for the order, around line 283 in 
actions/SUBMIT_ORDER.


/* CW - if sku count=0 then mark sku as inactive so it doesn't 
show up on the website, if not reordering */
 $Query = "SELECT Available, Item FROM inventory i JOIN sku s 
WHERE s.ID = i.SKU and SKU = $ReduceStock_sku[$index] and 
Backorder='N'";
 $DatabaseResult = mysql_query($Query, $DatabaseLink);
 if (mysql_numrows($DatabaseResult)>0) {
         $row = mysql_fetch_row($DatabaseResult);
         if ($row[0]<1) {
                 $Query = "UPDATE sku SET Active='N' WHERE ID = 
$ReduceStock_sku[$index]";
                 $DatabaseResult = mysql_query($Query, $DatabaseLink);
                 /* CW - if all of an item's skus are inactive, mark the item 
inactive */
                 $Query = "SELECT Active from sku WHERE Item = 
$row[1] GROUP BY Active";
             $DatabaseResult = mysql_query($Query, $DatabaseLink);
             if (mysql_numrows($DatabaseResult)==1) {
                     $Query = "UPDATE item SET Active='N' WHERE 
ID=$row[1]";
                   $DatabaseResult = mysql_query($Query, 
$DatabaseLink);
                  }
       }
}



------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to