Jump to content


Photo

IF Else SQL Queries


  • Please log in to reply
3 replies to this topic

#1 kirk7880

kirk7880
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 01 March 2006 - 11:52 PM

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: jos_vm_product <-- Need to check this table for
Column name: product_publish (Values: Y,N) <-- If [product_publish='Y'] check
Column name: product_in_stock (Values: "Empty_String" or Numerical Value) <-- If product_in_stock [IS empty] [UPDATE the Value of Column name: [product_publish='Y' TO product_publish='N']

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

This is killing me!

Any help would be appreciated.

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 02 March 2006 - 02:59 AM

I don't understand how you're going to determine the "next" product to publish.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 kirk7880

kirk7880
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 02 March 2006 - 03:46 AM

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.

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 02 March 2006 - 03:02 PM

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".
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users