Welcome Guest, Not a member yet? Register   Sign In
CI Paypal Library Can Not Show Multi Item_name [SOLVED]
#1

[eluser]coma[/eluser]
Hi, I need help with CI paypal library, I have multi add to cart button and retrieve data from MySQL. My problem is i have added item name post variable for several products/items but in sandbox it only show an input field for description and unit price.I have follow the documentation for adding multiple item_name, amount and quantity, here's my sample code:

Code:
$this->paypal_lib->add_field('item_name_1','abc');
$this->paypal_lib->add_field('item_number_1','1');
$this->paypal_lib->add_field('amount_1', '50');
$this->paypal_lib->add_field('quantity_1', '5');
            
            
$this->paypal_lib->add_field('item_name_2','abcd');
$this->paypal_lib->add_field('item_number_2','2');
$this->paypal_lib->add_field('amount_2', '50');
$this->paypal_lib->add_field('quantity_2', '5');

Please give me a favor about my problem above.Thank you

Regards,
#2

[eluser]coma[/eluser]
open file : Paypal_lib.php

change code below :
Code:
$this->add_field('cmd','_xclick');

to

Code:
// you can call this function in your controller
$this->multi_items('true'); // true = multiple items, false = single item

create new function in paypal_lib.php

Code:
function multi_items($value)
    {
        if($value == "true")
        {
            $this->add_field('cmd','_cart');
            $this->add_field('upload','1');
            
        }else{
            $this->add_field('cmd','_xclick');
        }
    }

Loop buyer product list or use code below to test it
Code:
$this->paypal_lib->add_field('item_name_1','abc');
$this->paypal_lib->add_field('item_number_1','1');
$this->paypal_lib->add_field('amount_1','2');
$this->paypal_lib->add_field('quantity_1', '10');
                    
$this->paypal_lib->add_field('item_name_2','abc123');
$this->paypal_lib->add_field('item_number_2','2');
$this->paypal_lib->add_field('amount_2','5');
$this->paypal_lib->add_field('quantity_2', '15');

IT'S DONE !!

Thankx
#3

[eluser]LifeSteala[/eluser]
Thanks! This solution worked for me.
#4

[eluser]Unknown[/eluser]
I've done that and i get this error...


Sorry - your last action could not be completed

If you were making a purchase or sending money, we recommend that you check both your PayPal account and your email for a transaction confirmation after 30 minutes.

If you came to this page from another website, please return to that site (don't use your browser's Back button) and try again.

If you came from PayPal's website, click the PayPal logo in the upper-left-hand corner to return to the home page and try again. You might have to log in again.




Theme © iAndrew 2016 - Forum software by © MyBB