Jump to content


Photo

updating the db after payment has been processed


  • This topic is locked This topic is locked
3 replies to this topic

#1 jjsand28

jjsand28

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 15 April 2003 - 11:27 AM

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

#2 paypal_pb

paypal_pb

    Advanced Member

  • Members
  • 2,960 posts

Posted 15 April 2003 - 11:45 AM

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

#3 jjsand28

jjsand28

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 15 April 2003 - 02:04 PM

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

#4 paypal_pb

paypal_pb

    Advanced Member

  • Members
  • 2,960 posts

Posted 15 April 2003 - 02:49 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users