Post by simian24 » Fri Dec 05, 2014 12:17 am

Hi

I have opencart 1.5.6.4 website
with Sagepay v3 direct method payment

I need to be able to pass the basket variables to the sagepay system, does anyone know how this is done?

thanks

simian24

Newbie

Posts

Joined
Fri Dec 05, 2014 12:14 am

Post by simian24 » Wed Dec 10, 2014 12:07 am

bump?

Newbie

Posts

Joined
Fri Dec 05, 2014 12:14 am

Post by simian24 » Tue Dec 16, 2014 7:31 am

bump

Newbie

Posts

Joined
Fri Dec 05, 2014 12:14 am

Post by cau96176 » Sun May 03, 2015 4:07 am

I haven't looked at Direct as I use the Form Method. I pasted this in after the line

Code: Select all

		$data['Apply3DSecure'] = '0';
in Direct a similar like looks like this about Line 232

Code: Select all

	$payment_data['CustomerEMail'] = substr($order_info['email'], 0, 255);
		$payment_data['Apply3DSecure'] = '0';
		$payment_data['ClientIPAddress'] = $this->request->server['REMOTE_ADDR'];

Code: Select all

//added to include basket

		$count_total_products = 0;
        //get total rows to be sent in string
         foreach ($this->cart->getProducts() as $product) {
         
         $count_total_products++;
               
         }   
         $productstring = '';
         //sagepay requires colon delimiter. The last 3 fields are left empty with ':' If you want to use those fields then you will need to run another forloop to fetch the totals for combined product quantities. Below is just for name, quantity, and base price.
         foreach ($this->cart->getProducts() as $product) {
         //gather SKU for each product.  ugh.....
         // $sku = $this->model_checkout_order->getSku($product['product_id']);
         $productstring .= $product['name'].':'.$product['quantity'].':'. $this->currency->format($product['price'], $order_info['currency_code'], false, false).':'.'---'.':'.'---'.':'.'---'.':';
               
         }
         //this is the string you will send in the end.
         $main_string_to_send =   $count_total_products.':'.substr_replace($productstring ,"",-1);
         //send here
         $data['Basket'] = $main_string_to_send;

I don't know of it will work - of might at least give you a start on it

New member

Posts

Joined
Sat Feb 01, 2014 11:51 pm

Post by Webbo » Sun Jul 12, 2015 4:09 am

HI

I have just added the basket to the sagepay V3 form version

catalog/controller/payment/sagepay_v3.php
cau96176 wrote://added to include basket

$count_total_products = 0;
//get total rows to be sent in string
foreach ($this->cart->getProducts() as $product) {

$count_total_products++;

}
$productstring = '';
//sagepay requires colon delimiter. The last 3 fields are left empty with ':' If you want to use those fields then you will need to run another forloop to fetch the totals for combined product quantities. Below is just for name, quantity, and base price.
foreach ($this->cart->getProducts() as $product) {
//gather SKU for each product. ugh.....
// $sku = $this->model_checkout_order->getSku($product['product_id']);
$productstring .= $product['name'].':'.$product['quantity'].':'. $this->currency->format($product['price'], $order_info['currency_code'], false, false).':'.'---'.':'.'---'.':'.'---'.':';

}
//this is the string you will send in the end.
$main_string_to_send = $count_total_products.':'.substr_replace($productstring ,"",-1);
//send here
$data['Basket'] = $main_string_to_send;
but it doesn't show the tax info in the checkout basket, can anyone help me add the tax info to the shopping basket?

New member

Posts

Joined
Sun Oct 10, 2010 12:31 am

Post by Webbo » Wed Jul 22, 2015 11:34 pm

I am assuming it is

$item_total = number_format($this->tax->getTax($product['price'], $product['tax_class_id']) + $baseprice ,2);

but how does it fit into this:
//added to include basket

$count_total_products = 0;
//get total rows to be sent in string
foreach ($this->cart->getProducts() as $product) {

$count_total_products++;

}
$productstring = '';
//sagepay requires colon delimiter. The last 3 fields are left empty with ':' If you want to use those fields then you will need to run another forloop to fetch the totals for combined product quantities. Below is just for name, quantity, and base price.
foreach ($this->cart->getProducts() as $product) {
//gather SKU for each product. ugh.....
// $sku = $this->model_checkout_order->getSku($product['product_id']);
$productstring .= $product['name'].':'.$product['quantity'].':'. $this->currency->format($product['price'], $order_info['currency_code'], false, false).':'.'---'.':'.'---'.':'.'---'.':';

}
//this is the string you will send in the end.
$main_string_to_send = $count_total_products.':'.substr_replace($productstring ,"",-1);
//send here
$data['Basket'] = $main_string_to_send;


Any help would be appreciated, please

New member

Posts

Joined
Sun Oct 10, 2010 12:31 am

Post by cau96176 » Thu Jul 23, 2015 5:10 am

I would guess - and it really is a guess!

It will replace one of the '---' in $productstring

I would also try just $this->tax->getTax($product['price'], $product['tax_class_id'])

Also I would add the guy that came up with the original code I quoted is this guy
http://forum.opencart.com/memberlist.ph ... le&u=20892

New member

Posts

Joined
Sat Feb 01, 2014 11:51 pm
Who is online

Users browsing this forum: No registered users and 3 guests