Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It sounds like you have the adding of users handled, so let me touch on submitting the shopping cart. I did something similar, but created a PHP function to handle the addition of each item, which essentially echoed each product (desc, price, etc) inside a form, then simply submitted this form at the proper time to PayPal. </p> <pre><code>function FormatPaypal($iItemno, $sItemname, $iQty, $fPrice, $fDiscountAmount, $sCode) { global $iUser; $s1 = sprintf('&lt;input type="hidden" name="item_name_%d" value="%s"&gt;', $iItemno, $sItemname); $s2 = sprintf('&lt;input type="hidden" name="amount_%d" value="%.2f"&gt; ', $iItemno, $fPrice); $s3 = sprintf('&lt;input type="hidden" name="quantity_%d" value="%d"&gt; ', $iItemno, $iQty); $s4 = sprintf('&lt;input type="hidden" name="discount_amount_%d" value="%.2f"&gt;', $iItemno, $fDiscountAmount); $sCode = sprintf("%s-%d", $sCode, $iUser ); $s5 = sprintf('&lt;input type="hidden" name="item_number_%d" value="%s"&gt;', $iItemno, $sCode); $sReturn = $s1.$s2.$s3.($fDiscountAmount ? $s4 : '').$s5; echo $s5; return $sReturn; } </code></pre> <p>which was placed inside a standard PayPal form:</p> <pre><code>&lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="frmPaypal"&gt; &lt;input type="hidden" name="cmd" value="_cart"&gt; </code></pre> <p>Using this method I only have to increment the $iItemNo with each use. I am currently building a PHP class to simplify this even further by managing the items and total item count, if interested I'll try to remember to come back and share it here. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload