[*] MO : updated controllers for mobile theme

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14114 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
nPellicari
2012-03-13 17:34:18 +00:00
parent 63dbd490ed
commit ed21b38e8a
4 changed files with 27 additions and 11 deletions
+12
View File
@@ -974,6 +974,18 @@ class FrontControllerCore extends Controller
*/ */
public function setMobileTemplate($template) public function setMobileTemplate($template)
{ {
// Needed for site map
$blockmanufacturer = Module::getInstanceByName('blockmanufacturer');
$blocksupplier = Module::getInstanceByName('blocksupplier');
$this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0));
$this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1));
$this->context->smarty->assign('voucherAllowed', (int)Configuration::get('PS_VOUCHERS'));
$this->context->smarty->assign('display_manufacturer_link', (((int)$blockmanufacturer->id) ? true : false));
$this->context->smarty->assign('display_supplier_link', (((int)$blocksupplier->id) ? true : false));
$this->context->smarty->assign('PS_DISPLAY_SUPPLIERS', Configuration::get('PS_DISPLAY_SUPPLIERS'));
$this->context->smarty->assign('display_store', Configuration::get('PS_STORES_DISPLAY_SITEMAP'));
$mobile_template = ''; $mobile_template = '';
$tpl_file = basename($template); $tpl_file = basename($template);
$dirname = dirname($template).(substr(dirname($template), -1, 1) == '/' ? '' : '/'); $dirname = dirname($template).(substr(dirname($template), -1, 1) == '/' ? '' : '/');
+2 -1
View File
@@ -125,7 +125,8 @@ class IdentityControllerCore extends FrontController
public function setMedia() public function setMedia()
{ {
parent::setMedia(); parent::setMedia();
$this->addCSS(_THEME_CSS_DIR_.'identity.css'); if ($this->context->getMobileDevice() == false)
$this->addCSS(_THEME_CSS_DIR_.'identity.css');
} }
} }
+1
View File
@@ -53,6 +53,7 @@ class ProductControllerCore extends FrontController
} }
else else
$this->addJS(array( $this->addJS(array(
_THEME_JS_DIR_.'tools.js',
_THEME_MOBILE_JS_DIR_.'product.js' _THEME_MOBILE_JS_DIR_.'product.js'
)); ));
+12 -10
View File
@@ -202,7 +202,7 @@ function updateDisplay()
$('#quantityAvailableTxtMultiple').show(); $('#quantityAvailableTxtMultiple').show();
} }
} }
} }
else else
{ {
//show the hook out of stock //show the hook out of stock
@@ -340,7 +340,7 @@ function updateDisplay()
$('#not_impacted_by_discount').show(); $('#not_impacted_by_discount').show();
else else
$('#not_impacted_by_discount').hide(); $('#not_impacted_by_discount').hide();
var taxExclPrice = (display_specific_price ? (specific_currency ? display_specific_price : display_specific_price * currencyRate) : priceTaxExclWithoutGroupReduction) + selectedCombination['price'] * currencyRate; var taxExclPrice = (display_specific_price ? (specific_currency ? display_specific_price : display_specific_price * currencyRate) : priceTaxExclWithoutGroupReduction) + selectedCombination['price'] * currencyRate;
if (display_specific_price) if (display_specific_price)
@@ -388,23 +388,25 @@ function updateDisplay()
productPriceWithoutReduction += ecotaxAmount; productPriceWithoutReduction += ecotaxAmount;
//productPrice = ps_round(productPrice * currencyRate, 2); //productPrice = ps_round(productPrice * currencyRate, 2);
if (productPrice > 0) var our_price = '';
$('#our_price_display').text(formatCurrency(productPrice, currencyFormat, currencySign, currencyBlank)); if (productPrice > 0) {
else our_price = formatCurrency(productPrice, currencyFormat, currencySign, currencyBlank);
$('#our_price_display').text(formatCurrency(0, currencyFormat, currencySign, currencyBlank)); } else {
our_price = formatCurrency(0, currencyFormat, currencySign, currencyBlank);
}
$('#our_price_display').text(our_price);
$('#old_price_display').text(formatCurrency(productPriceWithoutReduction, currencyFormat, currencySign, currencyBlank)); $('#old_price_display').text(formatCurrency(productPriceWithoutReduction, currencyFormat, currencySign, currencyBlank));
if (productPriceWithoutReduction > productPrice) if (productPriceWithoutReduction > productPrice)
$('#old_price,#old_price_display,#old_price_display_taxes').show(); $('#old_price,#old_price_display,#old_price_display_taxes').show();
else else
$('#old_price,#old_price_display,#old_price_display_taxes').hide(); $('#old_price,#old_price_display,#old_price_display_taxes').hide();
/* Special feature: "Display product price tax excluded on product page" */ // Special feature: "Display product price tax excluded on product page"
if (!noTaxForThisProduct) if (!noTaxForThisProduct)
var productPricePretaxed = productPrice / tax; var productPricePretaxed = productPrice / tax;
else else
var productPricePretaxed = productPrice; var productPricePretaxed = productPrice;
$('#pretaxe_price_display').text(formatCurrency(productPricePretaxed, currencyFormat, currencySign, currencyBlank)); $('#pretaxe_price_display').text(formatCurrency(productPricePretaxed, currencyFormat, currencySign, currencyBlank));
/* Unit price */ // Unit price
productUnitPriceRatio = parseFloat(productUnitPriceRatio); productUnitPriceRatio = parseFloat(productUnitPriceRatio);
if (productUnitPriceRatio > 0 ) if (productUnitPriceRatio > 0 )
{ {
@@ -412,7 +414,7 @@ function updateDisplay()
$('#unit_price_display').text(formatCurrency(newUnitPrice, currencyFormat, currencySign, currencyBlank)); $('#unit_price_display').text(formatCurrency(newUnitPrice, currencyFormat, currencySign, currencyBlank));
} }
/* Ecotax */ // Ecotax
var ecotaxAmount = !displayPrice ? ps_round(selectedCombination['ecotax'] * (1 + ecotaxTax_rate / 100), 2) : selectedCombination['ecotax']; var ecotaxAmount = !displayPrice ? ps_round(selectedCombination['ecotax'] * (1 + ecotaxTax_rate / 100), 2) : selectedCombination['ecotax'];
$('#ecotax_price_display').text(formatCurrency(ecotaxAmount, currencyFormat, currencySign, currencyBlank)); $('#ecotax_price_display').text(formatCurrency(ecotaxAmount, currencyFormat, currencySign, currencyBlank));
} }