close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

HELP! - How to reduce Stock by the quantity purchased

Thread began 5/20/2011 1:45 pm by hbibizadeh396670 | Last modified 6/03/2016 2:20 pm by hbibizadeh396670 | 7138 views | 18 replies

hbibizadeh396670

Thank you for helping me on this difficult issue.

I did as you said and got this:

SQL: Update Products SET Products.ProductStock = Products.ProductStock - WHERE Products.ProductID =

Products is the name of my recordset, and ProductStock is the name of the field in my database table that holds the amount of stock for each product.

My code is this:

<?php
//WA eCart Show If Start
if (!$eCart->IsEmpty()) {
?>
<h2>Order Receipt</h2><h3 class="eCart_OrderHeaderInfo">Order number: <?php echo ((isset($_SESSION["eCart_OrderID"]))?$_SESSION["eCart_OrderID"]:"") ?></h3><p class="eCart_OrderHeaderInfo">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" >
<h2>Your Shopping Cart</h2>
<div class="eC_MediumArea">
<table class="eC_ShoppingCart" border="0" cellspacing="0" cellpadding="0">

<tr>

<th class="eC_GroupColumn" >Name</th>


<th class="eC_PriceItem">Shipping</th>


<th class="eC_PriceItem">Price</th>


<th class="eC_FormItem">Quantity</th>


<th class="eC_PriceItem">Total</th>

</tr>
<?php
while (!$eCart->EOF()) {
?>
<tr>

<td class="eC_GroupColumn">
<img src="Siteezy_ProductImages/<?php echo $eCart->DisplayInfo("Thumbnail"); ?>" alt="Product thumbnail" class="eC_ProductThumb" />
<p class="eC_ItemName"><?php echo $eCart->DisplayInfo("Name"); ?></p>
<p class="eC_ItemDescription">Description:&nbsp;<?php echo $eCart->DisplayInfo("Description"); ?></p>

</td>


<td class="eC_PriceItem">
<?php echo WA_eCart_DisplayMoney($eCart, $eCart->DisplayInfo("Shipping")); ?>
</td>


<td class="eC_PriceItem">
<?php echo WA_eCart_DisplayMoney($eCart, $eCart->DisplayInfo("Price")); ?>
</td>


<td class="eC_FormItem">
<?php echo $eCart->DisplayInfo("Quantity"); ?>
</td>


<td class="eC_PriceItem">
<?php echo WA_eCart_DisplayMoney($eCart, $eCart->DisplayInfo("TotalPrice")); ?>
</td>
<?php
while (!$eCart->EOF()) {
mysql_select_db($database_siteezy_ecart2, $siteezyecproducts);
$query_itemQ = "Update Products SET Products.ProductStock = Products.ProductStock -
$DetailQuantity WHERE Products.ProductID = $idCall";
echo("SQL: ".$query_itemQ."<br>");
$itemQ = mysql_query($query_itemQ, $siteezyecproducts) or die(mysql_error());
$eCart->MoveNext();
}
$eCart->MoveFirst();
?>
</tr>
<?php
$eCart->MoveNext();
}
$eCart->MoveFirst();
?>


I don&#8217;t know if this has anything to do with it, but when I add my script, my order summery disappears, this makes me wonder if I have put the script in the wrong place.

As I said before, I am very appreciative of your help.

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