本文整理汇总了PHP中Tools::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::getValue方法的具体用法?PHP Tools::getValue怎么用?PHP Tools::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
global $currentIndex;
if (isset($_POST['submitDatabase' . $this->table])) {
if ($this->tabAccess['edit'] === '1') {
foreach ($this->_fieldsDatabase as $field => $values) {
if (isset($values['required']) and $values['required']) {
if (($value = Tools::getValue($field)) == false and (string) $value != '0') {
$this->_errors[] = Tools::displayError('field') . ' <b>' . $values['title'] . '</b> ' . Tools::displayError('is required');
}
}
}
if (!sizeof($this->_errors)) {
/* Datas are not saved in database but in config/settings.inc.php */
$settings = array();
foreach ($_POST as $k => $value) {
if ($value) {
$settings['_' . Tools::strtoupper($k) . '_'] = $value;
}
}
rewriteSettingsFile(NULL, NULL, $settings);
Tools::redirectAdmin($currentIndex . '&conf=6' . '&token=' . $this->token);
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
}
}
}
示例2: _prepareHook
protected function _prepareHook($params)
{
$languages = Language::getLanguages(true, $this->context->shop->id);
if (!count($languages)) {
return false;
}
$link = new Link();
if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
$default_rewrite = array();
if (Dispatcher::getInstance()->getController() == 'product' && ($id_product = (int) Tools::getValue('id_product'))) {
$rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
foreach ($rewrite_infos as $infos) {
$default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
}
}
if (Dispatcher::getInstance()->getController() == 'category' && ($id_category = (int) Tools::getValue('id_category'))) {
$rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
foreach ($rewrite_infos as $infos) {
$default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
}
}
if (Dispatcher::getInstance()->getController() == 'cms' && (($id_cms = (int) Tools::getValue('id_cms')) || ($id_cms_category = (int) Tools::getValue('id_cms_category')))) {
$rewrite_infos = isset($id_cms) && !isset($id_cms_category) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
foreach ($rewrite_infos as $infos) {
$arr_link = isset($id_cms) && !isset($id_cms_category) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], null, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
$default_rewrite[$infos['id_lang']] = $arr_link;
}
}
$this->smarty->assign('lang_rewrite_urls', $default_rewrite);
}
return true;
}
示例3: postProcess
public function postProcess()
{
global $cookie, $currentIndex;
$this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
$this->adminAttributes->postProcess($this->token);
Module::hookExec('postProcessAttributeGroup', array('errors' => &$this->_errors));
// send _errors as reference to allow postProcessAttributeGroup to stop saving process
if (Tools::getValue('submitDel' . $this->table)) {
if ($this->tabAccess['delete'] === '1') {
if (isset($_POST[$this->table . 'Box'])) {
$object = new $this->className();
if ($object->deleteSelection($_POST[$this->table . 'Box'])) {
Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token);
}
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
} else {
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} else {
parent::postProcess();
}
}
示例4: canonicalRedirection
protected function canonicalRedirection()
{
global $link, $cookie;
if (Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
// Automatically redirect to the canonical URL if needed
if (isset($this->php_self) && !empty($this->php_self)) {
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
$canonicalURL = $link->getPageLink($this->php_self, $this->ssl, $cookie->id_lang);
if (!Tools::getValue('ajax') && !preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', ($this->ssl && _PS_SSL_ENABLED_ ? 'https://' : 'http://') . urldecode($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']))) {
if ($_SERVER['REQUEST_URI'] == __PS_BASE_URI__) {
header('HTTP/1.0 303 See Other');
header('Cache-Control: no-cache');
} else {
header('HTTP/1.0 301 Moved Permanently');
header('Cache-Control: no-cache');
}
$params = '';
$excludedKey = array('isolang', 'id_lang');
foreach ($_GET as $key => $value) {
if (!in_array($key, $excludedKey)) {
$params .= ($params == '' ? '?' : '&') . $key . '=' . $value;
}
}
Module::hookExec('frontCanonicalRedirect');
if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) {
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . $params . '">' . $canonicalURL . $params . '</a>');
}
Tools::redirectLink($canonicalURL . $params);
}
}
}
}
示例5: renderForm
public function renderForm($args, $data)
{
global $currentIndex;
$options = array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')));
$orderby = array(array('order' => 'date_add', 'name' => $this->l('Date Add')), array('order' => 'date_upd', 'name' => $this->l('Date Update')), array('order' => 'name', 'name' => $this->l('Name')), array('order' => 'id_product', 'name' => $this->l('Product Id')), array('order' => 'price', 'name' => $this->l('Price')));
$orderway = array(array('orderway' => 'ASC', 'name' => $this->l('Ascending')), array('orderway' => 'DESC', 'name' => $this->l('Descending')));
$root = Category::getRootCategory();
$categories = array();
$helper = $this->getFormHelper();
$items = '';
$tab_edit = '';
if ($data['params'] && isset($data['params']['leotab']) && $data['params']['leotab']) {
$tabs = $data['params']['leotab'];
$items = $this->getTabs($tabs);
if (Tools::getValue('id_tab')) {
$id_tab = Tools::getValue('id_tab');
$tab_edit = $items[$id_tab] ? $items[$id_tab] : '';
$categories = $items[$id_tab]['categories'] ? $items[$id_tab]['categories'] : array();
}
}
$tree = new HelperTreeCategories('categories-tree', 'Categories');
$tree->setRootCategory($root->id)->setUseCheckBox(true)->setUseSearch(true)->setSelectedCategories($categories);
$this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Carousel Form.')), 'input' => array(array('type' => 'html', 'html_content' => 'Please access <a href="http://apollotheme.com/" target="_blank" title="apollo site">Apollotheme.com</a> to buy professional version to use this '), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/how-to-buy-pro-version/" target="_blank" title="How to buy">How to buy Professional Version</a>'), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/different-between-free-pro-version/" target="_blank" title="Why should use">Why should use Professional Version</a>')), 'buttons' => array(array('title' => $this->l('Save And Stay'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveandstayleotempcp'), array('title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveleotempcp')));
$helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($data), 'languages' => Context::getContext()->controller->getLanguages(), 'id_lang_default' => (int) Configuration::get('PS_LANG_DEFAULT'), 'iso_code' => Context::getContext()->language->iso_code, 'text_title' => 'title_' . Context::getContext()->language->iso_code, 'path' => __PS_BASE_URI__ . 'themes/' . _THEME_NAME_ . '/img/icontab/', 'images' => LeoWidgetBase::getImageList(_PS_ROOT_DIR_ . '/themes/' . _THEME_NAME_ . '/img/icontab/'), 'url' => AdminController::$currentIndex . '&id_leowidgets=' . Tools::getValue('id_leowidgets') . '&updateleowidgets&token=' . Tools::getValue('token') . '&conf=4', 'items' => $items, 'tab_edit' => $tab_edit);
return $helper->generateForm($this->fields_form);
}
示例6: rev_uploader
private function rev_uploader()
{
$key = Tools::getValue('security_key');
if (empty($key) || Tools::encrypt(GlobalsRevSlider::MODULE_NAME) != $key) {
echo json_encode(array('error_on' => 1, 'error_details' => 'Security Error'));
die;
}
$targetFolder = ABSPATH . '/uploads/';
$randnum = rand(00, 9999999);
$sds_time = time();
$NewFileName = $randnum . '-' . $sds_time;
//$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
//$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
$targetPath = $targetFolder;
//$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
// Validate the file type
$fileTypes = array('jpg', 'jpeg', 'gif', 'png');
// File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'], $fileTypes)) {
// $worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $randnum.$_FILES['Filedata']['name']);
$worked = UniteFunctionsWPRev::import_media_img($tempFile, $targetPath, $NewFileName . '.' . $fileParts['extension']);
if (!empty($worked)) {
echo '1';
}
} else {
echo '0';
}
}
}
示例7: hookAdminStatsModules
public function hookAdminStatsModules($params)
{
$engineParams = array('id' => 'id_customer', 'title' => $this->displayName, 'columns' => $this->_columns, 'defaultSortColumn' => $this->_defaultSortColumn, 'defaultSortDirection' => $this->_defaultSortDirection, 'emptyMessage' => $this->_emptyMessage, 'pagingMessage' => $this->_pagingMessage);
if (Tools::getValue('export')) {
$this->csvExport($engineParams);
}
$this->_html = '
<div class="blocStats"><h2 class="icon-' . $this->name . '"><span></span>' . $this->displayName . '</h2>
' . $this->engine($engineParams) . '
<p><a class="button export-csv" href="' . htmlentities($_SERVER['REQUEST_URI']) . '&export=1"><span>' . $this->l('CSV Export') . '</span></a></p>
</div><br />
<div class="blocStats"><h2 class="icon-guide"><span></span>' . $this->l('Guide') . '</h2>
<h2 >' . $this->l('Develop clients\' loyalty') . '</h2>
<p class="space">
' . $this->l('Keeping a client is more profitable than gaining a new one. Thus, it is necessary to develop their loyalty, in other words to make them want to come back to your webshop.') . ' <br />
' . $this->l('Word of mouth is also a means to of getting new, satisfied clients; a dissatisfied one won\'t attract new clients.') . '<br />
' . $this->l('In order to achieve this goal you can organize: ') . '
<ul>
<li>' . $this->l('Punctual operations: commercial rewards (personalized special offers, product or service offered),
non commercial rewards (priority handling of an order or a product), pecuniary rewards (bonds, discount coupons, payback).') . '</li>
<li>' . $this->l('Sustainable operations: loyalty points or cards, which not only justify communication between merchant and client,
but also offer advantages to clients (private offers, discounts).') . '</li>
</ul>
' . $this->l('These operations encourage clients to buy products and visit your webshop regularly.') . ' <br />
</p><br />
</div>';
return $this->_html;
}
示例8: displayContent
public function displayContent()
{
$id_order = (int) Tools::getValue('id_order');
$order = new Order($id_order);
$paypal_order = PayPalOrder::getOrderById($id_order);
if (defined("PAYPAL_FORCE_CURRENCY")) {
$currency = new Currency((int) $this->context->currency->id);
$paycurrency = new Currency(PAYPAL_FORCE_CURRENCY);
$currency_decimals = $paycurrency->decimals;
$paypal_order['total_paid'] = $paypal_order['total_paid'] / $currency->conversion_rate * $paycurrency->conversion_rate;
}
$price = Tools::displayPrice($paypal_order['total_paid'], $this->context->currency);
$order_state = new OrderState($id_order);
if ($order_state) {
$order_state_message = $order_state->template[$this->context->language->id];
}
if (!$order || !$order_state || isset($order_state_message) && $order_state_message == 'payment_error') {
$this->context->smarty->assign(array('logs' => array($this->paypal->l('An error occurred while processing payment.')), 'order' => $paypal_order, 'price' => $price));
if (isset($order_state_message) && $order_state_message) {
$this->context->smarty->assign('message', $order_state_message);
}
$template = 'error.tpl';
} else {
$this->context->smarty->assign(array('order' => $paypal_order, 'price' => $price));
if (version_compare(_PS_VERSION_, '1.5', '>')) {
$this->context->smarty->assign(array('reference_order' => Order::getUniqReferenceOf($paypal_order['id_order'])));
}
$template = 'order-confirmation.tpl';
}
$this->context->smarty->assign('use_mobile', (bool) $this->paypal->useMobile());
echo $this->paypal->fetchTemplate($template);
}
示例9: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitAdd' . $this->table)) {
if ($id = intval(Tools::getValue('id_attachment')) and $a = new Attachment($id)) {
$_POST['file'] = $a->file;
$_POST['mime'] = $a->mime;
}
if (!sizeof($this->_errors)) {
if (isset($_FILES['file']) and is_uploaded_file($_FILES['file']['tmp_name'])) {
if ($_FILES['file']['size'] > $this->maxFileSize) {
$this->_errors[] = $this->l('File too large, maximum size allowed:') . ' ' . $this->maxFileSize / 1000 . ' ' . $this->l('kb');
} else {
$uploadDir = dirname(__FILE__) . '/../../download/';
do {
$uniqid = sha1(microtime());
} while (file_exists($uploadDir . $uniqid));
if (!copy($_FILES['file']['tmp_name'], $uploadDir . $uniqid)) {
$this->_errors[] = $this->l('File copy failed');
}
@unlink($_FILES['file']['tmp_name']);
$_POST['name_2'] .= '.' . pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
$_POST['file'] = $uniqid;
$_POST['mime'] = $_FILES['file']['type'];
}
}
}
$this->validateRules();
}
return parent::postProcess();
}
示例10: postProcess
public function postProcess()
{
global $currentIndex;
if (isset($_POST['submitLocalization' . $this->table])) {
if ($this->tabAccess['edit'] === '1') {
$this->_postConfig($this->_fieldsLocalization);
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
} elseif (Tools::isSubmit('submitLocalizationPack')) {
if (!($pack = @Tools::file_get_contents('http://www.prestashop.com/download/localization/' . Tools::getValue('iso_localization_pack') . '.xml')) and !($pack = @Tools::file_get_contents(dirname(__FILE__) . '/../../localization/' . Tools::getValue('iso_localization_pack') . '.xml'))) {
$this->_errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")');
} elseif (!($selection = Tools::getValue('selection'))) {
$this->_errors[] = Tools::displayError('Please select at least one content item to import.');
} else {
foreach ($selection as $selected) {
if (!Validate::isLocalizationPackSelection($selected)) {
$this->_errors[] = Tools::displayError('Invalid selection');
return;
}
}
$localizationPack = new LocalizationPack();
if (!$localizationPack->loadLocalisationPack($pack, $selection)) {
$this->_errors = array_merge($this->_errors, $localizationPack->getErrors());
} else {
Tools::redirectAdmin($currentIndex . '&conf=23&token=' . $this->token);
}
}
}
parent::postProcess();
}
示例11: init
public function init()
{
parent::init();
if (Module::isEnabled('aimultidimensions')) {
if (Tools::getIsset('add') && $this->context->cart->id) {
require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'aimultidimensions.php';
require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'config.php';
require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'functions' . $GLOBALS['aimd_config_suffix'] . '.php';
$add = 1;
$idProduct = (int) Tools::getValue('id_product', NULL);
if (checkLink($idProduct)) {
$idProductAttribute = (int) Tools::getValue('id_product_attribute', Tools::getValue('ipa'));
$customizationId = (int) Tools::getValue('id_customization', 0);
$qty = (int) abs(Tools::getValue('qty', 1));
if ($add && $qty >= 0 && getProducts($idProduct)) {
$quantity = (int) Db::getInstance()->getValue('SELECT quantity FROM ' . _DB_PREFIX_ . 'cart_product WHERE id_cart = ' . $this->context->cart->id . ' AND id_product = ' . $idProduct . ' AND ' . 'id_product_attribute = ' . $idProductAttribute);
if (Tools::getValue('op', 'up') == 'up') {
$quantity += (int) $qty;
} else {
$quantity -= (int) $qty;
}
$cookie = $this->context->cookie;
$cart = $this->context->cart;
include_once 'modules/aimultidimensions/includes/cart.php';
Product::flushPriceCache();
}
}
}
}
}
示例12: preProcess
public function preProcess()
{
parent::preProcess();
$this->id_cart = (int) Tools::getValue('id_cart', 0);
/* check if the cart has been made by a Guest customer, for redirect link */
if (Cart::isGuestCartByCartId($this->id_cart)) {
$redirectLink = 'guest-tracking.php';
} else {
$redirectLink = 'history.php';
}
$this->id_module = (int) Tools::getValue('id_module', 0);
$this->id_order = Order::getOrderByCartId((int) $this->id_cart);
$this->secure_key = Tools::getValue('key', false);
if (!$this->id_order or !$this->id_module or !$this->secure_key or empty($this->secure_key)) {
Tools::redirect($redirectLink . (Tools::isSubmit('slowvalidation') ? '?slowvalidation' : ''));
}
$order = new Order((int) $this->id_order);
if (!Validate::isLoadedObject($order) or $order->id_customer != self::$cookie->id_customer or $this->secure_key != $order->secure_key) {
Tools::redirect($redirectLink);
}
$module = Module::getInstanceById((int) $this->id_module);
if ($order->payment != $module->displayName) {
Tools::redirect($redirectLink);
}
}
示例13: postProcess
public function postProcess()
{
global $currentIndex, $cookie, $smarty;
if (Tools::getValue('getReferrerData')) {
$id_referrer = Tools::getValue('referrer');
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("\n\t\t select o.id_order, concat(c.firstname, ' ', c.lastname) as 'name', concat(a.`address1`, a.`address2`) as 'address', a.`phone_mobile`, o.`total_paid`, date(c.date_add) as 'date_register'\n from ps_orders o \n inner join ps_customer c on o.id_customer = c.id_customer\n inner join ps_address a on a.`id_address` = o.`id_address_delivery`\n where o.id_customer in (select id_customer from ps_customer where id_referrer = " . $id_referrer . ")\n\t\t ");
$smarty->assign('referredOrders', $res);
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("\n\t\t select id_customer, concat(firstname, ' ', lastname) as 'name', date(date_add) as 'date_add' from ps_customer where id_referrer = " . $id_referrer);
$smarty->assign('referredCustomers', $res);
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("\r\n\t\t select concat(c.firstname, ' ', c.lastname) as 'name', count(*) as 'total_orders', sum(o.total_paid) as 'total_paid' from ps_orders o \n inner join `ps_order_history` oh on oh.id_order = o.id_order\n inner join ps_customer c on c.id_customer = o.id_customer\n where o.id_customer = " . $id_referrer . "\n and oh.id_order_history = (select max(id_order_history) from ps_order_history where id_order = o.id_order)\n and oh.id_order_state not in (6, 14, 20)\n\t\t ");
$smarty->assign('referrer_details', $res[0]);
$smarty->assign('orderToken', Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $cookie->id_employee));
}
$date_from = Tools::getValue('date_from', date('Y-n-j'));
$date_to = Tools::getValue('date_to', date('Y-n-j'));
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("\n\t\t select c.id_customer `customerID`, concat(c.firstname, ' ', c.lastname) as `name`, \n count(distinct(c2.id_customer)) as 'total_registered',\n count(o.id_order) as 'total_orders',\n count(distinct(o.id_customer)) as 'total_friends_orders',\n round(coalesce(avg(o.total_paid), 0)) as 'avg_order'\n from ps_customer c\n inner join ps_customer c2 on c.id_customer = c2.id_referrer\n left join ps_orders o on o.id_customer = c2.id_customer\n\t\t inner join `ps_order_history` oh on oh.id_order = o.id_order\n where date(c2.`date_add`) between '" . $date_from . "' and '" . $date_to . "'\n\t\t and oh.id_order_history = (SELECT MAX(`id_order_history`) FROM `ps_order_history` moh WHERE moh.`id_order` = o.`id_order` GROUP BY moh.`id_order`)\n\t\t\t\tand oh.id_order_state not in (6,8,20)\n group by c.id_customer \n\t\t ");
$friends_shopped = array();
$avg_order = array();
foreach ($res as $key => $row) {
$friends_shopped[$key] = $row['total_friends_orders'];
$avg_order[$key] = $row['avg_order'];
}
array_multisort($friends_shopped, SORT_DESC, $avg_order, SORT_ASC, $res);
$smarty->assign('date_from', $date_from);
$smarty->assign('date_to', $date_to);
$smarty->assign('referrals', $res);
$smarty->assign('token', $this->token);
$smarty->assign('customerToken', Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $cookie->id_employee));
}
示例14: init
/**
* Initialize order confirmation controller
* @see FrontController::init()
*/
public function init()
{
parent::init();
$this->id_cart = (int) Tools::getValue('id_cart', 0);
$is_guest = false;
/* check if the cart has been made by a Guest customer, for redirect link */
if (Cart::isGuestCartByCartId($this->id_cart)) {
$is_guest = true;
$redirectLink = 'index.php?controller=guest-tracking';
} else {
$redirectLink = 'index.php?controller=history';
}
$this->id_module = (int) Tools::getValue('id_module', 0);
$this->id_order = Order::getOrderByCartId((int) $this->id_cart);
$this->secure_key = Tools::getValue('key', false);
$order = new Order((int) $this->id_order);
if ($is_guest) {
$customer = new Customer((int) $order->id_customer);
$redirectLink .= '&id_order=' . $order->reference . '&email=' . urlencode($customer->email);
}
if (!$this->id_order || !$this->id_module || !$this->secure_key || empty($this->secure_key)) {
Tools::redirect($redirectLink . (Tools::isSubmit('slowvalidation') ? '&slowvalidation' : ''));
}
$this->reference = $order->reference;
if (!Validate::isLoadedObject($order) || $order->id_customer != $this->context->customer->id || $this->secure_key != $order->secure_key) {
Tools::redirect($redirectLink);
}
$module = Module::getInstanceById((int) $this->id_module);
if ($order->payment != $module->displayName) {
Tools::redirect($redirectLink);
}
}
示例15: renderForm
public function renderForm($args, $data)
{
# validate module
unset($args);
$this->checkFolderImage();
$helper = $this->getFormHelper();
$items = '';
$slide_edit = '';
if ($data['params'] && isset($data['params']['leoslide']) && $data['params']['leoslide']) {
$slides = $data['params']['leoslide'];
$items = $this->getSlide($slides);
if (Tools::getValue('id_slide')) {
$id_slide = Tools::getValue('id_slide');
$slide_edit = $items[$id_slide] ? $items[$id_slide] : '';
}
}
$this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Carousel Form.')), 'input' => array(array('type' => 'text', 'label' => $this->l('Image Size Width'), 'name' => 'img_width', 'default' => 1170), array('type' => 'text', 'label' => $this->l('Image size Height'), 'name' => 'img_height', 'default' => 400), array('type' => 'text', 'label' => $this->l('Thumb Size Width'), 'name' => 'thumb_width', 'default' => 100), array('type' => 'text', 'label' => $this->l('Thumb size Height'), 'name' => 'thumb_height', 'default' => 100), array('type' => 'text', 'label' => $this->l('Interval'), 'name' => 'interval', 'default' => 8000)), 'buttons' => array(array('title' => $this->l('Save And Stay'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveandstayleotempcp'), array('title' => $this->l('Save'), 'icon' => 'process-icon-save', 'class' => 'pull-right', 'type' => 'submit', 'name' => 'saveleotempcp')));
if (Tools::getIsset('addleowidgets')) {
$this->fields_form[1]['form']['input'][] = array('type' => 'html', 'name' => 'html', 'default' => '', 'html_content' => '<div class="alert alert-info">' . $this->l('Please Click save to input image') . '</div>');
} else {
$this->fields_form[1]['form']['input'][] = array('type' => 'slide', 'name' => 'slide', 'lang' => true, 'selectImg' => Context::getContext()->link->getAdminLink('AdminLeomanagewidgetsImages'), 'tree' => '', 'default' => '');
}
$theme_dir = Context::getContext()->shop->theme_directory;
$images = array();
$thums = array();
$images = LeoWidgetBase::getImageList(_PS_ROOT_DIR_ . '/themes/' . $theme_dir . '/img/modules/' . $this->name . '/image');
$thums = LeoWidgetBase::getImageList(_PS_ROOT_DIR_ . '/themes/' . $theme_dir . '/img/modules/' . $this->name . '/thum');
$iso = Context::getContext()->language->iso_code;
$helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($data), 'languages' => Context::getContext()->controller->getLanguages(), 'id_lang_default' => Configuration::get('PS_LANG_DEFAULT'), 'iso_code' => Context::getContext()->language->iso_code, 'iso' => file_exists(_PS_CORE_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en', 'path_css' => _THEME_CSS_DIR_, 'ad' => __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_), 'images' => $images, 'thums' => $thums, 'items' => $items, 'slide_edit' => $slide_edit, 'url' => AdminController::$currentIndex . '&id_leowidgets=' . Tools::getValue('id_leowidgets') . '&updateleowidgets&token=' . Tools::getValue('token') . '&conf=4', 'pathimg' => __PS_BASE_URI__ . 'themes/' . $theme_dir . '/img/modules/' . $this->name . '/image/', 'paththum' => __PS_BASE_URI__ . 'themes/' . $theme_dir . '/img/modules/' . $this->name . '/thum/');
return $helper->generateForm($this->fields_form);
}