close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Combining an onchange event, for product lookup, with inventory control?

Thread began 5/29/2014 11:49 am by Nathon Jones Web Design | Last modified 6/06/2014 12:30 pm by Nathon Jones Web Design | 2675 views | 33 replies

Nathon Jones Web Design

Combining an onchange event, for product lookup, with inventory control?

We have an onchange event on our product detail (add to cart) page which is linked to a separate ajax file, pricelookup.php. The onchange event allows users to make selections from drop-down menus for each product (colour, etc) and then updates the product code and price on the page accordingly.

Initially I wanted to hide product variables from the drop-down menus, should that product be marked as hidden from the website in my clients admin however, with help from Ray and yourself Jason, we changed this to display a warning message and to hide the Add to Cart button when the corresponding unavailable selection was made by the customer. Great!

However, products that were marked as hidden were still being able to be selected so I added "AND LEDdelete = 2" (2 = No) to the SELECT statement on the pricelookup.php page and, would you believe it, it worked! (a first for me on this project)

So, now, I'm faced with trying to do the same thing but have it respond to the inventory listed for each product which is where I'm stuck.

Following the inventory control tutorials I've got the following code sorted out, and it's working correctly in my clients admin area.

LEDstock - (SELECT Coalesce(SUM(LEDDetailQuantity),0) FROM LEDorder INNER JOIN LEDdetail ON LEDdetail.LEDDetailOrderID = LEDorder.LEDOrderID WHERE LEDOrderDate > LEDProductUpdateDate AND LEDDetailLEDid = LEDid) AS RemainingInventory

My question...

Can I add the above code to the recordset on the pricelookup.php ajax file and, from there, how do I change the onchange event so that it also detects when stock level (RemainingInventory) is listed as 0?

If that's not the correct approach I'd appreciate guidance on how best to acheive this.
Thank you

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...