close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

stock in order

Thread began 10/27/2009 2:11 pm by alhero_94375722 | Last modified 7/20/2010 5:05 pm by alhero_94375722 | 2019 views | 17 replies

CraigRBeta Tester

server validation

Hi all,

i just did this another way and was interested in the outcome of this thread.
I didn't use server validation, (this time), I assume I would need CSS form builder to do this ??

Anyway here's my approach, no server side validation required.

Having retrieved my stock value from the appropriate recordset, in the block of code beginning near // WA eCart AddToCart...

After the first line checking that the form has been submitted. add a new 'if' block, something like this, where Cartname is the name of your cart.
Also add a line, setting a variable to false just before this block, (existing code is shown in grey)...

$stockwarning = false;// resets the stock warning message to false

// WA eCart AddToCart
if (isset($_POST["Cartname_1_ATC"]) || isset($_POST["Cartname_1_ATC_x"])) {


if($row_rsStockLookup['StockQty'] < $_POST["rugsntack_1_Quantity_Add"]) { ) {//row from recordset value compared to qty entered into add to cart form
$stockwarning = true;
}
else
{//do the cart code

$ATC_itemID = $_POST["Cartname_1_ID_Add"];...



You also need to add an extra closing bracket at the end of this block, about 25 lines down.

When the 'add to cart' form is posted, if the stock level is below the item quantity value, the $nostock variable is set to true, and the add to cart code is not processed, hence the page is not redirected.

You can then show a message somewhere on your page, such as
<?php if ($stockwarning == true) {
echo 'Message to customer';
} ?>

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

Content

rating

Layout

rating

Ease of use

rating

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...