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

Updating stock from checkout success page

Thread began 3/08/2012 10:28 am by dallySP | Last modified 12/09/2013 1:52 pm by dallySP | 1813 views | 13 replies

Jason ByrnesWebAssist

this will take some custom coding to accomplish. in the code examples i give, I am going to use the cart name eCart1, you will need to modify the cart code to match your cart object name.

it will require a recordset, an update behavior and an eCart loop around them.

first, you need to create a recordset to look up the current quntity, assuming the name of the table is "products", the ID columnn is name "productID", and the name of the stock column is "productStock", the recordset query would look like:

SELECT productStock FROM products WHERE productID = paramCartID

in the variables section create a new variable as:
name: paramCartID
type: integer
default value: -1
runTime value: $eCart1->DisplayInfo("ID")


then you need code to set a variable to hold the stock from the recordset minus the quantity in the cart, we'll use a get variable:

<?php $_GET['productStock'] = ($row_recordSetname['productStock'] - $eCart1->DisplayInfo("Quantity")); ?>

on the bindings panel, click the plus button and select URL Variable, set the name to productStock

Now you will need to add an update record behavior.

for the key column, select the productID column, for the valuer, click the lightning bolt and select the ID column from the cart object.

do not set a redirect.

on the second step of the update record wizard, select the productStock column, click the lightning bolt and select the productStock URL Variable.

you then need to add the cart loop around those pieces so the final code has this structure:

php:
<?php
while (!$eCart1->EOF())      {
?>
<product stock lookup recordset>
<set the productStock URL variable
<update record behavior>
<?php
  $eCart1
->MoveNext();
}
$eCart1->MoveFirst();
?>

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