HELP! - How to reduce Stock by the quantity purchased
I have a numeric value in my products table which represents product stock.
When a user makes a purchase, can you tell me how to reduce this value by the quantity purchased.
Thank you in advance
I have a numeric value in my products table which represents product stock.
When a user makes a purchase, can you tell me how to reduce this value by the quantity purchased.
Thank you in advance
To explain further, I just need simple stock management.
This is not supported by eCart, it takes hand coding to accomplish.
you would need to hand code a loop through the cart contents, and update the quantity based on the cart ID inside the loop:
<?php
while (!$yourCart->EOF()) {
<update script here>
$yourCart->MoveNext();
}
$yourCart->MoveFirst();
?>
Could you please correct my script as it’s is giving me an error message.
Also, could you tell me what page to put it on, and in what part of the code? For example, should it be on the pp_checkout_success.php and in between the head or body tags.
<?php
while (!$eCart->EOF()) {
<($ProductStock = ($ProductStock - $DetailQuantity))>
$eCart->MoveNext();
}
$eCart->MoveFirst();
?>
I don't know what I am doing wrong I just can not make it work?
Could you tell me how to make this code work
<?php
while (!$eCart->EOF()) {
<($ProductStock = ($ProductStock - $DetailQuantity))>
$eCart->MoveNext();
}
$eCart->MoveFirst();
?>
Do you offer any documentation on setting up inventory?
It is vital that I have some sort of inventory control because I cannot afford to sell products I don’t have.
I have not got enough knowledge of PHP to develop this code, so I would appreciate some help.
like I stated initially, this is not supported in eCart, we cannot offer support for this including correcting your code.
if you need assistance, you should either sign up for a premiere ticket where we can work with you on a one to one basis, or submit a request on the job forum to see if one of the community experts can help you with this.
I think that I am very close. I know you said that you would not help me write the code. Could you just point me in the right direction? I have tried & tested this code. And I am not sure why it does not deduct the stock value.
Is there something obvious in this that I have done wrong.
Again this is very important to me and I hope you can help me.
<?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";
$itemQ = mysql_query($query_itemQ, $siteezyecproducts) or die(mysql_error());
$eCart->MoveNext();
}
$eCart->MoveFirst();
?>
i dont see anything obvious wrong with the code, I would start by editing this line:
$query_itemQ = "Update Products SET Products.ProductStock = Products.ProductStock -
$DetailQuantity WHERE Products.ProductID = $idCall";
to:
$query_itemQ = "Update Products SET Products.ProductStock = Products.ProductStock -
$DetailQuantity WHERE Products.ProductID = $idCall";
echo("SQL: ".$query_itemQ."<br>");
this will write the query being executed to help troubelshoot, but really you are asking me here to support something that I have already told you is not supported.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
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.