/** * @see FrontController::initContent() */ public function initContent() { parent::initContent(); $id_cart = Tools::GetValue('id_cart'); $cart = new Cart((int) $id_cart); $liqpay = new Liqpay(); $total = $cart->getOrderTotal(true, 3); $liqpay->validateOrder(intval($cart->id), Configuration::get('PS_OS_PREPARATION'), $total, $liqpay->displayName); $currency = new Currency((int) $cart->id_currency); $private_key = Configuration::get('LIQPAY_PRIVATE_KEY'); $public_key = Configuration::get('LIQPAY_PUBLIC_KEY'); $amount = number_format($cart->getOrderTotal(true, Cart::BOTH), 1, '.', ''); $currency = $currency->iso_code == 'RUR' ? 'RUB' : $currency->iso_code; $order_id = '000' . $id_cart; $description = 'Order #' . $order_id; $result_url = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'index.php?controller=history'; $server_url = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . $liqpay->getPath() . 'validation.php'; $type = 'buy'; $version = '3'; $language = Configuration::get('PS_LOCALE_LANGUAGE') == 'en' ? 'en' : 'ru'; $data = base64_encode(json_encode(array('version' => $version, 'public_key' => $public_key, 'amount' => $amount, 'currency' => $currency, 'description' => $description, 'order_id' => $order_id, 'type' => $type, 'language' => $language))); $signature = base64_encode(sha1($private_key . $data . $private_key, 1)); $this->context->smarty->assign(compact('data', 'signature')); $this->setTemplate('redirect.tpl'); }
/** * @see FrontController::initContent() */ public function initContent() { parent::initContent(); $id_cart = Tools::GetValue('id_cart'); // получаем get id_cart $cart = new Cart((int) $id_cart); // Объект корзины $onpay = new onpay(); //Объект onpay $total = $cart->getOrderTotal(true, 3); //Цена заказа расчёт $onpay->validateOrder(intval($cart->id), _PS_OS_PREPARATION_, $total, $onpay->displayName); //Создание заказа с статусом ожидаем оплату $currency = new Currency((int) $cart->id_currency); //получение данные о валюте $this->context->smarty->assign(array('login' => Configuration::get('ONPAY_LOGIN'), 'f' => Configuration::get('ONPAY_FORM'), 'id' => (int) $id_cart, 'price' => number_format($cart->getOrderTotal(true, Cart::BOTH), 1, '.', ''), 'currency' => $currency->iso_code == 'RUB' ? 'RUR' : $currency->iso_code, 'md5' => md5('fix;' . number_format($cart->getOrderTotal(true, Cart::BOTH), 1, '.', '') . ';' . ($currency->iso_code == 'RUB' ? 'RUR' : $currency->iso_code) . ';' . (int) $id_cart . ';yes;' . Configuration::get('ONPAY_API_IN_KEY')), 'url_success' => 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'index.php?controller=history', 'this_path' => $this->_path)); $this->setTemplate('redirect.tpl'); // Подключение шаблона смарти }
/** * method call when ajax request is made with the details row action * @see AdminController::postProcess() */ public function ajaxProcess() { /* PrestaShop demo mode */ if (_PS_MODE_DEMO_) { die(Tools::displayError('This functionality has been disabled.')); } if ($table = Tools::GetValue('table')) { $request_sql = new RequestSql(); $attributes = $request_sql->getAttributesByTable($table); foreach ($attributes as $key => $attribute) { unset($attributes[$key]['Null']); unset($attributes[$key]['Key']); unset($attributes[$key]['Default']); unset($attributes[$key]['Extra']); } die(Tools::jsonEncode($attributes)); } }
<?php /** * @category Front Office Features * @author Maxim Bespechalnih <*****@*****.**> * @copyright Maxim Bespechalnih 2014 */ require_once dirname(__FILE__) . '/../../config/config.inc.php'; require_once dirname(__FILE__) . '/../../init.php'; require_once dirname(__FILE__) . '/yamodule.php'; $yamodule = new yamodule(); $return = array(); if (Tools::GetValue('action')) { $action = Tools::GetValue('action'); $token = Tools::encrypt('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) Tools::getValue('idm')); if (strcasecmp($token, Tools::getValue('tkn')) == 0) { switch ($action) { case 'load_price': $return = $yamodule->processLoadPrice(); break; case 'change_order': $return = $yamodule->processChangeCarrier(); break; } } else { $return['errors'] = $yamodule->l('Invalid Security Token !'); } die(Tools::jsonEncode($return)); }
<?php include dirname(__FILE__) . '/../../config/config.inc.php'; include dirname(__FILE__) . '/../../init.php'; include dirname(__FILE__) . '/yamarket.php'; $yamarket = new yamarket(); $yamarket->generate(Tools::GetValue('cron'));
/** * method call when ajax request is made with the details row action * @see AdminController::postProcess() */ public function ajaxProcess() { if ($table = Tools::GetValue('table')) { $request_sql = new RequestSql(); $attributes = $request_sql->getAttributesByTable($table); foreach ($attributes as $key => $attribute) { unset($attributes[$key]['Null']); unset($attributes[$key]['Key']); unset($attributes[$key]['Default']); unset($attributes[$key]['Extra']); } die(Tools::jsonEncode($attributes)); } }
//ajoute un zero si on a seulement deux chiffres } if (strlen($Version) == 3) { $Version .= "0"; //ajoute un zero si on a seulement trois chiffres } if (strlen($Version) == 4) { $Version .= "0"; //ajoute un zero si on a seulement trois chiffres } $password = trim(Tools::GetValue('password')); //ajout V 4.1 $password = trim($password, '\\"'); $password = trim($password, '"'); //echo(" Unquoted: ".$password); $email = trim(Tools::GetValue('email')); if (empty($email)) { echo "0,,email is empty"; } elseif (!Validate::isEmail($email)) { echo "0,email not valid"; } if (empty($password)) { echo "0,,password is empty"; } elseif (!Validate::isPasswd($password)) { echo "0,,password is incorrect"; } if ($Version >= 15000) { $context = Context::getContext(); //ppp($context); // Find employee $context->employee = new Employee();