|
|
|
Rank: Starting Member
Groups: Registered
Joined: 4/15/2003 Posts: 4 Location: ,
|
Hello everyone. I did a quick search but couldn't find what I was looking for. I'm having a slight problem with integating CF and PayPal. I've got my form all set and it works in fine for PayPal.
However when I come back to my "paymentcomplete" page to remove th eitems from the DB it only removes the first one. I hope someone can help me with this.
Here is the form:
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="<cfoutput>#paypal#</cfoutput>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="custom" value="<cfoutput>#products.ProductID#</cfoutput>">
<input type="hidden" name="item_name" value="<cfoutput>#products.ItemName#</cfoutput>">
<input type="hidden" name="amount" value="<cfoutput>#products.ItemPrice#</cfoutput>">
<input type="hidden" name="shipping" value="#products.Shipping#">
<input type="hidden" name="shipping_extra" value="<cfoutput>#products.Shipping#</cfoutput>">
<input type="hidden" name="no_note" value="<cfoutput>#ppnote#</cfoutput>">
<input type="hidden" name="cn" value="<cfoutput>#ppnotelbl#</cfoutput>">
<input type="hidden" name="return" value="http://www.cottageporchcrafts.com/payprocessing/paymentsuccess.cfm">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cancel_return" value="http://www.cottageporchcrafts.com/payprocessing/paymentcancel.cfm">
<input type="hidden" name="add" value="1">
<input name="paypalbuy" type="image" src="../images/buypaypal.gif">
</form>
This is what happens when it comes back:
<!--- The products from the database --->
<cfquery name="getproduct" datasource="#dsn#">
select ProductID,Available from products
where ProductID = #custom#
</cfquery>
<!--- update the product table and remove the items selected --->
<cflock timeout="20">
<cftransaction>
<cfset NewAvail = getproduct.Available - 1>
<cfset product = getproduct.ProductID>
<cfquery name="updateproduct" datasource="#dsn#">
update products
set Available = #NewAvail#
where ProductID = #Product#
</cfquery>
the res thas been removed becasue it just adds info to a popularity table but the is a </cflock> and </cftransaction> at the end.
I have a feeling it has something to do with arrays or lists but I'm not familiar with those as I am learning CF.
"Great spirits have always encountered violent opposition form mediocre minds." - Albert Eistein
|
|
|
|
|
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/16/2002 Posts: 2,960 Location: ,
|
Handling items in a Shopping Cart is a bit different. You will receive num_cart_items and the item_name and quantity will be iterated: item_name1, item_name2, quantity1, quantity2, etc. Patrick Breitenbach PayPal, Inc. Dev Net: https://www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 4/15/2003 Posts: 4 Location: ,
|
so for my purposes I would use
name="item_name_x" value=#ItemName##session.ppvar#?
then I'd still have to use an array split it right?
thank you
"Great spirits have always encountered violent opposition form mediocre minds." - Albert Eistein
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/16/2002 Posts: 2,960 Location: ,
|
It's a bit confusing. In the top <form>, use item_name_1, item_name_2, etc. In the IPN, they will be item_name1, item_name2, etc. up to num_cart_items. Patrick Breitenbach PayPal, Inc. Dev Net: https://www.paypal.com/pdn
|
|
|
|
Guest
|
YAFVision Theme by Jaben Cargman (Tiny Gecko)Powered by YAF |
YAF © 2003-2009, Yet Another Forum.NETThis page was generated in 0.126 seconds.