Current location: Hot Scripts Forums » Programming Languages » PHP » PayPal itemisation (array / count)

PayPal itemisation (array / count)

Reply
  #1 (permalink)  
Old
New Member
 
Join Date: Oct 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
PayPal itemisation (array / count)

Hi there,

I'm after a bit of help with a script I'm altering. Basically it's a script that submits an item order to PayPal. At the moment, it creates an array of the items ordered.

For example : 1 x item @ 23.00 and 2 x item @ 34.00

I'm trying to alter the code so that it itemises the bill to PayPal, for example :

1 x item @ 23.00
2 x item @ 34.00
5 x item @ 14.53

the script that makes an array of the items, and then submits the form to PayPal.

Reading the PayPal API's I know that I can submit for example

item_name_x (x being 1/2/3/4).

How can I make the array count the items and submit them individually, for example :

item_name_1 .... item_name_2...

Any help much appreciated!

PHP Code:

<?php

global $General$Cart;
//$orderNumber; // order number
$paymentOpts $General->get_payment_optins($_REQUEST['paymentmethod']);
$merchantid $paymentOpts['merchantid'];
$returnUrl $paymentOpts['returnUrl'];
$cancel_return $paymentOpts['cancel_return'];
$notify_url $paymentOpts['notify_url'];
$currency_code $General->get_currency_code();
$cartInfo $Cart->getcartInfo();
$itemArr = array();
for(
$i=0;$i<count($cartInfo);$i++)
{
    
$product_att preg_replace('/([(])([+-])([0-9]*)([)])/','',$cartInfo[$i]['product_att']);
    
$itemstr '';
    
$itemstr .= $cartInfo[$i]['product_qty'].' X '.$cartInfo[$i]['product_name'];
    if(
$product_att)
    {
        
$itemstr .="($product_att)";
    }
    
$itemArr[] = $itemstr;
    
}
$item_name implode(', ',$itemArr);
$amount $Cart->getCartAmt();
$payable_amt $General->get_payable_amount($_REQUEST['shippingmethod']);
?>
<form name="frm_payment_method" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<?php /*?><form name="frm_payment_method" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"><?php */?>
<input type="hidden" value="<?php echo $payable_amt;?>" name="amount"/>
<input type="hidden" value="<?php echo $returnUrl;?>&oid=<?php echo $orderNumber;?>" name="return"/>
<input type="hidden" value="<?php echo $cancel_return;?>&oid=<?php echo $orderNumber;?>" name="cancel_return"/>
<input type="hidden" value="<?php echo $notify_url;?>" name="notify_url"/>
<input type="hidden" value="_xclick" name="cmd"/>
<input type="hidden" value="<?php echo $item_name;?>" name="item_name"/>
<input type="hidden" value="<?php echo $merchantid;?>" name="business"/>
<input type="hidden" value="<?php echo $currency_code;?>" name="currency_code"/>
<input type="hidden" value="<?php echo $orderNumber;?>" name="custom" />
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
</form>

<div class="wrapper" >
        <div class="clearfix container_message">
                <center><h1 class="head2"><?php _e('Processing for Paypal, Please wait ....');?></h1></center>
         </div>
</div>
<script>
setTimeout("document.frm_payment_method.submit()",100); 
</script>
Reply With Quote

Featured Marketplace Scripts (view more)

Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help reading multi-dimensional array l3rady JavaScript 3 06-11-10 04:10 AM
Mysql Incorrect Count MrDarko Database 6 08-07-07 12:22 PM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' Dr. Forensics PHP 3 07-15-06 03:54 PM


All times are GMT -5. The time now is 10:28 PM.
vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.