[+] MO: Add Module->smartyAssign method, in order to assign variables with module name as prefix in module's templates

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8718 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie committed 2011-09-22 12:05:49 +00:00
1 parent b24d2fa274
commit 2dbea99b61
19 files changed
+174 -155

No files matched your search

+22 -4
View File
@@ -469,7 +469,7 @@ abstract class ModuleCore
$this->unregisterExceptions($hookID, $shopList); $this->unregisterExceptions($hookID, $shopList);
$result &= $this->registerExceptions($hookID, $except, $shopList); $result &= $this->registerExceptions($hookID, $except, $shopList);
} }
return $result; return $result;
} }
@@ -572,9 +572,9 @@ abstract class ModuleCore
$modulesNameToCursor = array(); $modulesNameToCursor = array();
$errors = array(); $errors = array();
$modules_dir = self::getModulesDirOnDisk(); $modules_dir = self::getModulesDirOnDisk();
$memory_limit = Tools::getMemoryLimit(); $memory_limit = Tools::getMemoryLimit();
foreach ($modules_dir AS $module) foreach ($modules_dir AS $module)
{ {
// Memory usage checking // Memory usage checking
@@ -589,7 +589,7 @@ abstract class ModuleCore
break; break;
} }
} }
$configFile = _PS_MODULE_DIR_.$module.'/config.xml'; $configFile = _PS_MODULE_DIR_.$module.'/config.xml';
$xml_exist = file_exists($configFile); $xml_exist = file_exists($configFile);
if ($xml_exist) if ($xml_exist)
@@ -1154,6 +1154,24 @@ abstract class ModuleCore
return $result; return $result;
} }
/**
* Assign a smarty vars (same syntax as smarty->assign) but prefix all keys with module name
*
* @since 1.5.0
* @param string $key Variable key (can be an array)
* @param mixed $value Variable value
*/
public function smartyAssign($key, $value = null)
{
if (is_array($key))
{
foreach ($key as $k => $v)
$this->context->smarty->assign($this->name.'_'.$k, $v);
}
else
$this->context->smarty->assign($this->name.'_'.$key, $value);
}
protected function _getApplicableTemplateDir($template) protected function _getApplicableTemplateDir($template)
{ {
return $this->_isTemplateOverloaded($template) ? _PS_THEME_DIR_ : _PS_MODULE_DIR_.$this->name.'/'; return $this->_isTemplateOverloaded($template) ? _PS_THEME_DIR_ : _PS_MODULE_DIR_.$this->name.'/';
+16 -16
View File
@@ -1,5 +1,5 @@
{* {*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -26,8 +26,8 @@
{ldelim} {ldelim}
"products": [ "products": [
{if $products} {if $blockcart_products}
{foreach from=$products item=product name='products'} {foreach from=$blockcart_products item=product name='products'}
{assign var='productId' value=$product.id_product} {assign var='productId' value=$product.id_product}
{assign var='productAttributeId' value=$product.id_product_attribute} {assign var='productAttributeId' value=$product.id_product_attribute}
{ldelim} {ldelim}
@@ -44,11 +44,11 @@
{else} {else}
"hasAttributes": false, "hasAttributes": false,
{/if} {/if}
"hasCustomizedDatas": {if isset($customizedDatas.$productId.$productAttributeId)}true{else}false{/if}, "hasCustomizedDatas": {if isset($blockcart_customizedDatas.$productId.$productAttributeId)}true{else}false{/if},
"customizedDatas":[ "customizedDatas":[
{if isset($customizedDatas.$productId.$productAttributeId)} {if isset($blockcart_customizedDatas.$productId.$productAttributeId)}
{foreach from=$customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizedDatas'}{ldelim} {foreach from=$blockcart_customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizedDatas'}{ldelim}
{* This empty line was made in purpose (product addition debug), please leave it here *} {* This empty line was made in purpose (product addition debug), please leave it here *}
"customizationId": {$id_customization}, "customizationId": {$id_customization},
@@ -80,7 +80,7 @@
], ],
"discounts": [ "discounts": [
{if $discounts}{foreach from=$discounts item=discount name='discounts'} {if $blockcart_discounts}{foreach from=$blockcart_discounts item=discount name='discounts'}
{ldelim} {ldelim}
"id": "{$discount.id_discount}", "id": "{$discount.id_discount}",
"name": "{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|addslashes|replace:'\\\'':'\''}", "name": "{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|addslashes|replace:'\\\'':'\''}",
@@ -93,19 +93,19 @@
{/foreach}{/if} {/foreach}{/if}
], ],
"shippingCost": "{$shipping_cost|html_entity_decode:2:'UTF-8'}", "shippingCost": "{$blockcart_shipping_cost|html_entity_decode:2:'UTF-8'}",
{if isset($tax_cost)} {if isset($blockcart_tax_cost)}
"taxCost": "{$tax_cost|html_entity_decode:2:'UTF-8'}", "taxCost": "{$blockcart_tax_cost|html_entity_decode:2:'UTF-8'}",
{/if} {/if}
"wrappingCost": "{$wrapping_cost|html_entity_decode:2:'UTF-8'}", "wrappingCost": "{$blockcart_wrapping_cost|html_entity_decode:2:'UTF-8'}",
"nbTotalProducts": "{$nb_total_products}", "nbTotalProducts": "{$blockcart_nb_total_products}",
"total": "{$total|html_entity_decode:2:'UTF-8'}", "total": "{$blockcart_total|html_entity_decode:2:'UTF-8'}",
"productTotal": "{$product_total|html_entity_decode:2:'UTF-8'}", "productTotal": "{$blockcart_product_total|html_entity_decode:2:'UTF-8'}",
{if isset($errors) && $errors} {if isset($blockcart_errors) && $blockcart_errors}
"hasError" : true, "hasError" : true,
"errors" : [ "errors" : [
{foreach from=$errors key=k item=error name='errors'} {foreach from=$blockcart_errors key=k item=error name='errors'}
"{$error|addslashes|html_entity_decode:2:'UTF-8'}" "{$error|addslashes|html_entity_decode:2:'UTF-8'}"
{if !$smarty.foreach.errors.last},{/if} {if !$smarty.foreach.errors.last},{/if}
{/foreach} {/foreach}
+9 -8
View File
@@ -44,7 +44,7 @@ class BlockCart extends Module
$this->description = $this->l('Adds a block containing the customer\'s shopping cart.'); $this->description = $this->l('Adds a block containing the customer\'s shopping cart.');
} }
public function smartyAssigns(&$smarty, &$params) public function assignContentVars(&$params)
{ {
global $errors; global $errors;
@@ -77,10 +77,10 @@ class BlockCart extends Module
if ($useTax AND Configuration::get('PS_TAX_DISPLAY') == 1) if ($useTax AND Configuration::get('PS_TAX_DISPLAY') == 1)
{ {
$totalToPayWithoutTaxes = $params['cart']->getOrderTotal(false); $totalToPayWithoutTaxes = $params['cart']->getOrderTotal(false);
$smarty->assign('tax_cost', Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency)); $this->smartyAssign('tax_cost', Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency));
} }
$smarty->assign(array( $this->smartyAssign(array(
'products' => $products, 'products' => $products,
'customizedDatas' => Product::getAllCustomizedDatas((int)($params['cart']->id)), 'customizedDatas' => Product::getAllCustomizedDatas((int)($params['cart']->id)),
'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_,
@@ -98,9 +98,9 @@ class BlockCart extends Module
'ajax_allowed' => (int)(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false 'ajax_allowed' => (int)(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false
)); ));
if (sizeof($errors)) if (sizeof($errors))
$smarty->assign('errors', $errors); $this->smartyAssign('errors', $errors);
if(isset($this->context->cookie->ajax_blockcart_display)) if(isset($this->context->cookie->ajax_blockcart_display))
$smarty->assign('colapseExpandStatus', $this->context->cookie->ajax_blockcart_display); $this->smartyAssign('colapseExpandStatus', $this->context->cookie->ajax_blockcart_display);
} }
public function getContent() public function getContent()
@@ -159,8 +159,9 @@ class BlockCart extends Module
if (Configuration::get('PS_CATALOG_MODE')) if (Configuration::get('PS_CATALOG_MODE'))
return; return;
$this->context->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); // @todo this variable seems not used
$this->smartyAssigns($this->context->smarty, $params); $this->smartyAssign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false);
$this->assignContentVars($params);
return $this->display(__FILE__, 'blockcart.tpl'); return $this->display(__FILE__, 'blockcart.tpl');
} }
@@ -174,7 +175,7 @@ class BlockCart extends Module
if (Configuration::get('PS_CATALOG_MODE')) if (Configuration::get('PS_CATALOG_MODE'))
return; return;
$this->smartyAssigns($this->context->smarty, $params); $this->assignContentVars($params);
$res = $this->display(__FILE__, 'blockcart-json.tpl'); $res = $this->display(__FILE__, 'blockcart-json.tpl');
return $res; return $res;
} }
+28 -28
View File
@@ -27,9 +27,9 @@
{*************************************************************************************************************************************} {*************************************************************************************************************************************}
{* IMPORTANT : If you change some data here, you have to report these changes in the ./blockcart-json.js (to let ajaxCart available) *} {* IMPORTANT : If you change some data here, you have to report these changes in the ./blockcart-json.js (to let ajaxCart available) *}
{*************************************************************************************************************************************} {*************************************************************************************************************************************}
{if $ajax_allowed} {if $blockcart_ajax_allowed}
<script type="text/javascript"> <script type="text/javascript">
var CUSTOMIZE_TEXTFIELD = {$CUSTOMIZE_TEXTFIELD}; var CUSTOMIZE_TEXTFIELD = {$blockcart_CUSTOMIZE_TEXTFIELD};
var customizationIdMessage = '{l s='Customization #' mod='blockcart' js=1}'; var customizationIdMessage = '{l s='Customization #' mod='blockcart' js=1}';
var removingLinkText = '{l s='remove this product from my cart' mod='blockcart' js=1}'; var removingLinkText = '{l s='remove this product from my cart' mod='blockcart' js=1}';
</script> </script>
@@ -38,15 +38,15 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
<!-- MODULE Block cart --> <!-- MODULE Block cart -->
<div id="cart_block" class="block exclusive"> <div id="cart_block" class="block exclusive">
<h4> <h4>
<a href="{$link->getPageLink("$order_process", true)}">{l s='Cart' mod='blockcart'}</a> <a href="{$link->getPageLink("$blockcart_order_process", true)}">{l s='Cart' mod='blockcart'}</a>
{if $ajax_allowed} {if $blockcart_ajax_allowed}
<span id="block_cart_expand" {if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !isset($colapseExpandStatus)}class="hidden"{/if}>&nbsp;</span> <span id="block_cart_expand" {if isset($blockcart_colapseExpandStatus) && $blockcart_colapseExpandStatus eq 'expanded' || !isset($blockcart_colapseExpandStatus)}class="hidden"{/if}>&nbsp;</span>
<span id="block_cart_collapse" {if isset($colapseExpandStatus) && $colapseExpandStatus eq 'collapsed'}class="hidden"{/if}>&nbsp;</span> <span id="block_cart_collapse" {if isset($blockcart_colapseExpandStatus) && $blockcart_colapseExpandStatus eq 'collapsed'}class="hidden"{/if}>&nbsp;</span>
{/if} {/if}
</h4> </h4>
<div class="block_content"> <div class="block_content">
<!-- block summary --> <!-- block summary -->
<div id="cart_block_summary" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed || !isset($colapseExpandStatus)}collapsed{else}expanded{/if}"> <div id="cart_block_summary" class="{if isset($blockcart_colapseExpandStatus) && $blockcart_colapseExpandStatus eq 'expanded' || !$blockcart_ajax_allowed || !isset($blockcart_colapseExpandStatus)}collapsed{else}expanded{/if}">
<span class="ajax_cart_quantity" {if $cart_qties <= 0}style="display:none;"{/if}>{$cart_qties}</span> <span class="ajax_cart_quantity" {if $cart_qties <= 0}style="display:none;"{/if}>{$cart_qties}</span>
<span class="ajax_cart_product_txt_s" {if $cart_qties <= 1}style="display:none"{/if}>{l s='products' mod='blockcart'}</span> <span class="ajax_cart_product_txt_s" {if $cart_qties <= 1}style="display:none"{/if}>{l s='products' mod='blockcart'}</span>
<span class="ajax_cart_product_txt" {if $cart_qties > 1}style="display:none"{/if}>{l s='product' mod='blockcart'}</span> <span class="ajax_cart_product_txt" {if $cart_qties > 1}style="display:none"{/if}>{l s='product' mod='blockcart'}</span>
@@ -54,17 +54,17 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
<span class="ajax_cart_no_product" {if $cart_qties != 0}style="display:none"{/if}>{l s='(empty)' mod='blockcart'}</span> <span class="ajax_cart_no_product" {if $cart_qties != 0}style="display:none"{/if}>{l s='(empty)' mod='blockcart'}</span>
</div> </div>
<!-- block list of products --> <!-- block list of products -->
<div id="cart_block_list" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed || !isset($colapseExpandStatus)}expanded{else}collapsed{/if}"> <div id="cart_block_list" class="{if isset($blockcart_colapseExpandStatus) && $blockcart_colapseExpandStatus eq 'expanded' || !$blockcart_ajax_allowed || !isset($blockcart_colapseExpandStatus)}expanded{else}collapsed{/if}">
{if $products} {if $blockcart_products}
<dl class="products"> <dl class="products">
{foreach from=$products item='product' name='myLoop'} {foreach from=$blockcart_products item='product' name='myLoop'}
{assign var='productId' value=$product.id_product} {assign var='productId' value=$product.id_product}
{assign var='productAttributeId' value=$product.id_product_attribute} {assign var='productAttributeId' value=$product.id_product_attribute}
<dt id="cart_block_product_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}"> <dt id="cart_block_product_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">
<span class="quantity-formated"><span class="quantity">{$product.cart_quantity}</span>x</span> <span class="quantity-formated"><span class="quantity">{$product.cart_quantity}</span>x</span>
<a class="cart_block_product_name" href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop)}" title="{$product.name|escape:html:'UTF-8'}"> <a class="cart_block_product_name" href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop)}" title="{$product.name|escape:html:'UTF-8'}">
{$product.name|truncate:13:'...'|escape:html:'UTF-8'}</a> {$product.name|truncate:13:'...'|escape:html:'UTF-8'}</a>
<span class="remove_link">{if !isset($customizedDatas.$productId.$productAttributeId)}<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product}&amp;ipa={$product.id_product_attribute}&amp;token={$static_token}")}" title="{l s='remove this product from my cart' mod='blockcart'}">&nbsp;</a>{/if}</span> <span class="remove_link">{if !isset($blockcart_customizedDatas.$productId.$productAttributeId)}<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product}&amp;ipa={$product.id_product_attribute}&amp;token={$static_token}")}" title="{l s='remove this product from my cart' mod='blockcart'}">&nbsp;</a>{/if}</span>
<span class="price">{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total`"}{else}{displayWtPrice p="`$product.total_wt`"}{/if}</span> <span class="price">{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total`"}{else}{displayWtPrice p="`$product.total_wt`"}{/if}</span>
</dt> </dt>
{if isset($product.attributes_small)} {if isset($product.attributes_small)}
@@ -73,14 +73,14 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
{/if} {/if}
<!-- Customizable datas --> <!-- Customizable datas -->
{if isset($customizedDatas.$productId.$productAttributeId)} {if isset($blockcart_customizedDatas.$productId.$productAttributeId)}
{if !isset($product.attributes_small)}<dd id="cart_block_combination_of_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">{/if} {if !isset($product.attributes_small)}<dd id="cart_block_combination_of_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">{/if}
<ul class="cart_block_customizations" id="customization_{$productId}_{$productAttributeId}"> <ul class="cart_block_customizations" id="customization_{$productId}_{$productAttributeId}">
{foreach from=$customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizations'} {foreach from=$blockcart_customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizations'}
<li name="customization"> <li name="customization">
<div class="deleteCustomizableProduct" id="deleteCustomizableProduct_{$id_customization|intval}_{$product.id_product|intval}_{$product.id_product_attribute|intval}"><a class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;token={$static_token}")}"> </a></div> <div class="deleteCustomizableProduct" id="deleteCustomizableProduct_{$id_customization|intval}_{$product.id_product|intval}_{$product.id_product_attribute|intval}"><a class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete&amp;id_product={$product.id_product|intval}&amp;ipa={$product.id_product_attribute|intval}&amp;id_customization={$id_customization}&amp;token={$static_token}")}"> </a></div>
<span class="quantity-formated"><span class="quantity">{$customization.quantity}</span>x</span>{if isset($customization.datas.$CUSTOMIZE_TEXTFIELD.0)} <span class="quantity-formated"><span class="quantity">{$customization.quantity}</span>x</span>{if isset($customization.datas.$blockcart_CUSTOMIZE_TEXTFIELD.0)}
{$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|escape:html:'UTF-8'|replace:"<br />":" "|truncate:28} {$customization.datas.$blockcart_CUSTOMIZE_TEXTFIELD.0.value|escape:html:'UTF-8'|replace:"<br />":" "|truncate:28}
{else} {else}
{l s='Customization #' mod='blockcart'}{$id_customization|intval}{l s=':' mod='blockcart'} {l s='Customization #' mod='blockcart'}{$id_customization|intval}{l s=':' mod='blockcart'}
{/if} {/if}
@@ -95,15 +95,15 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
{/foreach} {/foreach}
</dl> </dl>
{/if} {/if}
<p {if $products}class="hidden"{/if} id="cart_block_no_products">{l s='No products' mod='blockcart'}</p> <p {if $blockcart_products}class="hidden"{/if} id="cart_block_no_products">{l s='No products' mod='blockcart'}</p>
{if $discounts|@count > 0}<table id="vouchers"> {if $blockcart_discounts|@count > 0}<table id="vouchers">
<tbody> <tbody>
{foreach from=$discounts item=discount} {foreach from=$blockcart_discounts item=discount}
<tr class="bloc_cart_voucher" id="bloc_cart_voucher_{$discount.id_discount}"> <tr class="bloc_cart_voucher" id="bloc_cart_voucher_{$discount.id_discount}">
<td class="name" title="{$discount.description}">{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'}</td> <td class="name" title="{$discount.description}">{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'}</td>
<td class="price">-{if $discount.value_real != '!'}{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}{/if}</td> <td class="price">-{if $discount.value_real != '!'}{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}{/if}</td>
<td class="delete"><a href="{$link->getPageLink("$order_process", true, NULL, "deleteDiscount={$discount.id_discount}")}" title="{l s='Delete'}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" width="11" height="13" class="icon" /></a></td> <td class="delete"><a href="{$link->getPageLink("$blockcart_order_process", true, NULL, "deleteDiscount={$discount.id_discount}")}" title="{l s='Delete'}"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" width="11" height="13" class="icon" /></a></td>
</tr> </tr>
{/foreach} {/foreach}
</tbody> </tbody>
@@ -112,23 +112,23 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
<p id="cart-prices"> <p id="cart-prices">
<span>{l s='Shipping' mod='blockcart'}</span> <span>{l s='Shipping' mod='blockcart'}</span>
<span id="cart_block_shipping_cost" class="price ajax_cart_shipping_cost">{$shipping_cost}</span> <span id="cart_block_shipping_cost" class="price ajax_cart_shipping_cost">{$blockcart_shipping_cost}</span>
<br/> <br/>
{if $show_wrapping} {if $blockcart_show_wrapping}
{assign var='blockcart_cart_flag' value='Cart::ONLY_WRAPPING'|constant} {assign var='blockcart_cart_flag' value='Cart::ONLY_WRAPPING'|constant}
<span>{l s='Wrapping' mod='blockcart'}</span> <span>{l s='Wrapping' mod='blockcart'}</span>
<span id="cart_block_wrapping_cost" class="price cart_block_wrapping_cost">{if $priceDisplay == 1}{convertPrice price=$cart->getOrderTotal(false, $blockcart_cart_flag)}{else}{convertPrice price=$cart->getOrderTotal(true, $blockcart_cart_flag)}{/if}</span> <span id="cart_block_wrapping_cost" class="price cart_block_wrapping_cost">{if $priceDisplay == 1}{convertPrice price=$cart->getOrderTotal(false, $blockcart_cart_flag)}{else}{convertPrice price=$cart->getOrderTotal(true, $blockcart_cart_flag)}{/if}</span>
<br/> <br/>
{/if} {/if}
{if $show_tax && isset($tax_cost)} {if $blockcart_show_tax && isset($blockcart_tax_cost)}
<span>{l s='Tax' mod='blockcart'}</span> <span>{l s='Tax' mod='blockcart'}</span>
<span id="cart_block_tax_cost" class="price ajax_cart_tax_cost">{$tax_cost}</span> <span id="cart_block_tax_cost" class="price ajax_cart_tax_cost">{$blockcart_tax_cost}</span>
<br/> <br/>
{/if} {/if}
<span>{l s='Total' mod='blockcart'}</span> <span>{l s='Total' mod='blockcart'}</span>
<span id="cart_block_total" class="price ajax_block_cart_total">{$total}</span> <span id="cart_block_total" class="price ajax_block_cart_total">{$blockcart_total}</span>
</p> </p>
{if $use_taxes && $display_tax_label == 1 && $show_tax} {if $use_taxes && $display_tax_label == 1 && $blockcart_show_tax}
{if $priceDisplay == 0} {if $priceDisplay == 0}
<p id="cart-price-precisions"> <p id="cart-price-precisions">
{l s='Prices are tax included' mod='blockcart'} {l s='Prices are tax included' mod='blockcart'}
@@ -142,10 +142,10 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
{/if} {/if}
<p id="cart-buttons"> <p id="cart-buttons">
{capture name=step_order_process} {capture name=step_order_process}
{if $order_process == 'order'}step=1{/if} {if $blockcart_order_process == 'order'}step=1{/if}
{/capture} {/capture}
{if $order_process == 'order'}<a href="{$link->getPageLink("$order_process", true)}" class="button_small" title="{l s='Cart' mod='blockcart'}">{l s='Cart' mod='blockcart'}</a>{/if} {if $blockcart_order_process == 'order'}<a href="{$link->getPageLink("$blockcart_order_process", true)}" class="button_small" title="{l s='Cart' mod='blockcart'}">{l s='Cart' mod='blockcart'}</a>{/if}
<a href="{$link->getPageLink("$order_process", true, NULL, "{$smarty.capture.step_order_process}")}" id="button_order_cart" class="exclusive{if $order_process == 'order-opc'}_large{/if}" title="{l s='Check out' mod='blockcart'}">{l s='Check out' mod='blockcart'}</a> <a href="{$link->getPageLink("$blockcart_order_process", true, NULL, "{$smarty.capture.step_order_process}")}" id="button_order_cart" class="exclusive{if $blockcart_order_process == 'order-opc'}_large{/if}" title="{l s='Check out' mod='blockcart'}">{l s='Check out' mod='blockcart'}</a>
</p> </p>
</div> </div>
</div> </div>
+10 -15
View File
@@ -770,28 +770,24 @@ class BlockCms extends Module
return $this->_html; return $this->_html;
} }
public function hookLeftColumn() public function displayBlockCMS($column)
{ {
$this->context = Context::getContext(); $cms_titles = self::getCMStitles($column);
$cms_titles = self::getCMStitles(self::LEFT_COLUMN); $this->smartyAssign(array(
$this->context->smarty->assign(array(
'block' => 1, 'block' => 1,
'cms_titles' => $cms_titles, 'cms_titles' => $cms_titles,
'theme_dir' => _PS_THEME_DIR_
)); ));
return $this->display(__FILE__, 'blockcms.tpl'); return $this->display(__FILE__, 'blockcms.tpl');
} }
public function hookLeftColumn()
{
return $this->displayBlockCMS(self::LEFT_COLUMN);
}
public function hookRightColumn() public function hookRightColumn()
{ {
return $this->displayBlockCMS(self::RIGHT_COLUMN);
$cms_titles = self::getCMStitles(self::RIGHT_COLUMN);
$this->context->smarty->assign(array(
'block' => 1,
'cms_titles' => $cms_titles,
'theme_dir' => _PS_THEME_DIR_
));
return $this->display(__FILE__, 'blockcms.tpl');
} }
public function hookFooter() public function hookFooter()
@@ -800,10 +796,9 @@ class BlockCms extends Module
if (Configuration::get('FOOTER_BLOCK_ACTIVATION')) if (Configuration::get('FOOTER_BLOCK_ACTIVATION'))
{ {
$cms_titles = self::getCMStitlesFooter(); $cms_titles = self::getCMStitlesFooter();
$this->context->smarty->assign(array( $this->smartyAssign(array(
'block' => 0, 'block' => 0,
'cmslinks' => $cms_titles, 'cmslinks' => $cms_titles,
'theme_dir' => _PS_THEME_DIR_,
'display_stores_footer' => Configuration::get('PS_STORES_DISPLAY_FOOTER'), 'display_stores_footer' => Configuration::get('PS_STORES_DISPLAY_FOOTER'),
'display_poweredby' => ((int)Configuration::get('FOOTER_POWEREDBY') === 1 || Configuration::get('FOOTER_POWEREDBY') === false), 'display_poweredby' => ((int)Configuration::get('FOOTER_POWEREDBY') === 1 || Configuration::get('FOOTER_POWEREDBY') === false),
'footer_text' => Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id) 'footer_text' => Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id)
+6 -6
View File
@@ -24,9 +24,9 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{if $block == 1} {if $blockcms_block == 1}
<!-- Block CMS module --> <!-- Block CMS module -->
{foreach from=$cms_titles key=cms_key item=cms_title} {foreach from=$blockcms_cms_titles key=cms_key item=cms_title}
<div id="informations_block_left_{$cms_key}" class="block informations_block_left"> <div id="informations_block_left_{$cms_key}" class="block informations_block_left">
<h4><a href="{$cms_title.category_link}">{if !empty($cms_title.name)}{$cms_title.name}{else}{$cms_title.category_name}{/if}</a></h4> <h4><a href="{$cms_title.category_link}">{if !empty($cms_title.name)}{$cms_title.name}{else}{$cms_title.category_name}{/if}</a></h4>
<ul class="block_content"> <ul class="block_content">
@@ -49,16 +49,16 @@
{if !$PS_CATALOG_MODE}<li class="first_item"><a href="{$link->getPageLink('prices-drop')}" title="{l s='Specials' mod='blockcms'}">{l s='Specials' mod='blockcms'}</a></li>{/if} {if !$PS_CATALOG_MODE}<li class="first_item"><a href="{$link->getPageLink('prices-drop')}" title="{l s='Specials' mod='blockcms'}">{l s='Specials' mod='blockcms'}</a></li>{/if}
<li class="{if $PS_CATALOG_MODE}first_{/if}item"><a href="{$link->getPageLink('new-products')}" title="{l s='New products' mod='blockcms'}">{l s='New products' mod='blockcms'}</a></li> <li class="{if $PS_CATALOG_MODE}first_{/if}item"><a href="{$link->getPageLink('new-products')}" title="{l s='New products' mod='blockcms'}">{l s='New products' mod='blockcms'}</a></li>
{if !$PS_CATALOG_MODE}<li class="item"><a href="{$link->getPageLink('best-sales')}" title="{l s='Top sellers' mod='blockcms'}">{l s='Top sellers' mod='blockcms'}</a></li>{/if} {if !$PS_CATALOG_MODE}<li class="item"><a href="{$link->getPageLink('best-sales')}" title="{l s='Top sellers' mod='blockcms'}">{l s='Top sellers' mod='blockcms'}</a></li>{/if}
{if $display_stores_footer}<li class="item"><a href="{$link->getPageLink('stores')}" title="{l s='Our stores' mod='blockcms'}">{l s='Our stores' mod='blockcms'}</a></li>{/if} {if $blockcms_display_stores_footer}<li class="item"><a href="{$link->getPageLink('stores')}" title="{l s='Our stores' mod='blockcms'}">{l s='Our stores' mod='blockcms'}</a></li>{/if}
<li class="item"><a href="{$link->getPageLink('contact', true)}" title="{l s='Contact us' mod='blockcms'}">{l s='Contact us' mod='blockcms'}</a></li> <li class="item"><a href="{$link->getPageLink('contact', true)}" title="{l s='Contact us' mod='blockcms'}">{l s='Contact us' mod='blockcms'}</a></li>
{foreach from=$cmslinks item=cmslink} {foreach from=$blockcms_cmslinks item=cmslink}
{if $cmslink.meta_title != ''} {if $cmslink.meta_title != ''}
<li class="item"><a href="{$cmslink.link|addslashes}" title="{$cmslink.meta_title|escape:'htmlall':'UTF-8'}">{$cmslink.meta_title|escape:'htmlall':'UTF-8'}</a></li> <li class="item"><a href="{$cmslink.link|addslashes}" title="{$cmslink.meta_title|escape:'htmlall':'UTF-8'}">{$cmslink.meta_title|escape:'htmlall':'UTF-8'}</a></li>
{/if} {/if}
{/foreach} {/foreach}
{if $display_poweredby}<li class="last_item">{l s='Powered by' mod='blockcms'} <a href="http://www.prestashop.com">PrestaShop</a>&trade;</li>{/if} {if $blockcms_display_poweredby}<li class="last_item">{l s='Powered by' mod='blockcms'} <a href="http://www.prestashop.com">PrestaShop</a>&trade;</li>{/if}
</ul> </ul>
{$footer_text} {$blockcms_footer_text}
<!-- /MODULE Block footer --> <!-- /MODULE Block footer -->
{/if} {/if}
+6 -7
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -27,7 +27,7 @@
if (!defined('_PS_VERSION_')) if (!defined('_PS_VERSION_'))
exit; exit;
class BlockCurrencies extends Module class BlockCurrencies extends Module
{ {
public function __construct() public function __construct()
@@ -39,7 +39,7 @@ class BlockCurrencies extends Module
$this->need_instance = 0; $this->need_instance = 0;
parent::__construct(); parent::__construct();
$this->displayName = $this->l('Currency block'); $this->displayName = $this->l('Currency block');
$this->description = $this->l('Adds a block for selecting a currency.'); $this->description = $this->l('Adds a block for selecting a currency.');
} }
@@ -60,13 +60,12 @@ class BlockCurrencies extends Module
if (Configuration::get('PS_CATALOG_MODE')) if (Configuration::get('PS_CATALOG_MODE'))
return ; return ;
$currencies = Currency::getCurrencies(); if (!count(Currency::getCurrencies()))
if (!sizeof($currencies))
return ''; return '';
$this->context->smarty->assign('currencies', $currencies);
return $this->display(__FILE__, 'blockcurrencies.tpl'); return $this->display(__FILE__, 'blockcurrencies.tpl');
} }
public function hookHeader($params) public function hookHeader($params)
{ {
if (Configuration::get('PS_CATALOG_MODE')) if (Configuration::get('PS_CATALOG_MODE'))
+1 -1
View File
@@ -1,5 +1,5 @@
{* {*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
+7 -8
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -61,7 +61,7 @@ class BlockLanguages extends Module
if (!count($languages)) if (!count($languages))
return; return;
$link = new Link(); $link = new Link();
if((int)Configuration::get('PS_REWRITING_SETTINGS')) if((int)Configuration::get('PS_REWRITING_SETTINGS'))
{ {
$default_rewrite = array(); $default_rewrite = array();
@@ -72,14 +72,14 @@ class BlockLanguages extends Module
foreach ($rewrite_infos AS $infos) 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']); $default_rewrite[$infos['id_lang']] = $link->getProductLink((int)$id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int)$infos['id_lang']);
} }
if ($phpSelf == 'category.php' AND $id_category = (int)Tools::getValue('id_category')) if ($phpSelf == 'category.php' AND $id_category = (int)Tools::getValue('id_category'))
{ {
$rewrite_infos = Category::getUrlRewriteInformations((int)$id_category); $rewrite_infos = Category::getUrlRewriteInformations((int)$id_category);
foreach ($rewrite_infos AS $infos) foreach ($rewrite_infos AS $infos)
$default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int)$id_category, $infos['link_rewrite'], $infos['id_lang']); $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int)$id_category, $infos['link_rewrite'], $infos['id_lang']);
} }
if ($phpSelf == 'cms.php' AND ($id_cms = (int)Tools::getValue('id_cms') OR $id_cms_category = (int)Tools::getValue('id_cms_category'))) if ($phpSelf == 'cms.php' AND ($id_cms = (int)Tools::getValue('id_cms') OR $id_cms_category = (int)Tools::getValue('id_cms_category')))
{ {
$rewrite_infos = (isset($id_cms) AND !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category); $rewrite_infos = (isset($id_cms) AND !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
@@ -92,13 +92,12 @@ class BlockLanguages extends Module
} }
} }
if (count($default_rewrite)) if (count($default_rewrite))
$smarty->assign('lang_rewrite_urls', $default_rewrite); $this->smartyAssign('lang_rewrite_urls', $default_rewrite);
} }
$this->context->smarty->assign('languages', $languages);
return $this->display(__FILE__, 'blocklanguages.tpl'); return $this->display(__FILE__, 'blocklanguages.tpl');
} }
function hookHeader($params) function hookHeader($params)
{ {
$this->context->controller->addCSS($this->_path.'blocklanguages.css', 'all'); $this->context->controller->addCSS($this->_path.'blocklanguages.css', 'all');
+2 -2
View File
@@ -31,8 +31,8 @@
<li {if $language.iso_code == $lang_iso}class="selected_language"{/if}> <li {if $language.iso_code == $lang_iso}class="selected_language"{/if}>
{if $language.iso_code != $lang_iso} {if $language.iso_code != $lang_iso}
{assign var=indice_lang value=$language.id_lang} {assign var=indice_lang value=$language.id_lang}
{if isset($lang_rewrite_urls.$indice_lang)} {if isset($blocklanguages_lang_rewrite_urls.$indice_lang)}
<a href="{$lang_rewrite_urls.$indice_lang}" title="{$language.name}"> <a href="{$blocklanguages_lang_rewrite_urls.$indice_lang}" title="{$language.name}">
{else} {else}
<a href="{$link->getLanguageLink($language.id_lang)}" title="{$language.name}"> <a href="{$link->getLanguageLink($language.id_lang)}" title="{$language.name}">
{/if} {/if}
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -51,13 +51,12 @@ class BlockManufacturer extends Module
Configuration::updateValue('MANUFACTURER_DISPLAY_FORM', true); Configuration::updateValue('MANUFACTURER_DISPLAY_FORM', true);
return (parent::install() AND $this->registerHook('leftColumn') AND $this->registerHook('header')); return (parent::install() AND $this->registerHook('leftColumn') AND $this->registerHook('header'));
} }
function hookLeftColumn($params) function hookLeftColumn($params)
{ {
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'manufacturers' => Manufacturer::getManufacturers(), 'manufacturers' => Manufacturer::getManufacturers(),
'link' => $this->context->link,
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'),
@@ -65,12 +64,12 @@ class BlockManufacturer extends Module
)); ));
return $this->display(__FILE__, 'blockmanufacturer.tpl'); return $this->display(__FILE__, 'blockmanufacturer.tpl');
} }
function hookRightColumn($params) function hookRightColumn($params)
{ {
return $this->hookLeftColumn($params); return $this->hookLeftColumn($params);
} }
function getContent() function getContent()
{ {
$output = '<h2>'.$this->displayName.'</h2>'; $output = '<h2>'.$this->displayName.'</h2>';
@@ -96,7 +95,7 @@ class BlockManufacturer extends Module
} }
return $output.$this->displayForm(); return $output.$this->displayForm();
} }
public function displayForm() public function displayForm()
{ {
$output = ' $output = '
@@ -124,9 +123,9 @@ class BlockManufacturer extends Module
</form>'; </form>';
return $output; return $output;
} }
function hookHeader($params) function hookHeader($params)
{ {
$this->context->controller->addCSS(($this->_path).'blockmanufacturer.css', 'all'); $this->context->controller->addCSS(($this->_path).'blockmanufacturer.css', 'all');
} }
} }
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -99,16 +99,20 @@ class BlockNewProducts extends Module
$newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR'))); $newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR')));
if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
return; return;
$this->context->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
$this->smartyAssign(array(
'new_products' => $newProducts,
'mediumSize' => Image::getSize('medium'),
));
return $this->display(__FILE__, 'blocknewproducts.tpl'); return $this->display(__FILE__, 'blocknewproducts.tpl');
} }
public function hookLeftColumn($params) public function hookLeftColumn($params)
{ {
return $this->hookRightColumn($params); return $this->hookRightColumn($params);
} }
public function hookHeader($params) public function hookHeader($params)
{ {
$this->context->controller->addCSS(($this->_path).'blocknewproducts.css', 'all'); $this->context->controller->addCSS(($this->_path).'blocknewproducts.css', 'all');
@@ -1,5 +1,5 @@
{* {*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -28,16 +28,16 @@
<div id="new-products_block_right" class="block products_block"> <div id="new-products_block_right" class="block products_block">
<h4><a href="{$link->getPageLink('new-products')}" title="{l s='New products' mod='blocknewproducts'}">{l s='New products' mod='blocknewproducts'}</a></h4> <h4><a href="{$link->getPageLink('new-products')}" title="{l s='New products' mod='blocknewproducts'}">{l s='New products' mod='blocknewproducts'}</a></h4>
<div class="block_content"> <div class="block_content">
{if $new_products !== false} {if $blocknewproducts_new_products !== false}
<ul class="product_images clearfix"> <ul class="product_images clearfix">
{foreach from=$new_products item='product' name='newProducts'} {foreach from=$blocknewproducts_new_products item='product' name='newProducts'}
{if $smarty.foreach.newProducts.index < 2} {if $smarty.foreach.newProducts.index < 2}
<li{if $smarty.foreach.newProducts.first} class="first"{/if}><a href="{$product.link}" title="{$product.legend|escape:html:'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$product.legend|escape:html:'UTF-8'}" /></a></li> <li{if $smarty.foreach.newProducts.first} class="first"{/if}><a href="{$product.link}" title="{$product.legend|escape:html:'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'medium')}" height="{$blocknewproducts_mediumSize.height}" width="{$blocknewproducts_mediumSize.width}" alt="{$product.legend|escape:html:'UTF-8'}" /></a></li>
{/if} {/if}
{/foreach} {/foreach}
</ul> </ul>
<dl class="products"> <dl class="products">
{foreach from=$new_products item=newproduct name=myLoop} {foreach from=$blocknewproducts_new_products item=newproduct name=myLoop}
<dt class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}"><a href="{$newproduct.link}" title="{$newproduct.name|escape:html:'UTF-8'}">{$newproduct.name|strip_tags|escape:html:'UTF-8'}</a></dt> <dt class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}"><a href="{$newproduct.link}" title="{$newproduct.name|escape:html:'UTF-8'}">{$newproduct.name|strip_tags|escape:html:'UTF-8'}</a></dt>
{if $newproduct.description_short}<dd class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}"><a href="{$newproduct.link}">{$newproduct.description_short|strip_tags:'UTF-8'|truncate:50:'...'}</a>&nbsp;<a href="{$newproduct.link}"><img src="{$img_dir}bullet.gif" alt="&gt;&gt;" width="10" height="7" /></a></dd>{/if} {if $newproduct.description_short}<dd class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}"><a href="{$newproduct.link}">{$newproduct.description_short|strip_tags:'UTF-8'|truncate:50:'...'}</a>&nbsp;<a href="{$newproduct.link}"><img src="{$img_dir}bullet.gif" alt="&gt;&gt;" width="10" height="7" /></a></dd>{/if}
{/foreach} {/foreach}
+8 -7
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -27,7 +27,7 @@
if (!defined('_PS_VERSION_')) if (!defined('_PS_VERSION_'))
exit; exit;
class BlockSpecials extends Module class BlockSpecials extends Module
{ {
private $_html = ''; private $_html = '';
@@ -89,20 +89,21 @@ class BlockSpecials extends Module
if (!$special = Product::getRandomSpecial((int)$params['cookie']->id_lang) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) if (!$special = Product::getRandomSpecial((int)$params['cookie']->id_lang) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY'))
return; return;
$this->context->smarty->assign(array(
$this->smartyAssign(array(
'special' => $special, 'special' => $special,
'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2),
'mediumSize' => Image::getSize('medium') 'mediumSize' => Image::getSize('medium'),
)); ));
return $this->display(__FILE__, 'blockspecials.tpl'); return $this->display(__FILE__, 'blockspecials.tpl');
} }
public function hookLeftColumn($params) public function hookLeftColumn($params)
{ {
return $this->hookRightColumn($params); return $this->hookRightColumn($params);
} }
public function hookHeader($params) public function hookHeader($params)
{ {
if (Configuration::get('PS_CATALOG_MODE')) if (Configuration::get('PS_CATALOG_MODE'))
+7 -7
View File
@@ -29,22 +29,22 @@
<h4><a href="{$link->getPageLink('prices-drop')}" title="{l s='Specials' mod='blockspecials'}">{l s='Specials' mod='blockspecials'}</a></h4> <h4><a href="{$link->getPageLink('prices-drop')}" title="{l s='Specials' mod='blockspecials'}">{l s='Specials' mod='blockspecials'}</a></h4>
<div class="block_content"> <div class="block_content">
{if $special} {if $blockspecials_special}
<ul class="products"> <ul class="products">
<li class="product_image"> <li class="product_image">
<a href="{$special.link}"><img src="{$link->getImageLink($special.link_rewrite, $special.id_image, 'medium')}" alt="{$special.legend|escape:html:'UTF-8'}" height="{$mediumSize.height}" width="{$mediumSize.width}" title="{$special.name|escape:html:'UTF-8'}" /></a> <a href="{$blockspecials_special.link}"><img src="{$link->getImageLink($blockspecials_special.link_rewrite, $blockspecials_special.id_image, 'medium')}" alt="{$blockspecials_special.legend|escape:html:'UTF-8'}" height="{$blockspecials_mediumSize.height}" width="{$blockspecials_mediumSize.width}" title="{$blockspecials_special.name|escape:html:'UTF-8'}" /></a>
</li> </li>
<li> <li>
<h5><a href="{$special.link}" title="{$special.name|escape:html:'UTF-8'}">{$special.name|escape:html:'UTF-8'}</a></h5> <h5><a href="{$blockspecials_special.link}" title="{$blockspecials_special.name|escape:html:'UTF-8'}">{$blockspecials_special.name|escape:html:'UTF-8'}</a></h5>
<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$special.price_without_reduction}{else}{displayWtPrice p=$priceWithoutReduction_tax_excl}{/if}</span> <span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$blockspecials_special.price_without_reduction}{else}{displayWtPrice p=$blockspecials_priceWithoutReduction_tax_excl}{/if}</span>
{if $special.specific_prices} {if $blockspecials_special.specific_prices}
{assign var='specific_prices' value=$special.specific_prices} {assign var='specific_prices' value=$blockspecials_special.specific_prices}
{if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))} {if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))}
<span class="reduction">(-{$specific_prices.reduction*100|floatval}%)</span> <span class="reduction">(-{$specific_prices.reduction*100|floatval}%)</span>
{/if} {/if}
{/if} {/if}
<span class="price">{if !$priceDisplay}{displayWtPrice p=$special.price}{else}{displayWtPrice p=$special.price_tax_exc}{/if}</span> <span class="price">{if !$priceDisplay}{displayWtPrice p=$blockspecials_special.price}{else}{displayWtPrice p=$blockspecials_special.price_tax_exc}{/if}</span>
</li> </li>
</ul> </ul>
<p> <p>
+5 -4
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -39,7 +39,7 @@ class BlockUserInfo extends Module
$this->need_instance = 0; $this->need_instance = 0;
parent::__construct(); parent::__construct();
$this->displayName = $this->l('User info block'); $this->displayName = $this->l('User info block');
$this->description = $this->l('Adds a block that displays information about the customer.'); $this->description = $this->l('Adds a block that displays information about the customer.');
} }
@@ -59,7 +59,8 @@ class BlockUserInfo extends Module
{ {
if (!$this->active) if (!$this->active)
return; return;
$this->context->smarty->assign(array(
$this->smartyAssign(array(
'cart' => $this->context->cart, 'cart' => $this->context->cart,
'cart_qties' => $this->context->cart->nbProducts(), 'cart_qties' => $this->context->cart->nbProducts(),
'logged' => $this->context->customer->isLogged(), 'logged' => $this->context->customer->isLogged(),
@@ -70,7 +71,7 @@ class BlockUserInfo extends Module
)); ));
return $this->display(__FILE__, 'blockuserinfo.tpl'); return $this->display(__FILE__, 'blockuserinfo.tpl');
} }
public function hookHeader($params) public function hookHeader($params)
{ {
$this->context->controller->addCSS(($this->_path).'blockuserinfo.css', 'all'); $this->context->controller->addCSS(($this->_path).'blockuserinfo.css', 'all');
+12 -12
View File
@@ -1,5 +1,5 @@
{* {*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -28,8 +28,8 @@
<div id="header_user"> <div id="header_user">
<p id="header_user_info"> <p id="header_user_info">
{l s='Welcome' mod='blockuserinfo'}, {l s='Welcome' mod='blockuserinfo'},
{if $logged} {if $blockuserinfo_logged}
<span>{$firstName} {$lastName}</span> <span>{$blockuserinfo_firstName} {$blockuserinfo_lastName}</span>
(<a href="{$link->getPageLink('index', true, NULL, "mylogout")}" title="{l s='Log me out' mod='blockuserinfo'}">{l s='Log out' mod='blockuserinfo'}</a>) (<a href="{$link->getPageLink('index', true, NULL, "mylogout")}" title="{l s='Log me out' mod='blockuserinfo'}">{l s='Log out' mod='blockuserinfo'}</a>)
{else} {else}
<a href="{$link->getPageLink('my-account', true)}">{l s='Log in' mod='blockuserinfo'}</a> <a href="{$link->getPageLink('my-account', true)}">{l s='Log in' mod='blockuserinfo'}</a>
@@ -38,22 +38,22 @@
<ul id="header_nav"> <ul id="header_nav">
{if !$PS_CATALOG_MODE} {if !$PS_CATALOG_MODE}
<li id="shopping_cart"> <li id="shopping_cart">
<a href="{$link->getPageLink("$order_process", true)}" title="{l s='Your Shopping Cart' mod='blockuserinfo'}">{l s='Cart:' mod='blockuserinfo'}</a> <a href="{$link->getPageLink("$blockuserinfo_order_process", true)}" title="{l s='Your Shopping Cart' mod='blockuserinfo'}">{l s='Cart:' mod='blockuserinfo'}</a>
<span class="ajax_cart_quantity{if $cart_qties == 0} hidden{/if}">{$cart_qties}</span> <span class="ajax_cart_quantity{if $blockuserinfo_cart_qties == 0} hidden{/if}">{$blockuserinfo_cart_qties}</span>
<span class="ajax_cart_product_txt{if $cart_qties != 1} hidden{/if}">{l s='product' mod='blockuserinfo'}</span> <span class="ajax_cart_product_txt{if $blockuserinfo_cart_qties != 1} hidden{/if}">{l s='product' mod='blockuserinfo'}</span>
<span class="ajax_cart_product_txt_s{if $cart_qties < 2} hidden{/if}">{l s='products' mod='blockuserinfo'}</span> <span class="ajax_cart_product_txt_s{if $blockuserinfo_cart_qties < 2} hidden{/if}">{l s='products' mod='blockuserinfo'}</span>
{if $cart_qties >= 0} {if $blockuserinfo_cart_qties >= 0}
<span class="ajax_cart_total{if $cart_qties == 0} hidden{/if}"> <span class="ajax_cart_total{if $blockuserinfo_cart_qties == 0} hidden{/if}">
{if $priceDisplay == 1} {if $priceDisplay == 1}
{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant} {assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
{convertPrice price=$cart->getOrderTotal(false, $blockuser_cart_flag)} {convertPrice price=$blockuserinfo_cart->getOrderTotal(false, $blockuser_cart_flag)}
{else} {else}
{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant} {assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
{convertPrice price=$cart->getOrderTotal(true, $blockuser_cart_flag)} {convertPrice price=$blockuserinfo_cart->getOrderTotal(true, $blockuser_cart_flag)}
{/if} {/if}
</span> </span>
{/if} {/if}
<span class="ajax_cart_no_product{if $cart_qties > 0} hidden{/if}">{l s='(empty)' mod='blockuserinfo'}</span> <span class="ajax_cart_no_product{if $blockuserinfo_cart_qties > 0} hidden{/if}">{l s='(empty)' mod='blockuserinfo'}</span>
</li> </li>
{/if} {/if}
<li id="your_account"><a href="{$link->getPageLink('my-account', true)}" title="{l s='Your Account' mod='blockuserinfo'}">{l s='Your Account' mod='blockuserinfo'}</a></li> <li id="your_account"><a href="{$link->getPageLink('my-account', true)}" title="{l s='Your Account' mod='blockuserinfo'}">{l s='Your Account' mod='blockuserinfo'}</a></li>
+9 -7
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -42,7 +42,7 @@ class HomeFeatured extends Module
$this->need_instance = 0; $this->need_instance = 0;
parent::__construct(); parent::__construct();
$this->displayName = $this->l('Featured Products on the homepage'); $this->displayName = $this->l('Featured Products on the homepage');
$this->description = $this->l('Displays Featured Products in the middle of your homepage.'); $this->description = $this->l('Displays Featured Products in the middle of your homepage.');
} }
@@ -82,7 +82,7 @@ class HomeFeatured extends Module
<div class="margin-form"> <div class="margin-form">
<input type="text" size="5" name="nbr" value="'.Tools::getValue('nbr', (int)(Configuration::get('HOME_FEATURED_NBR'))).'" /> <input type="text" size="5" name="nbr" value="'.Tools::getValue('nbr', (int)(Configuration::get('HOME_FEATURED_NBR'))).'" />
<p class="clear">'.$this->l('The number of products displayed on homepage (default: 10).').'</p> <p class="clear">'.$this->l('The number of products displayed on homepage (default: 10).').'</p>
</div> </div>
<center><input type="submit" name="submitHomeFeatured" value="'.$this->l('Save').'" class="button" /></center> <center><input type="submit" name="submitHomeFeatured" value="'.$this->l('Save').'" class="button" /></center>
</fieldset> </fieldset>
@@ -95,10 +95,12 @@ class HomeFeatured extends Module
$category = new Category(Context::getContext()->shop->getCategory(), Configuration::get('PS_LANG_DEFAULT')); $category = new Category(Context::getContext()->shop->getCategory(), Configuration::get('PS_LANG_DEFAULT'));
$nb = (int)(Configuration::get('HOME_FEATURED_NBR')); $nb = (int)(Configuration::get('HOME_FEATURED_NBR'));
$products = $category->getProducts($params['cookie']->id_lang, 1, ($nb ? $nb : 10)); $products = $category->getProducts($params['cookie']->id_lang, 1, ($nb ? $nb : 10));
$this->context->smarty->assign(array(
'products' => $products, $this->smartyAssign(array(
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'products' => $products,
'homeSize' => Image::getSize('home'))); 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
'homeSize' => Image::getSize('home'),
));
return $this->display(__FILE__, 'homefeatured.tpl'); return $this->display(__FILE__, 'homefeatured.tpl');
} }
+6 -6
View File
@@ -1,5 +1,5 @@
{* {*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -27,23 +27,23 @@
<!-- MODULE Home Featured Products --> <!-- MODULE Home Featured Products -->
<div id="featured-products_block_center" class="block products_block"> <div id="featured-products_block_center" class="block products_block">
<h4>{l s='Featured products' mod='homefeatured'}</h4> <h4>{l s='Featured products' mod='homefeatured'}</h4>
{if isset($products) AND $products} {if isset($homefeatured_products) AND $homefeatured_products}
<div class="block_content"> <div class="block_content">
{assign var='liHeight' value=342} {assign var='liHeight' value=342}
{assign var='nbItemsPerLine' value=4} {assign var='nbItemsPerLine' value=4}
{assign var='nbLi' value=$products|@count} {assign var='nbLi' value=$homefeatured_products|@count}
{math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines} {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
{math equation="nbLines*liHeight" nbLines=$nbLines|ceil liHeight=$liHeight assign=ulHeight} {math equation="nbLines*liHeight" nbLines=$nbLines|ceil liHeight=$liHeight assign=ulHeight}
<ul style="height:{$ulHeight}px;"> <ul style="height:{$ulHeight}px;">
{foreach from=$products item=product name=homeFeaturedProducts} {foreach from=$homefeatured_products item=product name=homeFeaturedProducts}
<li class="ajax_block_product {if $smarty.foreach.homeFeaturedProducts.first}first_item{elseif $smarty.foreach.homeFeaturedProducts.last}last_item{else}item{/if} {if $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 0}last_item_of_line{elseif $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 1}clear{/if} {if $smarty.foreach.homeFeaturedProducts.iteration > ($smarty.foreach.homeFeaturedProducts.total - ($smarty.foreach.homeFeaturedProducts.total % $nbItemsPerLine))}last_line{/if}"> <li class="ajax_block_product {if $smarty.foreach.homeFeaturedProducts.first}first_item{elseif $smarty.foreach.homeFeaturedProducts.last}last_item{else}item{/if} {if $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 0}last_item_of_line{elseif $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 1}clear{/if} {if $smarty.foreach.homeFeaturedProducts.iteration > ($smarty.foreach.homeFeaturedProducts.total - ($smarty.foreach.homeFeaturedProducts.total % $nbItemsPerLine))}last_line{/if}">
<h5><a href="{$product.link}" title="{$product.name|truncate:32:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'}</a></h5> <h5><a href="{$product.link}" title="{$product.name|truncate:32:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'}</a></h5>
<div class="product_desc"><a href="{$product.link}" title="{l s='More' mod='homefeatured'}">{$product.description_short|strip_tags|truncate:130:'...'}</a></div> <div class="product_desc"><a href="{$product.link}" title="{l s='More' mod='homefeatured'}">{$product.description_short|strip_tags|truncate:130:'...'}</a></div>
<a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" /></a> <a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homefeatured_homeSize.height}" width="{$homefeatured_homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" /></a>
<div> <div>
{if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<p class="price_container"><span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></p>{else}<div style="height:21px;"></div>{/if} {if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<p class="price_container"><span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></p>{else}<div style="height:21px;"></div>{/if}
<a class="button" href="{$product.link}" title="{l s='View' mod='homefeatured'}">{l s='View' mod='homefeatured'}</a> <a class="button" href="{$product.link}" title="{l s='View' mod='homefeatured'}">{l s='View' mod='homefeatured'}</a>
{if ($product.id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product.available_for_order AND !isset($restricted_country_mode) AND $product.minimal_quantity == 1 AND $product.customizable != 2 AND !$PS_CATALOG_MODE} {if ($product.id_product_attribute == 0 OR (isset($homefeatured_add_prod_display) AND ($homefeatured_add_prod_display == 1))) AND $product.available_for_order AND !isset($restricted_country_mode) AND $product.minimal_quantity == 1 AND $product.customizable != 2 AND !$PS_CATALOG_MODE}
{if ($product.quantity > 0 OR $product.allow_oosp)} {if ($product.quantity > 0 OR $product.allow_oosp)}
<a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart', true, NULL, "qty=1&amp;id_product={$product.id_product}&amp;token={$static_token}&amp;add")}" title="{l s='Add to cart' mod='homefeatured'}">{l s='Add to cart' mod='homefeatured'}</a> <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart', true, NULL, "qty=1&amp;id_product={$product.id_product}&amp;token={$static_token}&amp;add")}" title="{l s='Add to cart' mod='homefeatured'}">{l s='Add to cart' mod='homefeatured'}</a>
{else} {else}