From 850222794c2a4e366c78f64bf353e0e24068a6f7 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 21 Jul 2016 17:29:17 +0200 Subject: [PATCH] adding validatecart with paypal method --- adm/cartvalidate.php | 26 ++++++++++++++++++++++---- adm/tabs/AdminCarts.php | 6 +++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/adm/cartvalidate.php b/adm/cartvalidate.php index db14989a..eb4627ca 100644 --- a/adm/cartvalidate.php +++ b/adm/cartvalidate.php @@ -1,21 +1,39 @@ isLoggedBack() && ($id_cart = (int) Tools::getValue('id_cart')) && ($payment = Tools::getValue('payment'))) { + $cart = new Cart($id_cart); + + if(Validate::isLoadedObject($cart)) { + $amount = $cart->getOrderTotal(); + + if($payment == 'paypal') { + $method = 'Paypal'; + include(_PS_ROOT_DIR_.'/modules/paypal/paypal.php'); + $paypal = new Paypal(); + $paypal->validateOrder($id_cart, (int) Configuration::get('PS_OS_PAYMENT'), $amount, $method); + } + } + + Tools::redirectAdmin('/adm/index.php?tab=AdminCarts&id_cart='.$id_cart.'&viewcart&token='.Tools::getAdminTokenLite('AdminCarts')); +} + +/*if($_SERVER['REMOTE_ADDR'] == '109.190.53.175') { exit; $cart = 54534; $amount = 38.40; $method = 'atos_cyberplus'; -/* include('../config/config.inc.php'); include(_PS_ROOT_DIR_.'/modules/paypal/paypal.php'); $paypal = new Paypal(); $paypal->validateOrder($cart, 2, $amount, $method); -*/ include('../config/config.inc.php'); include(_PS_ROOT_DIR_.'/modules/atos_cyberplus/atos_cyberplus.php'); $p = new atos_cyberplus(); $p->validateOrder($cart, 2, $amount, $method); -} +}*/ diff --git a/adm/tabs/AdminCarts.php b/adm/tabs/AdminCarts.php index f5ee4ca2..6a410944 100755 --- a/adm/tabs/AdminCarts.php +++ b/adm/tabs/AdminCarts.php @@ -127,8 +127,12 @@ class AdminCarts extends AdminTab '.$this->l('Order #').sprintf('%06d', $order->id).'

'.$this->l('Made on:').' '.Tools::displayDate($order->date_add, (int)$cookie->id_lang, true).'



'; - else + else { echo $this->l('No order created from this cart').''; + if($cookie->id_employee == 1) { + echo '

'.$this->l('Convert this cart into an order (paid with Paypal)').''; + } + } echo ''; echo ' ';