Jump to content

Archived

This topic is now archived and is closed to further replies.

kirk7880

IF Else SQL Queries

Recommended Posts

I am using joomla with virtue-mart shopping cart and i need to have the products listed for one day only. Basically, A client will sell one "type" of products (example: a lot of pc screens (1500)). When the items are sold for the day, shop closed. The item needs to be removed at 11:59 PM and activate the new Products for the following day, BUT!!! Only if the lot for today was sold out.

In other words, If all 1500 PC screen is not sold, the item carry over to the next day until the inventory is sold out.

Table name: [b]jos_vm_product[/b] <-- Need to check this table for
Column name: [b]product_publish[/b] (Values: Y,N) <-- If [[b]product_publish='Y'[/b]] [i]check[/i]
Column name: [b]product_in_stock[/b] (Values: "Empty_String" [i]or[/i] Numerical Value) <-- If [b]product_in_stock[/b] [IS empty] [[i]UPDATE[/i] the Value of Column name: [[b]product_publish='Y'[/b] [i]TO[/i] [b]product_publish='N'[/b]]

Once the currently published item is unpublished ([b]product_publish='N'[/b]) then the Next item needs to be published. Primary keys is "[b]product_id[/b]." I assume i would need to know the current "product_id" of the item to be "[b]unpublished[/b]" so i can sequence the order of items next in line to be published.

This is killing me!

Any help would be appreciated.

Share this post


Link to post
Share on other sites
I don't understand how you're going to determine the "next" product to publish.

Share this post


Link to post
Share on other sites
Hello,


Each product that's listed has a primary key (product_id). I guess i would need the "product_id" of the current item being unpublished and do ++ somehow to get the next product in line. I have no clue what i'm talking about here... so i could be 1000% wrong.

Share this post


Link to post
Share on other sites
So it's determined by UID alone? That's unusual. Sounds like the "product_publish" flag can be programatically determined at run-time -- simply find the lowest UID that not "out of stock".

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.