Replies Back to Article
Charon Cart Version 2 Tutorial
I found that storing the Order and the Cart to a Database with Dreamweaver MX requires a slight modify to both the rsOrders and rsOrderDetails Recordsets (pages 13/14 of the tutorial).
In order to work properly, you have to change the LockType from Read Only (this is the default LockType in DreamweaverMX) to Optimistic. To do so, just select your Recordsets in the Server Behaviors Panel one at a time, then go to the Properties bar and change the Lock Type as I said above.
Maybe on Ultradev the default Lock Type is Optimistic (remember that's NOT so on Dreamweaver MX), so Rolf didn't mentioned in his tutorial. If you don't change the Lock Type, you'll get this error:
"ADODB.Recordset (0x800A0CB3)
Current Recordset does not support updating. This may be a limitation of
the provider, or of the selected locktype."
(as you see you find the word "locktype" in the error, and it's quite easy to understand: not so if you are using a non-english version of IIS or PWS, as me)
Oh, Rolf! Please change the Image029.gif on page 14: the selected Recordset is rsOrders and not rsOrderDetails, and that maybe confusing for the new user.
Happy Carting! :-)
I think the tutorial is tooo long. it will be better if it will be a little shorter or in other means " to the point" But anyways its good. but boaring too beacuse of too much text i guess.
Thanks anyways for the good things.
This was a pretty good tutorial until you left me hanging out to dry without a way to pass my cart over to my SSL connection. I found a form variable or a querystring works fine for this. In order to implement such a scheme one must create a modified version of the inc_CharonCart.asp, so that the function CookieToCart reads the values in from the form variable or querystring after one establishes the SSL connection. I modified it like so and saved it as ssl_inc_CharonCart.asp:
<%
CONST CC_ProductID = 0
CONST CC_Quantity = 1
CONST CC_Name = 2
CONST CC_Price = 3
CONST CC_UniqueKey = 4
CCcart=CookieToCart("SoftwareCart")
CCcart_SubTotal=0
CCcart_numItems=0
CCcart_Shipping=0
CCcart_Discount=0
CCcart_SalesTax=0
isFound=false
for i="0" to ubound(CCcart,2)
if CCcart(CC_ProductID,i) <> "" then
isFound=true
CCcart_SubTotal=CCcart_SubTotal + (CCcart(CC_Quantity,i)*CCcart(CC_Price,i))
CCcart_numItems=CCcart_numItems + 1
end if
next
function CCcart_LineTotal
CCcart_LineTotal=CCcart(CC_Quantity,i)*CCcart(CC_Price,i)
end function
function CCcart_GrandTotal
CCcart_GrandTotal=CCcart_SubTotal + CCcart_Shipping + CCcart_SalesTax - CCcart_Discount
end function
function CookieToCart(cookiename)
mystring=Request("Cart")
dim myarray(5,50)
productarray=split(mystring,"|")
for j="0" to ubound(productarray)
itemarray=split(productarray(j),"^")
for i="0" to 5
if itemarray(i) <> "" then
myarray(i,j)=itemarray(i)
else
myarray(i,j)=null
end if
next
next
CookieToCart=myarray
end function
%>
Notice the variable "mystring" in function CookieToCart now gets the cookie using a generic request. The other difference is--unless you are allowing Cart Updates on your checkout page--is the the CartToCookie function and the code to initialize the cart array are no longer needed and can be removed for clarity as I have.
I found that after modifying the cart for ssl, I was unable to save the orderdetails because although I mangeed to pass the cart to the checkout page, when I posted the check out page back to itself the cart came back empty. So I made this following modifications to the Save Order Details table.
<%
'
'**Save cart to OrderDetails table in Database**
ORDRProductID = split(request.form("Product Code"), ",")
ORDRQuantity = split(request.form("Quantity"), ",")
ORDRProductName = split(request.form("Product Name"), ",")
ORDRUnitPrice = split(request.form("Price"), ",")
if Request("CC_OrderInsert") <> "" then
UniqueIdValue=Session("OrderID")
UniqueIdColumn="OrderID"
CC_RedirectURL=""
sub SaveToDatabase(ODRecordset)
ODRecordset.AddNew
ODRecordset.Fields(UniqueIdColumn)=UniqueIdValue
ODRecordset.Fields("ProductID")=ORDRProductID(i)
ODRecordset.Fields("Quantity")=ORDRQuantity(i)
ODRecordset.Fields("ProductName")=ORDRProductName(i)
ODRecordset.Fields("UnitPrice")=ORDRUnitPrice(i)
ODRecordset.Fields("TimeKey")=Timekey
rs_orderdetails.Update
end sub
For i="0" to ubound(ORDRProductID)
if ORDRProductID(i) <> "" then
Call SaveToDatabase(rs_orderdetails)
end if
next
end if
%>
I did enounter one other issue. The values we stepped though and split at the commas still have the spaces left after the commas. To preserve data integrity, you must do a find and replace to remove the commas. I wrote this function for that:
<%
' Escape spaces on insert product details
Function EscapeSpaces(ByVal spaceToReplace)
On Error Resume Next
Const Proc = "EscapeSpaces"
spaceToReplace = Replace(spaceToReplace, " ", "")
EscapeSpaces = spaceToReplace
End Function
%>
Modify your cart values to use the function like so.
ODRecordset.Fields("ProductID")=EscapeSpaces(ORDRProductID(i))
ODRecordset.Fields("Quantity")=EscapeSpaces(ORDRQuantity(i))
ODRecordset.Fields("ProductName")=EscapeSpaces(ORDRProductName(i))
ODRecordset.Fields("UnitPrice")=EscapeSpaces(ORDRUnitPrice(i))
And that should cover any issues you encounter. I included online fulfillment system as part of my store. Check it out at http://www.ebconcepts.com.
Using Charon cart makes things so much easier and this tutorial covers it all apart from one aspect I am trying to do. I would like it so that I have a page of products in a repeat region with check boxes next to each one. The customer can then check which products they want click on one Add to Cart button and all the items are added to the shopping cart as separate items. Has anyone managed to do this?
cheers,
Adam
when i go to checkout i get this error message
Error Type:
ADODB.Recordset (0x800A0CB3)
Object or provider is not capable of performing requested operation.
The error its talking about it to do with the operation (RsOrder.AddNew). Why am i getting this error message. the rest of the cart works apart from the most important bit of adding the details to my database.
can anyone please help me (tiger_33_99@yahoo.com). I'm using charon cart for a university project, but i'm having so many problems i'm tempted to give up! (email me if u can help please)
I have used the tutorial to gain an insight into how the charon cart works and have successfully built a working cart, with the exception of discounts.
When a customer has logged in their level of discount one the 'save to cart page' is displayed
Sub Total :10.00
Shipping : 2.00
Discount : 2.00
Grand Total:10.00
The correct Subtotal, Shipping, Discount and Grand Total are displayed, however when the cart is saved to the database the Grand Total Field contains the grand total exculding the discount and the discount field is blank.
So in this example the Grand Total saved would be 12.00 instead of 10.00 and Discount would be blank instead of 2.00.
I am not sure why the incorrect Grand Total is being entered in to the database, while the correct one is shown on the page when the Grand Total in the HiddenField is from the charon cart bindings panel and is the same binding as the one shown on the page. The Discount value held in a hidden field is also from the charoncart bindings panel and is the same value as the Discount displayed on the page.
Any help would be greatly appreciated as this is for a college project.
thanks
Adam,
I'm trying to do the same thing as you, and was wondering if you had managed to do this. I'm stumped!
Thanks
Deepa
Sorry I've not heard anything yet but once I've got some time free I'm gonna try programming it myself see if I can get it working once I have I'll let you know but I may be a while
cheers
adam
hi all..this tutorial was very useful for my project..but i'm currently stuck with this error message:
Provider Error 8002000A
Out Of Present Range
e-boutique/checkout.asp line 338
so, the error refers to this next few lines:
line 336 <%
line 337 End If
line 338 Next 'End cart repeat region
line 339 %>
anyone knows how to solve this? it's stopping me from storing the order to the database..all your help is appreciated..tx..pleaseeee..
Hi all, I am a beginner at this shopping cart business, but have picked up quite a lot in this tutorial. It has been very helpful, especially the comment posted about the incorrect image on pages 13/14...that one had me stuck for days untill i read it.
My problem lies in my registation page called NewUser.asp, that I've basically copied from the charoncart example files. but when i hit 'register' nothing happens.
view it at: http://www.relief.co.nz/NewUser.asp
can anyone help??
thanks in advance, Blondini
I got the Charon Cart to work thanks to this tutorial. :)
I have the shopping and cart contents working fine but I want to do something different upon checkout. I don't need to write the order to a DB - I just want to write the carts contents to a email (CDONTS) and send to someone for approval.
Can this be done easily? Anyone have any ideas that they can share with me?
- Anthony
--
you can use a simple dreamweaver extension: the e-mail_form.mxp. It is avaible for dawnload in the macromedia dreamweaver exchange.
bye
pallino
Can any one make this paragraph clearer for me?
"So create an order details recordset in exactly the same way as shown above then click on the Charon Cart > Save Cart To Database behaviour to get this dialogue."
What is "as above", does this refer to:
SELECT top 1 OrderID
FROM OrderDetails_tbl
My Problem is, My cart saves to the order table, but not the order details table ??
I know that there was a tutorial that was straight to the point - I developed a cart in fifteen minutes it
This "tutorial" (don't get me wrong I envy the fact that whover wrote it understands it), but this is too long for a "tutorial" - it should be classed as a reference or glossary not a tutorial.
A tutorial should be click here, open that, click there and then you have this.
Any problems post it in the forum.
It should be as it was - KISS.
Cheers
What else do I need to read to understand what I need to do?
Basically I need a step by step process as in:
1: Create database
2: Create this page add <these charon cart options> a link or form for the cart contents to be sent
3: Create that page add <these charon cart options> a link or form
4: Create this page add <these charon cart options> a link or form to send an email
5: and so on...
Cheers
Anthony, Could you perhaps help me figure this out?
Nobody actually seems to understand my questions.
Cheers