adding validatecart with paypal method

This commit is contained in:
Marion Muszynski 2016-07-21 17:29:17 +02:00
parent 2b9fd29308
commit 850222794c
2 changed files with 27 additions and 5 deletions

View File

@ -1,21 +1,39 @@
<?php
if($_SERVER['REMOTE_ADDR'] == '109.190.53.175') {
require_once(dirname(__FILE__).'/../config/config.inc.php');
require_once(dirname(__FILE__).'/init.php');
if($cookie->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);
}
}*/

View File

@ -127,8 +127,12 @@ class AdminCarts extends AdminTab
<a href="?tab=AdminOrders&id_order='.(int)($order->id).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'"> '.$this->l('Order #').sprintf('%06d', $order->id).'</a></span>
<br /><br />
'.$this->l('Made on:').' '.Tools::displayDate($order->date_add, (int)$cookie->id_lang, true).'<br /><br /><br /><br />';
else
else {
echo $this->l('No order created from this cart').'</span>';
if($cookie->id_employee == 1) {
echo '<br /><br /><a class="button" href="cartvalidate.php?id_cart='.$cart->id.'&amp;payment=paypal">'.$this->l('Convert this cart into an order (paid with Paypal)').'</a>';
}
}
echo '</fieldset>';
echo '
</div>';