You put it wherever in your file is right after the query that
decrements the amount in the inventory table.
If you have a sku of an item that, for example, has 1 item left and is
marked 'N' for backorder, and you buy it, (ie go all the way through
the checkout process) when the query to update the inventory table
runs, the quantity will be 0. Because this sku is marked as 'N' for
backorder, the way Freetrade comes out of the box, the item has
an "Out of Stock" message on the screen, with no options to order
that particular sku. In my case, I would just rather not have it
shown so if the quantity in that inventory table is 0 then I set the
sku to inactive, and then it just doesn't show up on the item page.
THEN, if all the skus particular item are inactive,then it marks the
whole item as inactive, so the item won't show up on the website
either.
Nothing changes or updates all of a sudden, if that's what you were
expecting. All it is for is making it so that out of stock items are
not shown on the webpage (because they are marked Inactive) but
*only if you have Backorder='N' in the inventory table* because if
you're reordering items then it's ok to tell the customer that it's out
of stock and will be backordered.
On 6 Jan 2001, at 17:34, Shawn Honeychurch wrote:
> This may sound dumb but is there a specific location around line 283 that
> this has to go into? I have tried it everyplace I can find around line 283
> and it does absolutly nothing at all. Nothing updated and no change.
>
> HELP.
>
> Shawn
> ----- Original Message -----
> From: "Christie Walker" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, January 06, 2001 7:50 AM
> Subject: [FreeTrade] Marking skus/items inactive if out of stock
>
>
> > 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]
> >
> >
>
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Site: http://www.working-dogs.com/freetrade/
> Problems?: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Site: http://www.working-dogs.com/freetrade/
Problems?: [EMAIL PROTECTED]