close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Auto Deduct Inventory

Thread began 8/12/2010 9:59 am by jbarron397794 | Last modified 4/05/2011 2:51 pm by Jason Byrnes | 1993 views | 3 replies |

jbarron397794Beta Tester

Auto Deduct Inventory

Hi, I now have all of my products auto deducting from the database except for when there are different colors and sizes for the shopper to choose from. This is all being done from the "Checkout_Success" page.

I am pasting the code that is allowing me to do this and I am hoping someone can help me with my size/color issue.

//WA eCart Show If Start
if (!$ecart1->IsEmpty()) {
<h2>Order Receipt</h2>
<h3 class="eCart_OrderHeaderInfo">Order number: <?php echo ((isset($_SESSION["ecart1_OrderID"]))?$_SESSION["ecart1_OrderID"]:"") ?></h3>
<p class="eCart_OrderHeaderInfo">Thank you for your order. Please allow 5 - 7 business days for delivery.</p>
<table class="eC_ShoppingCart" border="0" cellspacing="0" cellpadding="0">
<th class="eC_PriceItem" >Price</th>
<th class="eC_FormItem" >Quantity</th>
<th class="eC_PriceItem" >Total</th>
while (!$ecart1->EOF()) {
<td><?php echo $ecart1->DisplayInfo("Name"); ?></td>
<td><?php echo $ecart1->DisplayInfo("Description"); ?></td>
<td><?php echo $ecart1->DisplayInfo("ID"); $idCall = $ecart1->DisplayInfo("ID");?>
<td><?php echo $ecart1->DisplayInfo("Size"); ?></td>
<td><?php echo $ecart1->DisplayInfo("Color"); ?></td>
<td class="eC_PriceItem" ><?php echo WA_eCart_DisplayMoney($ecart1, $ecart1->DisplayInfo("Price")); ?></td>
<td class="eC_FormItem" ><?php echo $ecart1->DisplayInfo("Quantity"); $solditems = $ecart1->DisplayInfo("Quantity") ?></td>
<td class="eC_PriceItem" ><?php echo WA_eCart_DisplayMoney($ecart1, $ecart1->DisplayInfo("TotalPrice")); ?></td>
<td class="eC_FormItem" ><?php echo $ecart1->DisplayInfo("Personal"); ?></td>
mysql_select_db($database_rsmyconnect, $rsmyconnect);
$query_itemQ = "Update inventory SET inventory.itemQty = inventory.itemQty -
$solditems WHERE inventory.itemId = $idCall";
$itemQ = mysql_query($query_itemQ, $rsmyconnect) or die(mysql_error());


Sign in to reply to this post

Eric Mittman

The key to making it work with the size and color options is to first ensure that you are tracking the inventory for these items in regards to the options offered. With an update similar to the one that you are using now you can check if the item has these options and if so use an update specific to these types of items, otherwise use the update code you are already working with.

This is a custom implementation that we won't be able to offer any detailed support for.

Sign in to reply to this post

JenniferBeta Tester

Hi, Going back to this. The method I posted below works great, my only problem is that within my database I have each item in inventory listed separately with a separate ID. In other words if I have a shirt that has 3 different sizes, I have 3 different lines with 3 different ID #s within my database:

itemId: 102 itemName: White Polo itemSize: M
itemId: 103 itemName: White Polo itemSize: L
itemId: 104 itemName: White Polo itemSize: XL

Within e-Cart how would I call out the correct item ID#?

I am currently building two recordsets within Dreamweaver as follows:


FROM inventory
WHERE itemId = 102


FROM inventory
WHERE itemName = queryparam1 AND itemSize = queryparam2

type: text
default value: ""
runtime value: $_POST['itemName_1']

default value: ""
runtime value: $_POST['sumidrive1_1_Size_Add']

These recordsets seem to work when there is a different price dependent upon what size the user selects. I bind the price to the rsShirtWhite (the second recordset) and it populates the shopping cart with the correct price. However, how do I get the correct ID to populate in the shopping cart? If I bind the ID column to the second recordset's ID column, should that not populate the correct ID according to size? Why would this method work for the price and not the size?

Any input you could give me would be greatly appreciated!


Sign in to reply to this post

Jason ByrnesWebAssist

it's impossible to tell what may be wrong wit the recordsets based on the information provided.

what are the values being used in the query when it does not work? one way to find this is to write the query to the page. look for the line that executes the query:

$rsWhiteShirt = mysql_query($query_rsWhiteShirt, $rsmyconnect) or die(mysql_error());

then add the following after it:
echo("SQL: ".$query_rsWhiteShirt);

you may see some other errors appear on the page, but we just want to know what the query being executed is, so you can ignore them.

the compare that against what values are in the database.

look for all the records with the name being used in the query, then double check whats is in the itemsize column.

Sign in to reply to this post

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