// Rename Module->smartyAssign to Module->templateAssign
[+] Front: Add module controller + url dispatch for modules
This commit is contained in:
@@ -77,10 +77,10 @@ class BlockCart extends Module
|
||||
if ($useTax AND Configuration::get('PS_TAX_DISPLAY') == 1)
|
||||
{
|
||||
$totalToPayWithoutTaxes = $params['cart']->getOrderTotal(false);
|
||||
$this->smartyAssign('tax_cost', Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency));
|
||||
$this->templateAssign('tax_cost', Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency));
|
||||
}
|
||||
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'products' => $products,
|
||||
'customizedDatas' => Product::getAllCustomizedDatas((int)($params['cart']->id)),
|
||||
'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_,
|
||||
@@ -98,9 +98,9 @@ class BlockCart extends Module
|
||||
'ajax_allowed' => (int)(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false
|
||||
));
|
||||
if (sizeof($errors))
|
||||
$this->smartyAssign('errors', $errors);
|
||||
$this->templateAssign('errors', $errors);
|
||||
if(isset($this->context->cookie->ajax_blockcart_display))
|
||||
$this->smartyAssign('colapseExpandStatus', $this->context->cookie->ajax_blockcart_display);
|
||||
$this->templateAssign('colapseExpandStatus', $this->context->cookie->ajax_blockcart_display);
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
@@ -160,7 +160,7 @@ class BlockCart extends Module
|
||||
return;
|
||||
|
||||
// @todo this variable seems not used
|
||||
$this->smartyAssign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false);
|
||||
$this->templateAssign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false);
|
||||
$this->assignContentVars($params);
|
||||
return $this->display(__FILE__, 'blockcart.tpl');
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ class BlockCms extends Module
|
||||
public function displayBlockCMS($column)
|
||||
{
|
||||
$cms_titles = self::getCMStitles($column);
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'block' => 1,
|
||||
'cms_titles' => $cms_titles,
|
||||
));
|
||||
@@ -796,7 +796,7 @@ class BlockCms extends Module
|
||||
if (Configuration::get('FOOTER_BLOCK_ACTIVATION'))
|
||||
{
|
||||
$cms_titles = self::getCMStitlesFooter();
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'block' => 0,
|
||||
'cmslinks' => $cms_titles,
|
||||
'display_stores_footer' => Configuration::get('PS_STORES_DISPLAY_FOOTER'),
|
||||
|
||||
@@ -92,7 +92,7 @@ class BlockLanguages extends Module
|
||||
}
|
||||
}
|
||||
if (count($default_rewrite))
|
||||
$this->smartyAssign('lang_rewrite_urls', $default_rewrite);
|
||||
$this->templateAssign('lang_rewrite_urls', $default_rewrite);
|
||||
}
|
||||
|
||||
return $this->display(__FILE__, 'blocklanguages.tpl');
|
||||
|
||||
@@ -54,8 +54,7 @@ class BlockManufacturer extends Module
|
||||
|
||||
function hookLeftColumn($params)
|
||||
{
|
||||
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'manufacturers' => Manufacturer::getManufacturers(),
|
||||
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
|
||||
'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
|
||||
|
||||
@@ -61,7 +61,7 @@ class BlockMyAccount extends Module
|
||||
if (!$this->context->customer->isLogged())
|
||||
return false;
|
||||
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'voucherAllowed' => (int)Configuration::get('PS_VOUCHERS'),
|
||||
'returnAllowed' => (int)Configuration::get('PS_ORDER_RETURN'),
|
||||
'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock'),
|
||||
|
||||
@@ -100,7 +100,7 @@ class BlockNewProducts extends Module
|
||||
if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
|
||||
return;
|
||||
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'new_products' => $newProducts,
|
||||
'mediumSize' => Image::getSize('medium'),
|
||||
));
|
||||
|
||||
@@ -90,7 +90,7 @@ class BlockSpecials extends Module
|
||||
if (!$special = Product::getRandomSpecial((int)$params['cookie']->id_lang) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY'))
|
||||
return;
|
||||
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'special' => $special,
|
||||
'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2),
|
||||
'mediumSize' => Image::getSize('medium'),
|
||||
|
||||
@@ -60,7 +60,7 @@ class BlockUserInfo extends Module
|
||||
if (!$this->active)
|
||||
return;
|
||||
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'cart' => $this->context->cart,
|
||||
'cart_qties' => $this->context->cart->nbProducts(),
|
||||
'logged' => $this->context->customer->isLogged(),
|
||||
|
||||
@@ -166,7 +166,7 @@ class BlockViewed extends Module
|
||||
if (!sizeof($productsViewedObj))
|
||||
return ;
|
||||
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'productsViewedObj' => $productsViewedObj,
|
||||
'mediumSize' => Image::getSize('medium')));
|
||||
|
||||
|
||||
+34
-25
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -42,7 +42,7 @@ class Cheque extends PaymentModule
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '2.3';
|
||||
$this->author = 'PrestaShop';
|
||||
|
||||
|
||||
$this->currencies = true;
|
||||
$this->currencies_mode = 'checkbox';
|
||||
|
||||
@@ -51,13 +51,13 @@ class Cheque extends PaymentModule
|
||||
$this->chequeName = $config['CHEQUE_NAME'];
|
||||
if (isset($config['CHEQUE_ADDRESS']))
|
||||
$this->address = $config['CHEQUE_ADDRESS'];
|
||||
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Check');
|
||||
$this->description = $this->l('Module for accepting payments by check.');
|
||||
$this->confirmUninstall = $this->l('Are you sure you want to delete your details ?');
|
||||
|
||||
|
||||
if (!isset($this->chequeName) OR !isset($this->address))
|
||||
$this->warning = $this->l('\'To the order of\' and address must be configured in order to use this module correctly.');
|
||||
if (!sizeof(Currency::checkPaymentCurrencies($this->id)))
|
||||
@@ -149,26 +149,7 @@ class Cheque extends PaymentModule
|
||||
|
||||
public function execPayment($cart)
|
||||
{
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
if (!$this->_checkCurrency($cart))
|
||||
Tools::redirect('index.php?controller=order');
|
||||
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'nbProducts' => $cart->nbProducts(),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currencies' => $this->getCurrency((int)$cart->id_currency),
|
||||
'total' => $cart->getOrderTotal(true, Cart::BOTH),
|
||||
'isoCode' => $this->context->language->iso_code,
|
||||
'chequeName' => $this->chequeName,
|
||||
'chequeAddress' => Tools::nl2br($this->address),
|
||||
'this_path' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'payment_execution.tpl');
|
||||
return $this->actionPayment(true);
|
||||
}
|
||||
|
||||
public function hookPayment($params)
|
||||
@@ -203,7 +184,7 @@ class Cheque extends PaymentModule
|
||||
$this->context->smarty->assign('status', 'failed');
|
||||
return $this->display(__FILE__, 'payment_return.tpl');
|
||||
}
|
||||
|
||||
|
||||
private function _checkCurrency($cart)
|
||||
{
|
||||
$currency_order = new Currency((int)($cart->id_currency));
|
||||
@@ -215,4 +196,32 @@ class Cheque extends PaymentModule
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public function actionPayment($direct_call = false)
|
||||
{
|
||||
if (!$this->active)
|
||||
return ;
|
||||
|
||||
$cart = $this->context->cart;
|
||||
if (!$this->_checkCurrency($cart))
|
||||
Tools::redirect('index.php?controller=order');
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'nbProducts' => $cart->nbProducts(),
|
||||
'cust_currency' => $cart->id_currency,
|
||||
'currencies' => $this->getCurrency((int)$cart->id_currency),
|
||||
'total' => $cart->getOrderTotal(true, Cart::BOTH),
|
||||
'isoCode' => $this->context->language->iso_code,
|
||||
'chequeName' => $this->chequeName,
|
||||
'chequeAddress' => Tools::nl2br($this->address),
|
||||
'this_path' => $this->_path,
|
||||
'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'
|
||||
));
|
||||
|
||||
if (!$direct_call)
|
||||
return $this->getTemplatePath('payment_execution.tpl');
|
||||
else
|
||||
// For retrocompatibility
|
||||
return $this->display(__FILE__, 'payment_execution.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
*}
|
||||
|
||||
<p class="payment_module">
|
||||
<a href="{$this_path_ssl}payment.php" title="{l s='Pay by cheque' mod='cheque'}">
|
||||
<a href="{$link->getModuleLink('cheque', 'payment')}" title="{l s='Pay by cheque' mod='cheque'}">
|
||||
<img src="{$this_path}cheque.jpg" alt="{l s='Pay by cheque' mod='cheque'}" width="86" height="49" />
|
||||
{l s='Pay by cheque (order process will be longer)' mod='cheque'}
|
||||
</a>
|
||||
|
||||
@@ -96,7 +96,7 @@ class HomeFeatured extends Module
|
||||
$nb = (int)(Configuration::get('HOME_FEATURED_NBR'));
|
||||
$products = $category->getProducts($params['cookie']->id_lang, 1, ($nb ? $nb : 10));
|
||||
|
||||
$this->smartyAssign(array(
|
||||
$this->templateAssign(array(
|
||||
'products' => $products,
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'homeSize' => Image::getSize('home'),
|
||||
|
||||
Reference in New Issue
Block a user