Forums

This topic is locked

How UD shopping cart extension deal with the stock

Posted 25 Oct 2001 02:24:50
1
has voted
25 Oct 2001 02:24:50 huang Peter posted:
I'm the PowerClimb UD shopping cart extension user

Now I have a problem for your help :

In my database,the table of product have a column --stock. I want to the
stock subtract the number that customer buy.How can I do it?

this is my code in the page after save cart to table:
========================
<%
'
'Update Stock for each ProductID in the cart
'
set Command1 = Server.CreateObject("ADODB.Command"
Command1.ActiveConnection = MM_conneshop_STRING
isColNumeric=true
For UCCart1__i=0 To UCCart1.GetItemCount()-1
if (UCCart1.GetColumnValue("ProductID",UCCart1__i)) <> "" then
if isColNumeric then
Command1.CommandText = "UPDATE Products SET Stock = Stock - " &(UCCart1.GetColumnValue("Quantity",UCCart1__i))&
" WHERE ProductID = " & (UCCart1.GetColumnValue("ProductID",UCCart1__i))
else
Command1.CommandText = "UPDATE Products SET Stock = Stock - " &(UCCart1.GetColumnValue("Quantity",UCCart1__i))&
" WHERE ProductID = '" & (UCCart1.GetColumnValue("ProductID",UCCart1__i))& "'"
end if
Command1.Execute
end if
next
Command1.ActiveConnection.Close
%>
======================
these code can do nothing ~ <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
it confuse me much..

so,please help me ,tell me the right code to resolve the problem.

wait for your help!

=====================
peter.hj
www.fans8.com


Replies

Replied 23 May 2002 04:41:00
23 May 2002 04:41:00 Alfa Siete replied:
you better try charon cart, it works with substractions, find it at charon site
Replied 23 May 2002 05:30:27
23 May 2002 05:30:27 huang Peter replied:
Thanks,
I HAVE resolved it myself.

You can see it at
www.fans8.com/eshop.htm
www.fans8.com/newbook/book_eshop/index.htm

<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic