This commit is contained in:
sLorenzini
2013-12-05 17:59:25 +01:00
3 changed files with 158 additions and 156 deletions
+2 -1
View File
@@ -314,7 +314,8 @@ class ConfigurationCore extends ObjectModel
$result = true; $result = true;
foreach ($values as $lang => $value) foreach ($values as $lang => $value)
{ {
if ($value === Configuration::get($key, $lang, $id_shop_group, $id_shop)) $stored_value = Configuration::get($key, $lang, $id_shop_group, $id_shop);
if ((!is_numeric($value) && $value === $stored_value) || (is_numeric($value) && $value == $stored_value))
continue; continue;
// If key already exists, update value // If key already exists, update value
+5 -6
View File
@@ -422,16 +422,19 @@ class ToolsCore
$cookie->id_currency = (int)$currency->id; $cookie->id_currency = (int)$currency->id;
} }
$currency = Currency::getCurrencyInstance(Configuration::get('PS_CURRENCY_DEFAULT'));
if ((int)$cookie->id_currency) if ((int)$cookie->id_currency)
{
$currency = Currency::getCurrencyInstance((int)$cookie->id_currency); $currency = Currency::getCurrencyInstance((int)$cookie->id_currency);
if (is_object($currency) && (int)$currency->id && (int)$currency->deleted != 1 && $currency->active) if (is_object($currency) && (int)$currency->id && (int)$currency->deleted != 1 && $currency->active)
{
$cookie->id_currency = (int)$currency->id;
if ($currency->isAssociatedToShop()) if ($currency->isAssociatedToShop())
return $currency; return $currency;
else else
{ {
// get currency from context // get currency from context
$currency = Shop::getEntityIds('currency', Context::getContext()->shop->id); $currency = Shop::getEntityIds('currency', Context::getContext()->shop->id, true, true);
if (isset($currency[0]) && $currency[0]['id_currency']) if (isset($currency[0]) && $currency[0]['id_currency'])
{ {
$cookie->id_currency = $currency[0]['id_currency']; $cookie->id_currency = $currency[0]['id_currency'];
@@ -439,10 +442,6 @@ class ToolsCore
} }
} }
} }
$currency = Currency::getCurrencyInstance(Configuration::get('PS_CURRENCY_DEFAULT'));
if (is_object($currency) && $currency->id)
$cookie->id_currency = (int)$currency->id;
return $currency; return $currency;
} }
@@ -28,16 +28,16 @@
<h1 class="page-heading">{l s='Product Comparison'}</h1> <h1 class="page-heading">{l s='Product Comparison'}</h1>
{if $hasProduct} {if $hasProduct}
<script type="text/javascript"> <script type="text/javascript">
$('document').ready(function(){ $('document').ready(function(){
if (typeof reloadProductComparison != 'undefined') if (typeof reloadProductComparison != 'undefined')
reloadProductComparison() reloadProductComparison()
}); });
</script> </script>
<div class="products_block table-responsive"> <div class="products_block table-responsive">
<table id="product_comparison" class="table table-bordered"> <table id="product_comparison" class="table table-bordered">
<tr> <tr>
<td width="20%" class="td_empty compare_extra_information"> <td class="td_empty compare_extra_information">
{$HOOK_COMPARE_EXTRA_INFORMATION} {$HOOK_COMPARE_EXTRA_INFORMATION}
<span>{l s='Features:'}</span> <span>{l s='Features:'}</span>
</td> </td>
@@ -47,13 +47,12 @@
{/if} {/if}
{foreach from=$products item=product name=for_products} {foreach from=$products item=product name=for_products}
{assign var='replace_id' value=$product->id|cat:'|'} {assign var='replace_id' value=$product->id|cat:'|'}
<td class="ajax_block_product comparison_infos product-block">
<td width="{$width}%" class="ajax_block_product comparison_infos product-block">
<div class="remove"> <div class="remove">
<a class="cmp_remove" href="{$link->getPageLink('products-comparison', true)|escape:'html'}" title="{l s='Remove'}" data-id-product="{$product->id}"><i class="icon-trash"></i></a> <a class="cmp_remove" href="{$link->getPageLink('products-comparison', true)|escape:'html'}" title="{l s='Remove'}" data-id-product="{$product->id}"><i class="icon-trash"></i></a>
</div> </div>
<div class="product-image-block"> <div class="product-image-block">
<a href="{$product->getLink()}" title="{$product->name|escape:html:'UTF-8'}" class="product_image" > <a href="{$product->getLink()|escape:html:'UTF-8'}" title="{$product->name|escape:html:'UTF-8'}" class="product_image" >
<img class="img-responsive" src="{$link->getImageLink($product->link_rewrite, $product->id_image, 'home_default')|escape:'html'}" alt="{$product->name|escape:html:'UTF-8'}" /> <img class="img-responsive" src="{$link->getImageLink($product->link_rewrite, $product->id_image, 'home_default')|escape:'html'}" alt="{$product->name|escape:html:'UTF-8'}" />
</a> </a>
{if isset($product->show_price) && $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE} {if isset($product->show_price) && $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
@@ -61,8 +60,12 @@
<div class="sale-box"><span class="sale-label">{l s='Sale!'}</span></div> <div class="sale-box"><span class="sale-label">{l s='Sale!'}</span></div>
{/if} {/if}
{/if} {/if}
</div> </div> <!-- end product-image-block -->
<h5><a class="product-name" href="{$product->getLink()}" title="{$product->name|truncate:32:'...'|escape:'html':'UTF-8'}">{$product->name|truncate:45:'...'|escape:'html':'UTF-8'}</a></h5> <h5>
<a class="product-name" href="{$product->getLink()|escape:html:'UTF-8'}" title="{$product->name|truncate:32:'...'|escape:'html':'UTF-8'}">
{$product->name|truncate:45:'...'|escape:'html':'UTF-8'}
</a>
</h5>
<div class="prices-container"> <div class="prices-container">
{if isset($product->show_price) && $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE} {if isset($product->show_price) && $product->show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
<span class="price product-price">{convertPrice price=$product->getPrice($taxes_behavior)}</span> <span class="price product-price">{convertPrice price=$product->getPrice($taxes_behavior)}</span>
@@ -81,14 +84,14 @@
<span class="reduced-price">{l s='Reduced price!'}</span> <span class="reduced-price">{l s='Reduced price!'}</span>
</div> </div>
{/if} {/if}
{if !empty($product->unity) && $product->unit_price_ratio > 0.000000} {if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
{math equation="pprice / punit_price" pprice=$product->getPrice($taxes_behavior) punit_price=$product->unit_price_ratio assign=unit_price} {math equation="pprice / punit_price" pprice=$product->getPrice($taxes_behavior) punit_price=$product->unit_price_ratio assign=unit_price}
<span class="comparison_unit_price">&nbsp;{convertPrice price=$unit_price} {l s='per %s' sprintf=$product->unity|escape:'html':'UTF-8'}</span> <span class="comparison_unit_price">&nbsp;{convertPrice price=$unit_price} {l s='per %s' sprintf=$product->unity|escape:'html':'UTF-8'}</span>
{else} {else}
{/if} {/if}
{/if} {/if}
</div> </div> <!-- end prices-container -->
<div class="product_desc">{$product->description_short|strip_tags|truncate:60:'...'}</div> <div class="product_desc">{$product->description_short|strip_tags|truncate:60:'...'}</div>
<div class="comparison_product_infos"> <div class="comparison_product_infos">
@@ -123,14 +126,11 @@
{else} {else}
<span class="ajax_add_to_cart_button button btn btn-default disabled"><span>{l s='Add to cart'}</span></span> <span class="ajax_add_to_cart_button button btn btn-default disabled"><span>{l s='Add to cart'}</span></span>
{/if} {/if}
{else}
{/if} {/if}
<a class="button lnk_view btn btn-default" href="{$product->getLink()}" title="{l s='View'}"><span>{l s='View'}</span></a> <a class="button lnk_view btn btn-default" href="{$product->getLink()|escape:html:'UTF-8'}" title="{l s='View'}"><span>{l s='View'}</span></a>
</div> </div>
</div> </div>
</div> <!-- end comparison_product_infos -->
</div>
</td> </td>
{/foreach} {/foreach}
</tr> </tr>
@@ -141,15 +141,14 @@
<td class="{$classname} feature-name" > <td class="{$classname} feature-name" >
<strong>{$feature.name|escape:'html':'UTF-8'}</strong> <strong>{$feature.name|escape:'html':'UTF-8'}</strong>
</td> </td>
{foreach from=$products item=product name=for_products} {foreach from=$products item=product name=for_products}
{assign var='product_id' value=$product->id} {assign var='product_id' value=$product->id}
{assign var='feature_id' value=$feature.id_feature} {assign var='feature_id' value=$feature.id_feature}
{if isset($product_features[$product_id])} {if isset($product_features[$product_id])}
{assign var='tab' value=$product_features[$product_id]} {assign var='tab' value=$product_features[$product_id]}
<td width="{$width}%" class="{$classname} comparison_infos">{if (isset($tab[$feature_id]))}{$tab[$feature_id]|escape:'html':'UTF-8'}{/if}</td> <td class="{$classname} comparison_infos">{if (isset($tab[$feature_id]))}{$tab[$feature_id]|escape:'html':'UTF-8'}{/if}</td>
{else} {else}
<td width="{$width}%" class="{$classname} comparison_infos"></td> <td class="{$classname} comparison_infos"></td>
{/if} {/if}
{/foreach} {/foreach}
</tr> </tr>
@@ -157,16 +156,19 @@
{else} {else}
<tr> <tr>
<td></td> <td></td>
<td colspan="{$products|@count + 1}">{l s='No features to compare'}</td> <td colspan="{$products|@count}" class="text-center">{l s='No features to compare'}</td>
</tr> </tr>
{/if} {/if}
{$HOOK_EXTRA_PRODUCT_COMPARISON} {$HOOK_EXTRA_PRODUCT_COMPARISON}
</table> </table>
</div> </div> <!-- end products_block -->
{else} {else}
<p class="alert alert-warning">{l s='There are no products selected for comparison.'}</p> <p class="alert alert-warning">{l s='There are no products selected for comparison.'}</p>
{/if} {/if}
<ul class="footer_link"> <ul class="footer_link">
<li><a class="button lnk_view btn btn-default" href="{$base_dir}"><span><i class="icon-chevron-left left"></i>{l s='Continue Shopping'}</span></a></li> <li>
<a class="button lnk_view btn btn-default" href="{$base_dir}">
<span><i class="icon-chevron-left left"></i>{l s='Continue Shopping'}</span>
</a>
</li>
</ul> </ul>