如何在代码点火器中获取PayPal支付网关的购物车值


how to get cart values in codeigniter for paypal payment gateway

我坚持在编码点火器上集成PayPal支付网关 我正在使用当前的库https://github.com/romaldyminaya/ci_paypal

由于库仅包含项目的静态值,但我需要获取来自购物车的项目,如何将它们带到 $this->PayPal->add('T 恤',2.99,6);

我的控制器功能:

    public function do_purchase(){
    $config['business']             = 'babar.seller@gmail.com';
        $config['cpp_header_image']     = ''; //Image header url [750 pixels wide by 90 pixels high]
        $config['return']               = 'http://localhost/final-project/index.php/mysite/modify_payment';
        $config['cancel_return']        = 'http://final-project/mysite/canceled.php';
        $config['notify_url']           = 'process_payment.php'; //IPN Post
        $config['production']           = FALSE; //Its false by default and will use sandbox
        $config["invoice"]              = random_string('numeric',8); //The invoice id
        $this->load->library('paypal',$config);
        #$this->paypal->add(<name>,<price>,<quantity>[Default 1],<code>[Optional]);
        $this->paypal->add('T-shirt',2.99,6); //First item
        $this->paypal->add('Pants',40);       //Second item
        $this->paypal->add('Blowse',10,10,'B-199-26'); //Third item with code

        $this->paypal->pay(); //Proccess the payment
    }
    public function modify_payment(){

        $received_data = print_r($this->input->post(),TRUE);
        echo "<pre>".$received_data."<pre>";
                $this->load->view('mysite/modify_payment',$received_data);
        }
public function cart()
    {
        $cart = $this->cart->contents();
        //print_r($cart);
        //die;
      //$data['user_id']=$this->mainmodel->get_user_i($user_id);    
        $this->load->view('mysite/cart');
        $this->load->view('mysite/include/footer');

    }

购物车视图 :

    <?php $i = 1; ?>
<?php foreach ($this->cart->contents() as $items): ?>
    <?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
    <tr>
<td>         <input name="qty[<?php echo $items['rowid'];?>]" id="qty" type="text" value="<?php echo $items['qty']?>" class="input" />
</td>
      <td>
        <?php echo $items['name']; ?>
            <?php if ($this->cart->has_options($items['rowid']) == TRUE): ?>
                <p>
                    <?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?>
                        <strong><?php echo $option_name; ?>:</strong> <?php echo $option_value; ?><br />
                    <?php endforeach; ?>
                </p>
            <?php endif; ?>
function add($item_name = '',$item_amount = NULL,$item_qty = NULL,$item_number = NULL){
        $this->config['item_name_'.$this->item]     = $item_name;
        $this->config['amount_'.$this->item]        = $item_amount;
        $this->config['quantity_'.$this->item]      = $item_qty;
        $this->config['item_number_'.$this->item]   = $item_number;
        $this->item++;
    }   

我所做的是有一个PayPal库类来处理添加,只是简单地硬编码一些产品