Forums / Developer / basket dont send quantity to paypal [solved]

basket dont send quantity to paypal [solved]

Author Message

ludo thomas

Thursday 25 August 2005 8:04:12 am

I all,
I've installed paypal payment gateway on a webshop(ez v3.5.2).

All is working fine, but when customer access to paypal page, quantity of items is equal to 1...
even if I have 15 items.

the total count is right, but I need a list of all the items.
for the moment I only have one item (whose name is like item1,item2,itemxx.)

Do someone has resolved this problem?

i found this:
https://www.paypal.com/fr/cgi-bin/webscr?cmd=_pdn_howto_checkout_outside#methodtwo

but where can i put these lines?
I dont find the template or php_file that send the form to paypal.

thx in advance.

ludo thomas

Tuesday 30 August 2005 1:09:09 am

I've solved this problem:
by default paypal extension is configured to send the basket content as a unik object:
name:'object1,object2,object3...'
price=basket total price.
that is transmit into the url

you can send to paypal the differents object:
you have to edit and modify extension/ezpaypal/classes/ezpaypalgateway.
here is the code I've modified:


        $accountInfo    = $order->attribute( 'account_information' );
        $first_name     = urlencode( $accountInfo['first_name'] );
        $last_name      = urlencode( $accountInfo['last_name'] );
        $street         = urlencode( $accountInfo['street2'] );
        $zip            = urlencode( $accountInfo['zip'] );
        $state          = urlencode( $accountInfo['state'] );
        $place          = urlencode( $accountInfo['place'] );
        $image_url      = "http://$localHost" . urlencode( $paypalINI->variable( 'PaypalSettings', 'LogoURI' ) );
        $background     = urlencode( $paypalINI->variable( 'PaypalSettings', 'BackgroundColor' ) );
        $pageStyle      = urlencode( $paypalINI->variable( 'PaypalSettings', 'PageStyle' ) );
        $noNote         = urlencode( $paypalINI->variable( 'PaypalSettings', 'NoNote' ) );
        $noteLabel      = ($noNote == 1) ? '' : urlencode( $paypalINI->variable( 'PaypalSettings', 'NoteLabel' ) );
        $noShipping     = 1;
//////////////////////////modif for basket multiref/////////////////////////////////////////////////////
 
        $productItems   = $order->productItems();
		$listeArticles='';
		$x=1;
        foreach( $productItems as $item )
        {	
			 
			 $noeudID = $item['node_id'];
			 $node =& eZContentObjectTreeNode::fetch( $noeudID);
			 
			 
			$datamap =& $node->attribute('data_map');
			$ref=$datamap['product_number']->content();
			
            $listeArticles .= '&item_name_'.$x.'='.$item['object_name'].'&amount_'.$x.'='.$item['price_inc_vat'].'&quantity_'.$x.'='.$item['item_count'].'&item_number_'.$x.'='.$ref ;
			$x+=1;
        }


///////////////////////////////////////////////////////////////////////////////


        $url =  $paypalServer  . $requestURI    .
                "?cmd=_cart"               		.
                "&redirect_cmd=_cart"         	.
				"&upload=1"         			.
                "&business=$business"           .
				"$listeArticles"				.
                //"&item_name=$itemName"          .
                "&custom=$orderID"              .
                //"&amount=$amount"               .
                "&currency_code=$currency"      .
                "&first_name=$first_name"       .
                "&last_name=$last_name"         .
                "&address1=$street"             .
                "&zip=$zip"                     .
                "&state=$state"                 .
                "&city=$place"                  .
                "&image_url=$image_url"         .
                "&cs=$background"               .
                "&page_style=$pageStyle"        .
                "&no_shipping=$noShipping"      .
                "&cn=$noteLabel"                .
                "&no_note=$noNote"              .
                "&lc=$countryCode"              .
                "&notify_url=http://$localHost" . $indexDir . "/paypal/notify_url/".
                "&return=http://$localHost"     . $indexDir . "/shop/checkout/" .
                "&cancel_return=http://$localHost" . $indexDir. "/shop/basket/";