// merge 1.4 (5397)
This commit is contained in:
@@ -4,8 +4,9 @@
|
||||
<displayName>Authorize.net AIM (Advanced Integration Method)</displayName>
|
||||
<version>1.0</version>
|
||||
<description>Receive payment with Authorize.net</description>
|
||||
<author></author>
|
||||
<author>PrestaShop</author>
|
||||
<tab>payments_gateways</tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries>us</limited_countries>
|
||||
</module>
|
||||
@@ -4,7 +4,7 @@ global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_c2796655c25e1b0b8582716036aece08'] = 'Regalo de cumpleaños';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_d1f5899bf2af57ed816390d9d740daf6'] = 'Haga a sus clientes regalos de cumpleaños automáticamente';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_42f95f1b218dda65c23c52fcb205f1ed'] = 'Cree un vale descuento para los clientes que celebren su cumpleaños y que pueda usarse una sola vez';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_ccfcf858237a83953c1ac03b5abde35e'] = 'Crear un bono para los clientes que celebran su cumpleaños y que tiene por lo menos un pedido válido';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_4d3d769b812b6faa6b76e1a8abaece2d'] = 'Activo';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_52292d2f9c39936bc72fbd47a3060df3'] = 'Adicionalemente, debe establecer una regla CRON que pida el archivo';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_f7e78e04cba74c610354e91e622cc105'] = 'todos los días';
|
||||
@@ -24,5 +24,5 @@ $_MODULE['<{birthdaypresent}prestashop>birthdaypresent_7b6ac3f2cdb42a4462ff7ca3c
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_410008089d5bb723438103a84d48a59c'] = 'Para alcanzar este objetivo usted puede organizar:';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_3e788301a1b0ce341aa5ce15bc520545'] = 'Operaciones puntuales: recompensas comerciales (ofertas especiales personalizadas, producto o servicios ofrecidos), recompensas no comerciales (prioridad en el envío de un pedido o de un producto), recompensas pecuniarias (enlaces, cupones del descuento, prioridad en el reembolso...).';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_f299b58558601a85c98a2d1d7867d523'] = 'Operaciones sostenibles: las tarjetas de fidelidad o de puntos, que no sólo justifican la comunicación entre el comerciante y el cliente, pero también ofrecen ventajas a los clientes (ofertas, descuentos privados).';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_2ac84f3e753fa299ebe4a6dfe57f1d9c'] = 'Estas operaciones animan a los clientes a comprar y también a volver a la tienda virtual regularmente.';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_38241c5ab16ef8f1ba73460ecd0469e8'] = '¡Su regalo de cumpleaños!';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_d434c183a411611f50fa7e121b0f6565'] = 'Estas operaciones animan a los clientes a comprar y también a volver a su tienda en línea frecuentemente.';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_d46bd07675d08116e85f8a4c7866de53'] = '¡Su regalo de cumpleaños!';
|
||||
|
||||
@@ -4,6 +4,7 @@ global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_c2796655c25e1b0b8582716036aece08'] = 'Cadeau d\'anniversaire';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_d1f5899bf2af57ed816390d9d740daf6'] = 'Offrez automatiquement à vos clients des cadeaux d\'anniversaire';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_ccfcf858237a83953c1ac03b5abde35e'] = 'Créer un bon de réduction pour les clients fêtant leur anniversaire et ayant au moins une commande valide';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_4d3d769b812b6faa6b76e1a8abaece2d'] = 'Actif';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_52292d2f9c39936bc72fbd47a3060df3'] = 'De plus, vous devez installer une règle CRON qui appellera le fichier';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_f7e78e04cba74c610354e91e622cc105'] = 'chaque jour';
|
||||
@@ -23,3 +24,5 @@ $_MODULE['<{birthdaypresent}prestashop>birthdaypresent_7b6ac3f2cdb42a4462ff7ca3c
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_410008089d5bb723438103a84d48a59c'] = 'Pour y parvenir, plusieurs moyens existent :';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_3e788301a1b0ce341aa5ce15bc520545'] = 'Les opérations ponctuelles : les récompenses marchandes (offres promotionnelles ciblées et personnalisées, cadeaux -produit ou service offert-), les récompenses non marchandes (traitement prioritaire d\'une commande ou d\'un produit), les récompenses pécuniaires (bons d\'achat, de réduction, de remboursement). ';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_f299b58558601a85c98a2d1d7867d523'] = 'Les opérations pérennes : (carte de fidélité, points de fidélité) qui non seulement justifient la communication marchand-clients, et aussi offre des avantages aux clients (offres privatives, réductions).';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_d434c183a411611f50fa7e121b0f6565'] = 'Ces opérations encouragent les clients à acheter et aussi à revenir sur votre boutique en ligne régulièrement.';
|
||||
$_MODULE['<{birthdaypresent}prestashop>birthdaypresent_d46bd07675d08116e85f8a4c7866de53'] = 'Votre cadeau d\'anniversaire !';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -42,7 +42,7 @@ class BlockCart extends Module
|
||||
$this->displayName = $this->l('Cart block');
|
||||
$this->description = $this->l('Adds a block containing the customer\'s shopping cart.');
|
||||
}
|
||||
|
||||
|
||||
public function smartyAssigns(&$smarty, &$params)
|
||||
{
|
||||
global $errors, $cookie;
|
||||
@@ -62,7 +62,7 @@ class BlockCart extends Module
|
||||
}
|
||||
else
|
||||
$taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
|
||||
|
||||
|
||||
$useTax = !($taxCalculationMethod == PS_TAX_EXC);
|
||||
|
||||
$products = $params['cart']->getProducts(true);
|
||||
@@ -72,13 +72,13 @@ class BlockCart extends Module
|
||||
|
||||
$wrappingCost = (float)($params['cart']->getOrderTotal($useTax, Cart::ONLY_WRAPPING));
|
||||
$totalToPay = $params['cart']->getOrderTotal($useTax);
|
||||
|
||||
|
||||
if ($useTax AND Configuration::get('PS_TAX_DISPLAY') == 1)
|
||||
{
|
||||
$totalToPayWithoutTaxes = $params['cart']->getOrderTotal(false);
|
||||
$smarty->assign('tax_cost', Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency));
|
||||
}
|
||||
|
||||
|
||||
$smarty->assign(array(
|
||||
'products' => $products,
|
||||
'customizedDatas' => Product::getAllCustomizedDatas((int)($params['cart']->id)),
|
||||
@@ -88,7 +88,7 @@ class BlockCart extends Module
|
||||
'nb_total_products' => (int)($nbTotalProducts),
|
||||
'shipping_cost' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::ONLY_SHIPPING), $currency),
|
||||
'show_wrapping' => $wrappingCost > 0 ? true : false,
|
||||
'show_tax' => (int)(Configuration::get('PS_TAX_DISPLAY')) == 1 ? true : false,
|
||||
'show_tax' => (int)(Configuration::get('PS_TAX_DISPLAY') == 1 && $smarty->getConfigVars('use_taxes')),
|
||||
'wrapping_cost' => Tools::displayPrice($wrappingCost, $currency),
|
||||
'product_total' => Tools::displayPrice($params['cart']->getOrderTotal($useTax, Cart::BOTH_WITHOUT_SHIPPING), $currency),
|
||||
'total' => Tools::displayPrice($totalToPay, $currency),
|
||||
@@ -125,7 +125,7 @@ class BlockCart extends Module
|
||||
<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
|
||||
<fieldset>
|
||||
<legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend>
|
||||
|
||||
|
||||
<label>'.$this->l('Ajax cart').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="ajax" id="ajax_on" value="1" '.(Tools::getValue('ajax', Configuration::get('PS_BLOCK_CART_AJAX')) ? 'checked="checked" ' : '').'/>
|
||||
@@ -134,7 +134,7 @@ class BlockCart extends Module
|
||||
<label class="t" for="ajax_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p class="clear">'.$this->l('Activate AJAX mode for cart (compatible with the default theme)').'</p>
|
||||
</div>
|
||||
|
||||
|
||||
<center><input type="submit" name="submitBlockCart" value="'.$this->l('Save').'" class="button" /></center>
|
||||
</fieldset>
|
||||
</form>';
|
||||
@@ -157,11 +157,10 @@ class BlockCart extends Module
|
||||
{
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return;
|
||||
|
||||
|
||||
global $smarty;
|
||||
$smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false);
|
||||
$this->smartyAssigns($smarty, $params);
|
||||
|
||||
return $this->display(__FILE__, 'blockcart.tpl');
|
||||
}
|
||||
|
||||
@@ -174,20 +173,21 @@ class BlockCart extends Module
|
||||
{
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return;
|
||||
|
||||
|
||||
global $smarty;
|
||||
$this->smartyAssigns($smarty, $params);
|
||||
$res = $this->display(__FILE__, 'blockcart-json.tpl');
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
public function hookHeader()
|
||||
{
|
||||
if (Configuration::get('PS_CATALOG_MODE'))
|
||||
return;
|
||||
|
||||
|
||||
Tools::addCSS(($this->_path).'blockcart.css', 'all');
|
||||
if ((int)(Configuration::get('PS_BLOCK_CART_AJAX')))
|
||||
Tools::addJS(($this->_path).'ajax-cart.js');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
|
||||
<h4>
|
||||
<a href="{$link->getPageLink("$order_process.php", true)}">{l s='Cart' mod='blockcart'}</a>
|
||||
{if $ajax_allowed}
|
||||
<span id="block_cart_expand" {if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded'}class="hidden"{/if}> </span>
|
||||
<span id="block_cart_collapse" {if isset($colapseExpandStatus) && $colapseExpandStatus eq 'collapsed' || !isset($colapseExpandStatus)}class="hidden"{/if}> </span>
|
||||
<span id="block_cart_expand" {if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !isset($colapseExpandStatus)}class="hidden"{/if}> </span>
|
||||
<span id="block_cart_collapse" {if isset($colapseExpandStatus) && $colapseExpandStatus eq 'collapsed'}class="hidden"{/if}> </span>
|
||||
{/if}
|
||||
</h4>
|
||||
<div class="block_content">
|
||||
<!-- block summary -->
|
||||
<div id="cart_block_summary" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed}collapsed{else}expanded{/if}">
|
||||
<div id="cart_block_summary" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed || !isset($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_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>
|
||||
@@ -54,7 +54,7 @@ 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>
|
||||
</div>
|
||||
<!-- block list of products -->
|
||||
<div id="cart_block_list" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed}expanded{else}collapsed{/if}">
|
||||
<div id="cart_block_list" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed || !isset($colapseExpandStatus)}expanded{else}collapsed{/if}">
|
||||
{if $products}
|
||||
<dl class="products">
|
||||
{foreach from=$products item='product' name='myLoop'}
|
||||
@@ -126,7 +126,7 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
|
||||
<span>{l s='Total' mod='blockcart'}</span>
|
||||
<span id="cart_block_total" class="price ajax_block_cart_total">{$total}</span>
|
||||
</p>
|
||||
{if $use_taxes}
|
||||
{if $use_taxes && $display_tax_label == 1}
|
||||
{if $priceDisplay == 0}
|
||||
<p id="cart-price-precisions">
|
||||
{l s='Prices are tax included' mod='blockcart'}
|
||||
|
||||
@@ -8,4 +8,5 @@
|
||||
<tab>front_office_features</tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -40,7 +40,7 @@ $_MODULE['<{blockcms}prestashop>blockcms_903d12e7aa8c380c290b78c1898e01b7'] = 'U
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_92fc29650a0f9dd3fca4e5de1845f78b'] = 'Debe elegir al menos una página o subcategoría para crear un bloque CMS';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_5e75cbfbfd02a7b2fab0ed21505e811b'] = 'Página CMS o subcategoría no válidos';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_420d575844f77db5299065080d9c237f'] = 'Nombre del bloque demasiado largo';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_c12d11dfdaf316576221cf4319fbd7fc'] = 'id del bloque cms no válida';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_ede67d50014846cb8bb1b00d5fde77be'] = ' id_cms_block no válido';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_05b51791a83d3cef29ad68b70d48d131'] = 'Activación footer no válida';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_5dab5acc3c6a2a7e87e8d8926a2c763e'] = 'Está tratando de suprimir un bloque cms que no existe';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_138218281781fd0d938a140892d7386c'] = 'Edición de links CMS a pie de página con éxito';
|
||||
|
||||
@@ -40,7 +40,7 @@ $_MODULE['<{blockcms}prestashop>blockcms_903d12e7aa8c380c290b78c1898e01b7'] = 'E
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_92fc29650a0f9dd3fca4e5de1845f78b'] = 'Vous devez choisir au moins une page ou sous-catégorie pour créer un bloc CMS';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_5e75cbfbfd02a7b2fab0ed21505e811b'] = 'Page CMS ou sous-catégorie invalide';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_420d575844f77db5299065080d9c237f'] = 'Nom du bloc trop long';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_c12d11dfdaf316576221cf4319fbd7fc'] = 'id_block_cms invalide';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_ede67d50014846cb8bb1b00d5fde77be'] = 'id_cms_block invalide';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_05b51791a83d3cef29ad68b70d48d131'] = 'Footer activation invalide';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_5dab5acc3c6a2a7e87e8d8926a2c763e'] = 'Vous essayez de supprimer un block cms inexistant';
|
||||
$_MODULE['<{blockcms}prestashop>blockcms_138218281781fd0d938a140892d7386c'] = 'Édition des liens CMS en pied de page réussie';
|
||||
|
||||
@@ -8,4 +8,5 @@
|
||||
<tab>front_office_features</tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -84,19 +84,46 @@ function reloadContent()
|
||||
ajaxLoaderOn = 1;
|
||||
}
|
||||
|
||||
ajaxQuery = $.ajax(
|
||||
data = $('#layered_form').serialize();
|
||||
$('.layered_slider').each( function () {
|
||||
data += '&'+$(this).attr('id')+'='+$(this).slider('values', 0)+'_'+$(this).slider('values', 1);
|
||||
});
|
||||
|
||||
ajaxQuery = $.ajax(
|
||||
{
|
||||
type: 'GET',
|
||||
url: baseDir + 'modules/blocklayered/blocklayered-ajax.php',
|
||||
data: $('#layered_form').serialize(),
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function(result)
|
||||
{
|
||||
$('#layered_block_left').after($(result)[0]).remove();
|
||||
$('#product_list').html($(result)[1]);
|
||||
$('#layered_block_left').after('<div id="tmp_layered_block_left"></div>').remove();
|
||||
$('#tmp_layered_block_left').html(result.filtersBlock).attr('id', 'layered_block_left');
|
||||
|
||||
$('#product_list').html(result.productList).html();
|
||||
$('#product_list').css('opacity', '1');
|
||||
ajaxLoaderOn = 0;
|
||||
}
|
||||
});
|
||||
|
||||
ajaxQueries.push(ajaxQuery);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
function initSlider(type, min, max, values, unit)
|
||||
{
|
||||
$('#layered_'+type+'_slider').slider({
|
||||
range: true,
|
||||
min: min,
|
||||
max: max,
|
||||
values: [ values[0], values[1]],
|
||||
slide: function( event, ui ) {
|
||||
$('#layered_'+type+'_range').html(ui.values[ 0 ] + unit + ' - ' + ui.values[ 1 ] + unit);
|
||||
},
|
||||
stop: function () {
|
||||
reloadContent();
|
||||
}
|
||||
});
|
||||
$('#layered_'+type+'_range').html($('#layered_'+type+'_slider').slider('values', 0 ) +unit+'-'+$('#layered_'+type+'_slider').slider('values', 1)+unit );
|
||||
}
|
||||
*/
|
||||
@@ -30,6 +30,9 @@ if (!defined('_CAN_LOAD_FILES_'))
|
||||
|
||||
class BlockLayered extends Module
|
||||
{
|
||||
|
||||
private $products ;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'blocklayered';
|
||||
@@ -46,7 +49,6 @@ class BlockLayered extends Module
|
||||
public function install()
|
||||
{
|
||||
if ($result = parent::install() AND $this->registerHook('leftColumn') AND $this->registerHook('header')
|
||||
AND $this->registerHook('addProduct') AND $this->registerHook('updateProduct') AND $this->registerHook('deleteProduct')
|
||||
AND $this->registerHook('categoryAddition') AND $this->registerHook('categoryUpdate') AND $this->registerHook('categoryDeletion'))
|
||||
{
|
||||
Configuration::updateValue('PS_LAYERED_NAVIGATION_CHECKBOXES', 1);
|
||||
@@ -60,13 +62,12 @@ class BlockLayered extends Module
|
||||
{
|
||||
/* Delete all configurations */
|
||||
Configuration::deleteByName('PS_LAYERED_NAVIGATION_CHECKBOXES');
|
||||
|
||||
return parent::uninstall();
|
||||
}
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
return $this->generateFilters();
|
||||
return $this->generateFiltersBlock($this->getSelectedFilters());
|
||||
}
|
||||
|
||||
public function hookRightColumn($params)
|
||||
@@ -77,36 +78,22 @@ class BlockLayered extends Module
|
||||
public function hookHeader($params)
|
||||
{
|
||||
Tools::addJS(($this->_path).'blocklayered.js');
|
||||
Tools::addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js');
|
||||
Tools::addCSS(($this->_path).'blocklayered.css', 'all');
|
||||
Tools::addCSS(_PS_CSS_DIR_.'jquery-ui-1.8.10.custom.css', 'all');
|
||||
|
||||
}
|
||||
|
||||
public function hookAddProduct($params)
|
||||
{
|
||||
$this->rebuildLayeredCache(array((int)$params['product']->id));
|
||||
}
|
||||
|
||||
public function hookUpdateProduct($params)
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_cache WHERE id_product = '.(int)$params['product']->id.' LIMIT 1');
|
||||
$this->rebuildLayeredCache(array((int)$params['product']->id));
|
||||
}
|
||||
|
||||
public function hookDeleteProduct($params)
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_cache WHERE id_product = '.(int)$params['product']->id.' LIMIT 1');
|
||||
}
|
||||
|
||||
|
||||
public function hookCategoryAddition($params)
|
||||
{
|
||||
Db::getInstance()->Execute('ALTER TABLE `'._DB_PREFIX_.'layered_cache` ADD `c'.(int)$params['category']->id.'` TINYINT UNSIGNED NOT NULL DEFAULT \'0\'');
|
||||
Configuration::updateValue('PS_LAYERED_COLUMNS', Configuration::get('PS_LAYERED_COLUMNS').',c'.(int)$params['category']->id);
|
||||
$this->rebuildLayeredCache(array(), array((int)$params['category']->id));
|
||||
}
|
||||
|
||||
public function hookCategoryUpdate($params)
|
||||
{
|
||||
/* The category status might (active, inactive) have changed, we have to update the layered cache table structure */
|
||||
if (!$params['category']->active)
|
||||
/*
|
||||
if (!$params['category']->active)
|
||||
$this->hookCategoryDeletion($params);
|
||||
else
|
||||
{
|
||||
@@ -119,27 +106,23 @@ class BlockLayered extends Module
|
||||
if (!Db::getInstance()->getRow('SELECT id_layered_category FROM `'._DB_PREFIX_.'layered_category` WHERE id_category = '.(int)$params['category']->id))
|
||||
$this->rebuildLayeredCache(array(), array((int)$params['category']->id));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public function hookCategoryDeletion($params)
|
||||
{
|
||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'layered_category WHERE id_category = '.(int)$params['category']->id);
|
||||
$oneRow = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'layered_cache`');
|
||||
if (isset($oneRow['c'.(int)$params['category']->id]))
|
||||
{
|
||||
Db::getInstance()->Execute('ALTER TABLE `'._DB_PREFIX_.'layered_cache` DROP `c'.(int)$params['category']->id.'`');
|
||||
Configuration::updateValue('PS_LAYERED_COLUMNS', str_replace(',c'.(int)$params['category']->id, '', Configuration::get('PS_LAYERED_COLUMNS')));
|
||||
}
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$html = '';
|
||||
if (Tools::isSubmit('submitLayeredCache'))
|
||||
{
|
||||
$this->rebuildLayeredStructure();
|
||||
$this->rebuildLayeredCache();
|
||||
|
||||
echo '
|
||||
$html .= '
|
||||
<div class="conf confirm">
|
||||
<img src="../img/admin/ok.gif" alt="" title="" />
|
||||
'.$this->l('Layered navigation database was initialized successfully').'
|
||||
@@ -147,21 +130,20 @@ class BlockLayered extends Module
|
||||
}
|
||||
elseif (Tools::isSubmit('submitLayeredSettings'))
|
||||
{
|
||||
echo '
|
||||
$html .= '
|
||||
<div class="conf confirm">
|
||||
<img src="../img/admin/ok.gif" alt="" title="" />
|
||||
'.$this->l('Settings saved successfully').'
|
||||
</div>';
|
||||
}
|
||||
|
||||
echo '
|
||||
$html .= '
|
||||
<h2>'.$this->l('Layered navigation').'</h2>
|
||||
|
||||
<p class="warning" style="font-weight: bold;"><img src="../img/admin/information.png" alt="" /> '.$this->l('This module is in beta version and will be improved in PrestaShop v1.4.1').'</p><br />
|
||||
<p class="warning" style="font-weight: bold;"><img src="../img/admin/information.png" alt="" /> '.$this->l('This module is in beta version and will be improved').'</p><br />
|
||||
<fieldset class="width2">
|
||||
<legend><img src="../img/admin/asterisk.gif" alt="" />'.$this->l('10 upcoming improvements in PrestaShop v1.4.1').'</legend>
|
||||
<legend><img src="../img/admin/asterisk.gif" alt="" />'.$this->l('10 upcoming improvements').'</legend>
|
||||
<ol>
|
||||
<li>'.$this->l('Real-time refresh of the cache table').'</li>
|
||||
<li>'.$this->l('Real-time refresh of the cache table').' <img src="../img/admin/enabled.gif" alt="" /></li>
|
||||
<li>'.$this->l('Additional filters (prices, weight)').'</li>
|
||||
<li>'.$this->l('Ability to manage filters by category in the module configuration').'</li>
|
||||
<li>'.$this->l('Ability to hide filter groups with no values and filter values with 0 products').'</li>
|
||||
@@ -186,22 +168,161 @@ class BlockLayered extends Module
|
||||
<legend><img src="../img/admin/database_gear.gif" alt="" />'.$this->l('Cache initialization').'</legend>
|
||||
<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
|
||||
<div class="warning">
|
||||
<p style="font-weight: bold;"><img src="../img/admin/warning.gif" alt="" /> '.$this->l('When do you have to initialize the cache?').'</p>
|
||||
<ul>
|
||||
<li style="color: red; font-weight: bold;">'.$this->l('Before using this module for the first time').'</li>
|
||||
<li>'.$this->l('You add/update/delete').' '.$this->l('a feature or a feature value').'</li>
|
||||
<li>'.$this->l('You add/update/delete').' '.$this->l('an attribute group or an attribute value').'</li>
|
||||
<li>'.$this->l('You update one or more feature values for a product').'</li>
|
||||
</ul>
|
||||
<p style="color: red; font-weight: bold;">'.$this->l('Before using this module for the first time you have to initialize the cache').'</p>
|
||||
<p><b>'.$this->l('Warning: This could take several minutes.').'</b><br /><br />
|
||||
'.$this->l('If you do not, this cache table might become larger and larger (less efficient), and all the new choices (attributes, features) will not be offered to your visitors.').'</p>
|
||||
</div>
|
||||
<p style="text-align: center;"><input type="submit" class="button" name="submitLayeredCache" value="'.$this->l('Initialize the layered navigation database').'" /></p>
|
||||
</form>
|
||||
</fieldset>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function generateFilters($selectedFilters = array())
|
||||
private function getSelectedFilters()
|
||||
{
|
||||
$id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1));
|
||||
if ($id_parent == 1)
|
||||
return;
|
||||
|
||||
/* Analyze all the filters selected by the user and store them into a tab */
|
||||
$selectedFilters = array('category' => array(), 'manufacturer' => array(), 'quantity' => array(), 'condition' => array());
|
||||
foreach ($_GET AS $key => $value)
|
||||
{
|
||||
if (substr($key, 0, 8) == 'layered_')
|
||||
{
|
||||
preg_match('/^(.*)_[0-9|new|used|refurbished|slider]+$/', substr($key, 8, strlen($key) - 8), $res);
|
||||
if (isset($res[1]))
|
||||
{
|
||||
$tmpTab = explode('_', $value);
|
||||
$value = $tmpTab[0];
|
||||
$id_key = false;
|
||||
if (isset($tmpTab[1]))
|
||||
$id_key = $tmpTab[1];
|
||||
if ($res[1] == 'condition' AND in_array($value, array('new', 'used', 'refurbished')))
|
||||
$selectedFilters['condition'][] = $value;
|
||||
elseif ($res[1] == 'quantity' AND (!$value OR $value == 1))
|
||||
$selectedFilters['quantity'][] = $value;
|
||||
elseif (in_array($res[1], array('id_attribute_group', 'category', 'id_feature', 'manufacturer')))
|
||||
{
|
||||
if (!isset($selectedFilters[$res[1].($id_key ? '_'.$id_key : '')]))
|
||||
$selectedFilters[$res[1].($id_key ? '_'.$id_key : '')] = array();
|
||||
$selectedFilters[$res[1].($id_key ? '_'.$id_key : '')][] = (int)$value;
|
||||
}
|
||||
elseif (in_array($res[1], array('weight')))
|
||||
$selectedFilters[$res[1]] = $tmpTab;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $selectedFilters;
|
||||
}
|
||||
|
||||
public function getProductByFilters($selectedFilters = array())
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
if (!empty($this->products))
|
||||
return $this->products;
|
||||
|
||||
/* If the current category isn't defined of if it's homepage, we have nothing to display */
|
||||
$id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1));
|
||||
if ($id_parent == 1)
|
||||
return;
|
||||
|
||||
if (!sizeof($selectedFilters['category']))
|
||||
$selectedFilters['category'][] = $id_parent;
|
||||
|
||||
$queryFilters = '';
|
||||
|
||||
foreach ($selectedFilters AS $key => $filterValues)
|
||||
{
|
||||
if (!sizeof($filterValues))
|
||||
continue;
|
||||
|
||||
preg_match('/^(.*[^_0-9])/', $key, $res);
|
||||
$key = $res[1];
|
||||
|
||||
switch ($key)
|
||||
{
|
||||
case 'id_feature':
|
||||
$queryFilters .= ' AND p.id_product IN ( SELECT id_product FROM '._DB_PREFIX_.'feature_product fp WHERE ';
|
||||
foreach ($filterValues AS $filterValue)
|
||||
$queryFilters .= 'fp.`id_feature_value` = '.(int)$filterValue.' OR ';
|
||||
$queryFilters = rtrim($queryFilters, 'OR ').')';
|
||||
break;
|
||||
case 'id_attribute_group':
|
||||
$queryFilters .= ' AND p.id_product IN ( SELECT pa.`id_product`
|
||||
FROM `ps_product_attribute_combination` pac
|
||||
LEFT JOIN `ps_product_attribute` pa
|
||||
ON (pa.`id_product_attribute` = pac.`id_product_attribute`) WHERE ';
|
||||
|
||||
foreach ($filterValues AS $filterValue)
|
||||
$queryFilters .= 'pac.`id_attribute` = '.(int)$filterValue.' OR ';
|
||||
$queryFilters = rtrim($queryFilters, 'OR ').')';
|
||||
break;
|
||||
case 'category':
|
||||
$parent = new category($id_parent);
|
||||
if (!sizeof($selectedFilters['category']))
|
||||
$queryFilters .= ' AND p.id_product IN ( SELECT id_product FROM '._DB_PREFIX_.'category_product cp
|
||||
LEFT JOIN ps_category c ON (c.id_category = cp.id_category)
|
||||
WHERE 1 AND c.nleft >= parent->nleft AND c.nright <= parent->nright';
|
||||
else
|
||||
{
|
||||
$queryFilters .= ' AND p.id_product IN ( SELECT id_product FROM '._DB_PREFIX_.'category_product cp WHERE 1 AND cp.`id_category` = '.(int)$id_parent;
|
||||
if (sizeof($selectedFilters['category']))
|
||||
$queryFilters .= ' OR ';
|
||||
foreach ($selectedFilters['category'] AS $id_category)
|
||||
$queryFilters .= 'cp.`id_category` = '.(int)$id_category.' OR ';
|
||||
$queryFilters = rtrim($queryFilters, 'OR ').')';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'quantity':
|
||||
if (sizeof($selectedFilters['quantity']) == 2)
|
||||
break;
|
||||
$queryFilters .= ' AND p.quantity '.(!$selectedFilters['quantity'][0] ? '=' : '>').' 0';
|
||||
break;
|
||||
|
||||
case 'manufacturer':
|
||||
$queryFilters .= ' AND p.id_manufacturer IN ('.implode($selectedFilters['manufacturer'], ',').')';
|
||||
break;
|
||||
|
||||
case 'condition':
|
||||
if (sizeof($selectedFilters['condition']) == 3)
|
||||
break;
|
||||
$queryFilters .= ' AND p.condition IN (';
|
||||
foreach ($selectedFilters['condition'] AS $cond)
|
||||
$queryFilters .= '\''.$cond.'\',';
|
||||
$queryFilters = rtrim($queryFilters, ',').')';
|
||||
break;
|
||||
|
||||
case 'weight':
|
||||
$queryFilters .= ' AND p.`weight` BETWEEN '.(float)$selectedFilters['weight'][0].' AND '.(float)$selectedFilters['weight'][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
//id_category_layered = current displayed category
|
||||
if (!sizeof($selectedFilters['category']))
|
||||
$queryFilters .= ' AND p.id_product IN (
|
||||
SELECT id_product FROM '._DB_PREFIX_.'category_product cp
|
||||
WHERE cp.`id_category` = '.(int)$id_parent.')';
|
||||
|
||||
$sql = '
|
||||
SELECT p.id_product, p.out_of_stock, p.available_for_order, p.quantity, p.id_category_default, p.customizable, p.show_price, p.`weight`,
|
||||
p.ean13, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend, m.name manufacturer_name, p.condition, p.id_manufacturer,
|
||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product)
|
||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1)
|
||||
LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)($cookie->id_lang).')
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
|
||||
WHERE pl.id_lang = '.(int)$cookie->id_lang.$queryFilters;
|
||||
|
||||
$this->products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
public function generateFiltersBlock($selectedFilters = array())
|
||||
{
|
||||
|
||||
global $smarty, $link, $cookie;
|
||||
@@ -215,29 +336,57 @@ class BlockLayered extends Module
|
||||
$category = new Category((int)$id_parent);
|
||||
|
||||
$subCategories = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT c.id_category, c.id_parent
|
||||
SELECT c.id_category, c.id_parent, cl.name
|
||||
FROM '._DB_PREFIX_.'category c
|
||||
WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
|
||||
WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$cookie->id_lang.'
|
||||
ORDER BY c.position ASC');
|
||||
|
||||
$oneRow = Db::getInstance()->getRow('SELECT * FROM '._DB_PREFIX_.'layered_cache');
|
||||
if (!$oneRow)
|
||||
return;
|
||||
|
||||
$whereC = ' AND (c'.(int)$id_parent.' = 1 OR ';
|
||||
$queryProduct = ', c'.(int)$id_parent;
|
||||
$whereC = ' cp.`id_category` = '.(int)$id_parent.' OR ';
|
||||
foreach ($subCategories AS $subcategory)
|
||||
if (isset($oneRow['c'.(int)$subcategory['id_category']]))
|
||||
{
|
||||
$whereC .= ' c'.(int)$subcategory['id_category'].' = 1 OR ';
|
||||
$queryProduct .= ', c'.(int)$subcategory['id_category'];
|
||||
$selectedFilters['category'][] = (int)$subcategory['id_category'];
|
||||
}
|
||||
$whereC .= ' cp.`id_category` = '.(int)$subcategory['id_category'].' OR ';
|
||||
|
||||
$whereC = rtrim($whereC, 'OR ').')';
|
||||
|
||||
$productsSQL = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT p.`id_product`, p.`condition`, p.`id_manufacturer`, p.`quantity`, p.`weight`,
|
||||
(SELECT GROUP_CONCAT(`id_category`) FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_product` = p.`id_product`) as ids_cat,
|
||||
(SELECT GROUP_CONCAT(`id_feature_value`) FROM `'._DB_PREFIX_.'feature_product` fp WHERE fp.`id_product` = p.`id_product`) as ids_feat,
|
||||
(SELECT GROUP_CONCAT(DISTINCT(pac.`id_attribute`))
|
||||
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = pac.`id_product_attribute`)
|
||||
WHERE pa.`id_product` = p.`id_product` ) as ids_attr
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
WHERE p.`active` = 1 AND p.`id_product` IN ( SELECT id_product FROM `'._DB_PREFIX_.'category_product` cp WHERE'.$whereC, false);
|
||||
|
||||
$products = array();
|
||||
$db = Db::getInstance();
|
||||
$weight = array();
|
||||
while ($product = $db->nextRow($productsSQL))
|
||||
{
|
||||
$row = array();
|
||||
foreach ($product AS $key => $value)
|
||||
{
|
||||
if($key == 'ids_feat')
|
||||
$row['f'] = explode(',', $value);
|
||||
if($key == 'ids_attr')
|
||||
$row['a'] = explode(',', $value);
|
||||
if($key == 'ids_cat')
|
||||
$row['c'] = explode(',', $value);
|
||||
if($key == 'weight')
|
||||
$weight[] = $value;
|
||||
}
|
||||
|
||||
$row['id_manufacturer'] = (int)$product['id_manufacturer'];
|
||||
$row['quantity'] = (bool)$product['quantity'];
|
||||
$row['condition'] = $product['condition'];
|
||||
$row['weight'] = $product['weight'];
|
||||
$products[(int)$product['id_product']] = $row;
|
||||
}
|
||||
|
||||
/* Get the filters for the current category */
|
||||
$filters = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT * FROM '._DB_PREFIX_.'layered_category WHERE id_category = '.(int)$id_parent);
|
||||
$filterBlocks = $f = $a = array();
|
||||
|
||||
foreach ($filters AS $filter)
|
||||
{
|
||||
$filterBlocks[(int)$filter['position']]['type_lite'] = $filter['type'];
|
||||
@@ -253,11 +402,7 @@ class BlockLayered extends Module
|
||||
FROM '._DB_PREFIX_.'feature_value fv
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fv.id_feature_value)
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND fv.id_feature = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND fvl.id_lang = '.(int)$cookie->id_lang);
|
||||
|
||||
foreach ($filterBlocks[(int)$filter['position']]['SQLvalues'] AS $key => $value)
|
||||
if (isset($oneRow['f'.(int)$value['id_feature_value']]))
|
||||
$queryProduct .= ', f'.(int)$value['id_feature_value'];
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 'id_attribute_group':
|
||||
@@ -267,36 +412,11 @@ class BlockLayered extends Module
|
||||
SELECT al.id_attribute, al.name, a.color
|
||||
FROM '._DB_PREFIX_.'attribute a
|
||||
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = a.id_attribute)
|
||||
WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$cookie->id_lang);
|
||||
|
||||
foreach ($filterBlocks[(int)$filter['position']]['SQLvalues'] AS $value)
|
||||
if (isset($oneRow['a'.(int)$value['id_attribute']]))
|
||||
$queryProduct .= ', a'.(int)$value['id_attribute'];
|
||||
|
||||
WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$cookie->id_lang);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$productsSQL = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT lc.id_product, p.condition, p.id_manufacturer, p.quantity'.$queryProduct.'
|
||||
FROM '._DB_PREFIX_.'layered_cache lc
|
||||
INNER JOIN '._DB_PREFIX_.'product p ON (p.id_product = lc.id_product)
|
||||
WHERE 1 '.$whereC, false);
|
||||
|
||||
$products = array();
|
||||
$db = Db::getInstance();
|
||||
while ($product = $db->nextRow($productsSQL))
|
||||
{
|
||||
$row = array();
|
||||
foreach ($product AS $key => $value)
|
||||
if ($value == 1)
|
||||
$row[$key] = true;
|
||||
$row['id_manufacturer'] = (int)$product['id_manufacturer'];
|
||||
$row['quantity'] = (bool)$product['quantity'];
|
||||
$row['condition'] = $product['condition'];
|
||||
$products[(int)$product['id_product']] = $row;
|
||||
}
|
||||
|
||||
/* Get the feature block names & values */
|
||||
if (sizeof($f))
|
||||
{
|
||||
@@ -304,13 +424,12 @@ class BlockLayered extends Module
|
||||
SELECT id_feature, name
|
||||
FROM '._DB_PREFIX_.'feature_lang
|
||||
WHERE id_lang = '.(int)$cookie->id_lang.' AND id_feature IN ('.implode(',', $f).')');
|
||||
|
||||
$fNameByID = array();
|
||||
foreach ($fNames AS $fName)
|
||||
$fNameByID[(int)$fName['id_feature']] = $fName['name'];
|
||||
}
|
||||
|
||||
/* Get the feature block names & values */
|
||||
/* Get the attribute block names & values */
|
||||
if (sizeof($a))
|
||||
{
|
||||
$aNames = Db::getInstance()->ExecuteS('
|
||||
@@ -327,40 +446,36 @@ class BlockLayered extends Module
|
||||
$colorGroups[(int)$aName['id_attribute_group']] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($filterBlocks AS &$filterBlock)
|
||||
{
|
||||
if ($filterBlock['type_lite'] == 'category')
|
||||
{
|
||||
$filterBlock['name'] = $this->l('Categories');
|
||||
|
||||
$c = array();
|
||||
foreach ($subCategories AS $subCat)
|
||||
{
|
||||
$c[] = (int)$subCat['id_category'];
|
||||
$filterBlock['values'][(int)$subCat['id_category']]['name'] = $subCat['name'];
|
||||
|
||||
//init the number of product in this category
|
||||
if (!isset($filterBlock['values'][(int)$subCat['id_category']]['nbr']))
|
||||
$filterBlock['values'][(int)$subCat['id_category']]['nbr'] = 0;
|
||||
|
||||
//check if the category is selected and set to true
|
||||
if (isset($selectedFilters['category']) AND in_array($subCat['id_category'], $selectedFilters['category']))
|
||||
$filterBlock['values'][(int)$subCat['id_category']]['checked'] = true;
|
||||
}
|
||||
|
||||
$productCat = $this->filterProducts($products, $selectedFilters, 'category');
|
||||
|
||||
$filterCategories = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT c.id_category, c.id_parent, cl.name,
|
||||
(SELECT GROUP_CONCAT(c2.id_category) FROM '._DB_PREFIX_.'category c2 WHERE c2.active = 1 AND c2.nleft > c.nleft and c2.nright < c.nright) subcategories
|
||||
FROM '._DB_PREFIX_.'category c
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category)
|
||||
WHERE c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$cookie->id_lang.'
|
||||
ORDER BY c.position ASC');
|
||||
|
||||
foreach ($filterCategories AS $filterCategory)
|
||||
{
|
||||
$filterBlock['values'][(int)$filterCategory['id_category']]['name'] = method_exists('Category', 'hideCategoryPosition') ? Category::hideCategoryPosition($filterCategory['name']) : $filterCategory['name'];
|
||||
if (!isset($filterBlock['values'][(int)$filterCategory['id_category']]['n']))
|
||||
$filterBlock['values'][(int)$filterCategory['id_category']]['n'] = 0;
|
||||
if (isset($selectedFilters['category']) AND in_array($filterCategory['id_category'], $selectedFilters['category']))
|
||||
$filterBlock['values'][(int)$filterCategory['id_category']]['checked'] = true;
|
||||
|
||||
//count nbr product in category
|
||||
foreach ($c AS $idSubCategory)
|
||||
foreach ($productCat AS $product)
|
||||
{
|
||||
$tmpTab = explode(',', $filterCategory['subcategories']);
|
||||
$tmpTab[] = (int)$filterCategory['id_category'];
|
||||
foreach ($tmpTab AS $idSubCategory)
|
||||
if (isset($product['c'.(int)$idSubCategory]))
|
||||
$filterBlock['values'][(int)$filterCategory['id_category']]['n']++;
|
||||
}
|
||||
}
|
||||
if(in_array($idSubCategory, $product['c']))
|
||||
$filterBlock['values'][(int)$idSubCategory]['nbr']++;
|
||||
|
||||
}
|
||||
elseif ($filterBlock['type_lite'] == 'id_feature')
|
||||
{
|
||||
@@ -368,23 +483,24 @@ class BlockLayered extends Module
|
||||
$filterBlock['values'] = array();
|
||||
|
||||
$productFeat = $this->filterProducts($products, $selectedFilters, 'id_feature_'.(int)$filterBlock['id_key']);
|
||||
|
||||
|
||||
foreach ($filterBlock['SQLvalues'] AS $value)
|
||||
{
|
||||
{
|
||||
foreach ($productFeat AS $product)
|
||||
if (isset($product['f'.$value['id_feature_value']]))
|
||||
{
|
||||
if (in_array($value['id_feature_value'], $product['f']))
|
||||
{
|
||||
$filterBlock['values'][(int)$value['id_feature_value']]['name'] = $value['value'];
|
||||
if (!isset($filterBlock['values'][(int)$value['id_feature_value']]['n']))
|
||||
$filterBlock['values'][(int)$value['id_feature_value']]['n'] = 0;
|
||||
$filterBlock['values'][(int)$value['id_feature_value']]['n']++;
|
||||
if (!isset($filterBlock['values'][(int)$value['id_feature_value']]['nbr']))
|
||||
$filterBlock['values'][(int)$value['id_feature_value']]['nbr'] = 0;
|
||||
$filterBlock['values'][(int)$value['id_feature_value']]['nbr']++;
|
||||
}
|
||||
foreach ($products AS $product)
|
||||
if (isset($product['f'.$value['id_feature_value']]) AND !isset($filterBlock['values'][(int)$value['id_feature_value']]))
|
||||
if (in_array($value['id_feature_value'], $product['f']) AND !isset($filterBlock['values'][(int)$value['id_feature_value']]))
|
||||
{
|
||||
$filterBlock['values'][(int)$value['id_feature_value']]['name'] = $value['value'];
|
||||
$filterBlock['values'][(int)$value['id_feature_value']]['n'] = 0;
|
||||
$filterBlock['values'][(int)$value['id_feature_value']]['nbr'] = 0;
|
||||
}
|
||||
}
|
||||
if (isset($selectedFilters['id_feature_'.(int)$filterBlock['id_key']]) AND in_array((int)$value['id_feature_value'].'_'.(int)$filterBlock['id_key'], $selectedFilters['id_feature_'.(int)$filterBlock['id_key']]))
|
||||
$filterBlock['values'][(int)$value['id_feature_value']]['checked'] = true;
|
||||
}
|
||||
@@ -398,24 +514,25 @@ class BlockLayered extends Module
|
||||
$filterBlock['values'] = array();
|
||||
|
||||
$productsAttr = $this->filterProducts($products, $selectedFilters, 'id_attribute_group_'.(int)$filterBlock['id_key']);
|
||||
|
||||
|
||||
foreach ($filterBlock['SQLvalues'] AS $value)
|
||||
{
|
||||
foreach ($productsAttr AS $product)
|
||||
if (isset($product['a'.$value['id_attribute']]))
|
||||
{
|
||||
if(in_array($value['id_attribute'], $product['a']))
|
||||
{
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['name'] = $value['name'];
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['color'] = $value['color'];
|
||||
if (!isset($filterBlock['values'][(int)$value['id_attribute']]['n']))
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['n'] = 0;
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['n']++;
|
||||
if (!isset($filterBlock['values'][(int)$value['id_attribute']]['nbr']))
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['nbr'] = 0;
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['nbr']++;
|
||||
}
|
||||
foreach ($products AS $product)
|
||||
if (isset($product['a'.$value['id_attribute']]) AND !isset($filterBlock['values'][(int)$value['id_attribute']]))
|
||||
{
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['name'] = $value['name'];
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['n'] = 0;
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['nbr'] = 0;
|
||||
}
|
||||
}
|
||||
if (isset($selectedFilters['id_attribute_group_'.(int)$filterBlock['id_key']]) AND in_array((int)$value['id_attribute'].'_'.(int)$filterBlock['id_key'], $selectedFilters['id_attribute_group_'.(int)$filterBlock['id_key']]))
|
||||
$filterBlock['values'][(int)$value['id_attribute']]['checked'] = true;
|
||||
}
|
||||
@@ -425,16 +542,17 @@ class BlockLayered extends Module
|
||||
{
|
||||
$filterBlock['name'] = $this->l('Condition');
|
||||
$filterBlock['values'] = array(
|
||||
'new' => array('name' => $this->l('New'), 'n' => 0),
|
||||
'used' => array('name' => $this->l('Used'), 'n' => 0),
|
||||
'refurbished' => array('name' => $this->l('Refurbished'), 'n' => 0));
|
||||
'new' => array('name' => $this->l('New'), 'nbr' => 0),
|
||||
'used' => array('name' => $this->l('Used'), 'nbr' => 0),
|
||||
'refurbished' => array('name' => $this->l('Refurbished'), 'nbr' => 0));
|
||||
|
||||
$productCond = $this->filterProducts($products, $selectedFilters, 'condition');
|
||||
|
||||
foreach ($filterBlock['values'] AS $conditionKey => &$condition)
|
||||
{
|
||||
foreach ($productCond AS $product)
|
||||
if ($product['condition'] == $conditionKey)
|
||||
$condition['n']++;
|
||||
$condition['nbr']++;
|
||||
if (isset($selectedFilters['condition']) AND in_array($conditionKey, $selectedFilters['condition']))
|
||||
$condition['checked'] = true;
|
||||
}
|
||||
@@ -443,14 +561,16 @@ class BlockLayered extends Module
|
||||
{
|
||||
$filterBlock['name'] = $this->l('Availability');
|
||||
$filterBlock['values'] = array(
|
||||
'1' => array('name' => $this->l('In stock'), 'n' => 0),
|
||||
'0' => array('name' => $this->l('Not available'), 'n' => 0));
|
||||
'1' => array('name' => $this->l('In stock'), 'nbr' => 0),
|
||||
'0' => array('name' => $this->l('Not available'), 'nbr' => 0));
|
||||
|
||||
$productQuant = $this->filterProducts($products, $selectedFilters, 'quantity');
|
||||
|
||||
foreach ($filterBlock['values'] AS $quantKey => &$quantity)
|
||||
{
|
||||
foreach ($productQuant AS $product)
|
||||
if ($product['quantity'] == $quantKey)
|
||||
$quantity['n']++;
|
||||
$quantity['nbr']++;
|
||||
if (isset($selectedFilters['quantity']) AND in_array($quantKey, $selectedFilters['quantity']))
|
||||
$quantity['checked'] = true;
|
||||
}
|
||||
@@ -458,40 +578,58 @@ class BlockLayered extends Module
|
||||
elseif ($filterBlock['type_lite'] == 'manufacturer')
|
||||
{
|
||||
$filterBlock['name'] = $this->l('Manufacturer');
|
||||
|
||||
$productsManuf = $this->filterProducts($products, $selectedFilters, 'manufacturer');
|
||||
|
||||
$man = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT DISTINCT(p.id_manufacturer), m.name
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
|
||||
WHERE p.id_product IN ('.implode(',', array_keys($products)).') AND p.id_manufacturer != 0');
|
||||
|
||||
$productsManuf = $this->filterProducts($products, $selectedFilters, 'manufacturer');
|
||||
|
||||
foreach ($man AS $manufacturer)
|
||||
{
|
||||
$filterBlock['values'][(int)$manufacturer['id_manufacturer']]['name'] = $manufacturer['name'];
|
||||
if (!isset($filterBlock['values'][(int)$manufacturer['id_manufacturer']]['n']))
|
||||
$filterBlock['values'][(int)$manufacturer['id_manufacturer']]['n'] = 0;
|
||||
if (!isset($filterBlock['values'][(int)$manufacturer['id_manufacturer']]['nbr']))
|
||||
$filterBlock['values'][(int)$manufacturer['id_manufacturer']]['nbr'] = 0;
|
||||
foreach ($productsManuf AS $product)
|
||||
if ($product['id_manufacturer'] == $manufacturer['id_manufacturer'])
|
||||
$filterBlock['values'][(int)$manufacturer['id_manufacturer']]['n']++;
|
||||
$filterBlock['values'][(int)$manufacturer['id_manufacturer']]['nbr']++;
|
||||
if (isset($selectedFilters['manufacturer']) AND in_array($manufacturer['id_manufacturer'], $selectedFilters['manufacturer']))
|
||||
$filterBlock['values'][(int)$manufacturer['id_manufacturer']]['checked'] = true;
|
||||
}
|
||||
}
|
||||
elseif ($filterBlock['type_lite'] == 'weight')
|
||||
{
|
||||
if (max($weight) != min($weight))
|
||||
{
|
||||
$filterBlock['name'] = $this->l('Weight');
|
||||
$filterBlock['slider'] = true;
|
||||
$filterBlock['max'] = max($weight);
|
||||
$filterBlock['min'] = min($weight);
|
||||
if (isset($selectedFilters['weight']))
|
||||
$filterBlock['values'] = array($selectedFilters['weight'][0], $selectedFilters['weight'][1]);
|
||||
else
|
||||
$filterBlock['values'] = array(min($weight), max($weight));
|
||||
$filterBlock['unit'] = Configuration::get('PS_WEIGHT_UNIT');
|
||||
}
|
||||
else
|
||||
unset($selectedFilters['weight']);
|
||||
}
|
||||
}
|
||||
|
||||
$nFilters = 0;
|
||||
foreach ($selectedFilters AS $filters)
|
||||
$nFilters += sizeof($filters);
|
||||
|
||||
|
||||
$smarty->assign(array(
|
||||
'layered_use_checkboxes' => (int)Configuration::get('PS_LAYERED_NAVIGATION_CHECKBOXES'),
|
||||
'id_category_layered' => (int)$id_parent,
|
||||
'selected_filters' => $selectedFilters,
|
||||
'n_filters' => (int)$nFilters,
|
||||
'nbr_filterBlocks' => sizeof($filterBlocks),
|
||||
'filters' => $filterBlocks));
|
||||
|
||||
|
||||
return $smarty->fetch(_PS_MODULE_DIR_.$this->name.'/blocklayered.tpl');
|
||||
}
|
||||
|
||||
@@ -499,118 +637,20 @@ class BlockLayered extends Module
|
||||
{
|
||||
global $smarty, $cookie;
|
||||
|
||||
/* Analyze all the filters selected by the user and store them into a tab */
|
||||
$filters = array('category' => array(), 'manufacturer' => array(), 'quantity' => array(), 'condition' => array());
|
||||
foreach ($_GET AS $key => $value)
|
||||
if (substr($key, 0, 8) == 'layered_')
|
||||
{
|
||||
preg_match('/^(.*)_[0-9|new|used|refurbished]+$/', substr($key, 8, strlen($key) - 8), $res);
|
||||
if (isset($res[1]))
|
||||
{
|
||||
$tmpTab = explode('_', $value);
|
||||
$value = $tmpTab[0];
|
||||
$id_key = false;
|
||||
if (isset($tmpTab[1]))
|
||||
$id_key = $tmpTab[1];
|
||||
if ($res[1] == 'condition' AND in_array($value, array('new', 'used', 'refurbished')))
|
||||
$filters['condition'][] = $value;
|
||||
elseif ($res[1] == 'quantity' AND (!$value OR $value == 1))
|
||||
$filters['quantity'][] = $value;
|
||||
elseif (in_array($res[1], array('id_attribute_group', 'category', 'id_feature', 'manufacturer')))
|
||||
{
|
||||
if (!isset($filters[$res[1].($id_key ? '_'.$id_key : '')]))
|
||||
$filters[$res[1].($id_key ? '_'.$id_key : '')] = array();
|
||||
$filters[$res[1].($id_key ? '_'.$id_key : '')][] = (int)$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$selectedFilters = $this->getSelectedFilters();
|
||||
|
||||
$products = $this->getProductByFilters($selectedFilters);
|
||||
|
||||
$queryFilters = '';
|
||||
foreach ($filters AS $key => $filterValues)
|
||||
{
|
||||
if (!sizeof($filterValues))
|
||||
continue;
|
||||
|
||||
preg_match('/^(.*[^_0-9])/', $key, $res);
|
||||
$key = $res[1];
|
||||
|
||||
switch ($key)
|
||||
{
|
||||
case 'id_feature':
|
||||
$queryFilters .= ' AND (';
|
||||
foreach ($filterValues AS $filterValue)
|
||||
$queryFilters .= 'lc.f'.(int)$filterValue.' = 1 OR ';
|
||||
$queryFilters = rtrim($queryFilters, 'OR ').')';
|
||||
break;
|
||||
|
||||
case 'id_attribute_group':
|
||||
$queryFilters .= ' AND (';
|
||||
foreach ($filterValues AS $filterValue)
|
||||
$queryFilters .= 'lc.a'.(int)$filterValue.' = 1 OR ';
|
||||
$queryFilters = rtrim($queryFilters, 'OR ').')';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$queryFilters .= ' AND (lc.c'.(int)Tools::getValue('id_category_layered').' = 1 OR ';
|
||||
foreach ($filters['category'] AS $id_category)
|
||||
{
|
||||
$category = new Category((int)$id_category);
|
||||
if (Validate::isLoadedObject($category))
|
||||
{
|
||||
$subCategories = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT c.id_category, c.id_parent
|
||||
FROM '._DB_PREFIX_.'category c
|
||||
WHERE c.nleft >= '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1
|
||||
ORDER BY c.position ASC');
|
||||
|
||||
foreach ($subCategories AS $subCategory)
|
||||
$queryFilters .= 'lc.c'.(int)$subCategory['id_category'].' = 1 OR ';
|
||||
}
|
||||
}
|
||||
$queryFilters = rtrim($queryFilters, 'OR ').')';
|
||||
break;
|
||||
|
||||
case 'quantity':
|
||||
if (sizeof($filters['quantity']) == 2)
|
||||
break;
|
||||
$queryFilters .= ' AND p.quantity '.(!$filters['quantity'][0] ? '=' : '>').' 0';
|
||||
break;
|
||||
|
||||
case 'manufacturer':
|
||||
$queryFilters .= ' AND p.id_manufacturer IN ('.implode($filters['manufacturer'], ',').')';
|
||||
break;
|
||||
|
||||
case 'condition':
|
||||
if (sizeof($filters['condition']) == 3)
|
||||
break;
|
||||
$queryFilters .= ' AND p.condition IN (';
|
||||
foreach ($filters['condition'] AS $cond)
|
||||
$queryFilters .= '\''.$cond.'\',';
|
||||
$queryFilters = rtrim($queryFilters, ',').')';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($filters['category']))
|
||||
$queryFilters .= ' AND (lc.c'.(int)Tools::getValue('id_category_layered').' = 1)';
|
||||
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT p.id_product, p.out_of_stock, p.available_for_order, p.quantity, p.id_category_default, p.customizable, p.show_price,
|
||||
p.ean13, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend, m.name manufacturer_name,
|
||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new
|
||||
FROM '._DB_PREFIX_.'layered_cache lc
|
||||
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = lc.id_product)
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product)
|
||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1)
|
||||
LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)($cookie->id_lang).')
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
|
||||
WHERE pl.id_lang = '.(int)$cookie->id_lang.$queryFilters);
|
||||
|
||||
$products = Product::getProductsProperties((int)$cookie->id_lang, $products);
|
||||
|
||||
|
||||
$smarty->assign('products', $products);
|
||||
|
||||
|
||||
/* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
|
||||
return '<div id="layered_ajax_column">'.$this->generateFilters($filters).'</div><div id="layered_ajax_products">'.$smarty->fetch(_PS_THEME_DIR_.'product-list.tpl').'</div>';
|
||||
return Tools::jsonEncode(array(
|
||||
'filtersBlock' => $this->generateFiltersBlock($selectedFilters),
|
||||
'productList' => $smarty->fetch(_PS_THEME_DIR_.'product-list.tpl')
|
||||
));
|
||||
// return '<div id="layered_ajax_column">'.$this->generateFiltersBlock($selectedFilters).'</div><div id="layered_ajax_products">'.$smarty->fetch(_PS_THEME_DIR_.'product-list.tpl').'</div>';
|
||||
}
|
||||
|
||||
public function rebuildLayeredStructure()
|
||||
@@ -618,59 +658,6 @@ class BlockLayered extends Module
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', '64M');
|
||||
|
||||
/* Delete and re-create the products cache table */
|
||||
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_cache');
|
||||
$createTable = 'CREATE TABLE `'._DB_PREFIX_.'layered_cache` (`id_product` INT UNSIGNED NOT NULL,';
|
||||
$confValue = 'id_product,';
|
||||
|
||||
/* Add the missing feature values columns */
|
||||
$featureValues = Db::getInstance()->ExecuteS('
|
||||
SELECT fv.id_feature_value
|
||||
FROM '._DB_PREFIX_.'feature_product fp
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature_value = fp.id_feature_value)
|
||||
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = fp.id_product)
|
||||
WHERE (fv.custom IS NULL OR fv.custom = 0) AND p.active = 1
|
||||
GROUP BY fv.id_feature_value');
|
||||
|
||||
/* Add the missing attribute values columns */
|
||||
$attributeValues = Db::getInstance()->ExecuteS('
|
||||
SELECT pac.id_attribute
|
||||
FROM '._DB_PREFIX_.'product_attribute_combination pac
|
||||
LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product_attribute = pac.id_product_attribute)
|
||||
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = pa.id_product)
|
||||
WHERE p.active = 1
|
||||
GROUP BY pac.id_attribute');
|
||||
|
||||
/* Add the missing categories columns */
|
||||
$categories = Db::getInstance()->ExecuteS('
|
||||
SELECT cp.id_category
|
||||
FROM '._DB_PREFIX_.'category_product cp
|
||||
LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category)
|
||||
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = cp.id_product)
|
||||
WHERE p.active = 1 AND c.active = 1
|
||||
GROUP BY cp.id_category');
|
||||
|
||||
foreach ($featureValues AS $featureValue)
|
||||
{
|
||||
$createTable .= '`f'.(int)$featureValue['id_feature_value'].'` TINYINT(1) UNSIGNED NOT NULL DEFAULT \'0\',';
|
||||
$confValue .= 'f'.(int)$featureValue['id_feature_value'].',';
|
||||
}
|
||||
|
||||
foreach ($attributeValues AS $attributeValue)
|
||||
{
|
||||
$createTable .= '`a'.(int)$attributeValue['id_attribute'].'` TINYINT(1) UNSIGNED NOT NULL DEFAULT \'0\',';
|
||||
$confValue .= 'a'.(int)$attributeValue['id_attribute'].',';
|
||||
}
|
||||
|
||||
foreach ($categories AS $category)
|
||||
{
|
||||
$createTable .= '`c'.(int)$category['id_category'].'` TINYINT(1) UNSIGNED NOT NULL DEFAULT \'0\',';
|
||||
$confValue .= 'c'.(int)$category['id_category'].',';
|
||||
}
|
||||
|
||||
Configuration::updateValue('PS_LAYERED_COLUMNS', rtrim($confValue, ','));
|
||||
Db::getInstance()->Execute($createTable.' PRIMARY KEY (`id_product`)) ENGINE=MyISAM CHARSET=latin1');
|
||||
|
||||
/* Delete and re-create the layered categories table */
|
||||
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_category');
|
||||
Db::getInstance()->Execute('
|
||||
@@ -678,7 +665,7 @@ class BlockLayered extends Module
|
||||
`id_layered_category` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_category` INT(10) UNSIGNED NOT NULL,
|
||||
`id_value` INT(10) UNSIGNED NOT NULL DEFAULT \'0\',
|
||||
`type` ENUM(\'category\',\'id_feature\',\'id_attribute_group\',\'quantity\',\'condition\',\'manufacturer\') NOT NULL,
|
||||
`type` ENUM(\'category\',\'id_feature\',\'id_attribute_group\',\'quantity\',\'condition\',\'manufacturer\',\'weight\') NOT NULL,
|
||||
`position` INT(10) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_layered_category`),
|
||||
KEY `id_category` (`id_category`,`type`)
|
||||
@@ -732,15 +719,6 @@ class BlockLayered extends Module
|
||||
WHERE c.active = 1'.(sizeof($categoriesIds) ? ' AND cp.id_category IN ('.implode(',', $categoriesIds).')' : '').' AND p.active = 1'.(sizeof($productsIds) ? ' AND p.id_product IN ('.implode(',', $productsIds).')' : '').' AND (fv.custom IS NULL OR fv.custom = 0)
|
||||
GROUP BY p.id_product', false);
|
||||
|
||||
/* Get all the columns to fill */
|
||||
$columns = explode(',', Configuration::get('PS_LAYERED_COLUMNS'));
|
||||
|
||||
/* We do not need to build the query for products when we are just updating the layered_category table */
|
||||
if (!sizeof($categoriesIds))
|
||||
{
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'layered_cache` VALUES ';
|
||||
$values = '';
|
||||
}
|
||||
while ($product = $db->nextRow($result))
|
||||
{
|
||||
$a = $c = $f = array();
|
||||
@@ -751,27 +729,6 @@ class BlockLayered extends Module
|
||||
if (!empty($product['features']))
|
||||
$f = array_flip(explode(',', $product['features']));
|
||||
|
||||
/* We do not need to build the query for products when we are just updating the layered_category table */
|
||||
if (!sizeof($categoriesIds))
|
||||
{
|
||||
$values .= '(';
|
||||
$n = 0;
|
||||
foreach ($columns AS $column)
|
||||
{
|
||||
if (!$n)
|
||||
$values .= (int)$product['id_product'].',';
|
||||
else
|
||||
{
|
||||
if (isset(${$column{0}}[ltrim($column, $column{0})]))
|
||||
$values .= '1,';
|
||||
else
|
||||
$values .= '0,';
|
||||
}
|
||||
$n++;
|
||||
}
|
||||
$values = rtrim($values, ',').'),';
|
||||
}
|
||||
|
||||
$queryCategory = 'INSERT INTO '._DB_PREFIX_.'layered_category (id_category, id_value, type, position) VALUES ';
|
||||
$toInsert = false;
|
||||
foreach ($c AS $id_category => $category)
|
||||
@@ -816,20 +773,32 @@ class BlockLayered extends Module
|
||||
$queryCategory .= '('.(int)$id_category.',NULL,\'condition\','.(int)$nCategories[(int)$id_category]++.'),';
|
||||
$toInsert = true;
|
||||
}
|
||||
if (!isset($doneCategories[(int)$id_category]['w']))
|
||||
{
|
||||
$doneCategories[(int)$id_category]['w'] = true;
|
||||
$queryCategory .= '('.(int)$id_category.',NULL,\'weight\','.(int)$nCategories[(int)$id_category]++.'),';
|
||||
$toInsert = true;
|
||||
}
|
||||
/*
|
||||
if (!isset($doneCategories[(int)$id_category]['p']))
|
||||
{
|
||||
$doneCategories[(int)$id_category]['p'] = true;
|
||||
$queryCategory .= '('.(int)$id_category.',NULL,\'price\','.(int)$nCategories[(int)$id_category]++.'),';
|
||||
$toInsert = true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
if ($toInsert)
|
||||
Db::getInstance()->Execute(rtrim($queryCategory, ','));
|
||||
}
|
||||
|
||||
/* We do not need to build the query for products when we are just updating the layered_category table */
|
||||
if (!sizeof($categoriesIds))
|
||||
$db->Execute($query.rtrim($values, ','));
|
||||
}
|
||||
|
||||
function filterProducts($products, $selectedFilters, $excludeType = false)
|
||||
{
|
||||
$productsToKeep = array();
|
||||
$filterByLetter = array('id_attribute_group' => 'a', 'id_feature' => 'f', 'category' => 'c', 'manufacturer' => 'id_manufacturer', 'quantity' => 'quantity', 'condition' => 'condition');
|
||||
$filterByLetter = array('id_attribute_group' => 'a', 'id_feature' => 'f', 'category' => 'c', 'manufacturer' => 'id_manufacturer',
|
||||
'quantity' => 'quantity', 'condition' => 'condition', 'weight' => 'weight', 'price' => 'price');
|
||||
|
||||
foreach ($selectedFilters AS $type => $filters)
|
||||
{
|
||||
if ($type == $excludeType OR !sizeof($filters))
|
||||
@@ -841,15 +810,18 @@ class BlockLayered extends Module
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'category':
|
||||
foreach ($products AS $k => $product)
|
||||
if($filter = Tools::getValue('id_category_layered'))
|
||||
$productsToKeep[] = (int)$k;
|
||||
//don't break me
|
||||
case 'id_attribute_group':
|
||||
case 'id_feature':
|
||||
case 'category':
|
||||
foreach ($products AS $k => $product)
|
||||
foreach ($filters AS $filter)
|
||||
if (isset($product[$filterByLetter[$type].(int)$filter]))
|
||||
if (in_array($filter, $product[$filterByLetter[$type]]))
|
||||
$productsToKeep[] = (int)$k;
|
||||
break;
|
||||
|
||||
case 'manufacturer':
|
||||
case 'condition':
|
||||
case 'quantity':
|
||||
@@ -858,6 +830,14 @@ class BlockLayered extends Module
|
||||
if ($product[$filterByLetter[$type]] == $filter)
|
||||
$productsToKeep[] = (int)$k;
|
||||
break;
|
||||
case 'weight':
|
||||
case 'price':
|
||||
$min = $filters[0];
|
||||
$max = $filters[1];
|
||||
foreach ($products AS $k => $product)
|
||||
if((float)$min <= (float)$product[$filterByLetter[$type]] AND (float)$product[$filterByLetter[$type]] <= (float)$max)
|
||||
$productsToKeep[] = (int)$k;
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($products AS $k => $product)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*}
|
||||
|
||||
<!-- Block layered navigation module -->
|
||||
{if $nbr_filterBlocks != 0}
|
||||
<div id="layered_block_left" class="block">
|
||||
<h4>{l s='Catalog' mod='blocklayered'}</h4>
|
||||
<div class="block_content">
|
||||
@@ -35,17 +36,28 @@
|
||||
<span class="layered_subtitle" style="float: none;">{l s='Enabled filters:' mod='blocklayered'}</span>
|
||||
<ul>
|
||||
{foreach from=$selected_filters key=filter_type item=filter_values}
|
||||
{foreach from=$filter_values item=filter_value}
|
||||
{foreach from=$filters item=filter}
|
||||
{if $filter.type == $filter_type && isset($filter.values)}
|
||||
{foreach from=$filter.values key=id_value item=value}
|
||||
{if $id_value == $filter_value}
|
||||
<li><a href="#" rel="layered_{$filter.type_lite}_{$id_value}" title="{l s='Cancel' mod='blocklayered'}">x</a> {$filter.name|escape:html:'UTF-8'}{l s=':'} {$value.name|escape:html:'UTF-8'}</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{foreach from=$filter_values item=filter_value name=f_values}
|
||||
{foreach from=$filters item=filter}
|
||||
{if $filter.type == $filter_type && isset($filter.values)}
|
||||
{if isset($filter.slider) && $smarty.foreach.f_values.first}
|
||||
<li>
|
||||
- {$filter.name|escape:html:'UTF-8'}{l s=':'}
|
||||
{$filter.values[0]|escape:html:'UTF-8'}{$filter.unit|escape:html:'UTF-8'} -
|
||||
{$filter.values[1]|escape:html:'UTF-8'}{$filter.unit|escape:html:'UTF-8'}
|
||||
</li>
|
||||
{else}
|
||||
{foreach from=$filter.values key=id_value item=value}
|
||||
{if $id_value == $filter_value}
|
||||
<li>
|
||||
<a href="#" rel="layered_{$filter.type_lite}_{$id_value}" title="{l s='Cancel' mod='blocklayered'}">x</a>
|
||||
{$filter.name|escape:html:'UTF-8'}{l s=':'} {$value.name|escape:html:'UTF-8'}
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
@@ -57,17 +69,63 @@
|
||||
<span class="layered_close"><a href="#" rel="layered_{$filter.type}_{$filter.id_key}">v</a></span>
|
||||
<div class="clear"></div>
|
||||
<ul id="layered_{$filter.type}_{$filter.id_key}">
|
||||
{foreach from=$filter.values key=id_value item=value}
|
||||
<li{if $layered_use_checkboxes} class="nomargin"{/if}>
|
||||
{if isset($filter.is_color_group) && $filter.is_color_group}
|
||||
<input type="button" name="layered_{$filter.type_lite}_{$id_value}" rel="{$id_value}_{$filter.id_key}" id="layered_attribute_{$id_value}" {if !$value.n} value="X" disabled="disabled"{/if} style="background: {if isset($value.color)}{$value.color}{else}#CCC{/if}; margin-left: 0; width: 16px; height: 16px; padding:0; border: 1px solid {if isset($value.checked) && $value.checked}red{else}#666{/if};" />
|
||||
{if isset($value.checked) && $value.checked}<input type="hidden" name="layered_{$filter.type_lite}_{$id_value}" value="{$id_value}" />{/if}
|
||||
{else}
|
||||
{if $layered_use_checkboxes}<input type="checkbox" class="checkbox" name="layered_{$filter.type_lite}_{$id_value}" id="layered_{$filter.type_lite}{if $id_value || $filter.type == 'quantity'}_{$id_value}{/if}" value="{$id_value}{if $filter.id_key}_{$filter.id_key}{/if}"{if isset($value.checked)} checked="checked"{/if}{if !$value.n} disabled="disabled"{/if} /> {/if}
|
||||
{/if}
|
||||
<label for="layered_{$filter.type_lite}_{$id_value}"{if !$value.n} class="disabled"{else}{if isset($filter.is_color_group) && $filter.is_color_group} name="layered_{$filter.type_lite}_{$id_value}" class="layered_color" rel="{$id_value}_{$filter.id_key}"{/if}{/if}>{$value.name|escape:html:'UTF-8'}<span> ({$value.n})</span></label>
|
||||
</li>
|
||||
{/foreach}
|
||||
{if !isset($filter.slider)}
|
||||
{foreach from=$filter.values key=id_value item=value}
|
||||
<li{if $layered_use_checkboxes} class="nomargin"{/if}>
|
||||
{if isset($filter.is_color_group) && $filter.is_color_group}
|
||||
<input type="button" name="layered_{$filter.type_lite}_{$id_value}" rel="{$id_value}_{$filter.id_key}" id="layered_attribute_{$id_value}" {if !$value.nbr} value="X" disabled="disabled"{/if} style="background: {if isset($value.color)}{$value.color}{else}#CCC{/if}; margin-left: 0; width: 16px; height: 16px; padding:0; border: 1px solid {if isset($value.checked) && $value.checked}red{else}#666{/if};" />
|
||||
{if isset($value.checked) && $value.checked}<input type="hidden" name="layered_{$filter.type_lite}_{$id_value}" value="{$id_value}" />{/if}
|
||||
{else}
|
||||
{if $layered_use_checkboxes}
|
||||
<input type="checkbox" class="checkbox" name="layered_{$filter.type_lite}_{$id_value}" id="layered_{$filter.type_lite}{if $id_value || $filter.type == 'quantity'}_{$id_value}{/if}" value="{$id_value}{if $filter.id_key}_{$filter.id_key}{/if}"{if isset($value.checked)} checked="checked"{/if}{if !$value.nbr} disabled="disabled"{/if} />
|
||||
{/if}
|
||||
{/if}
|
||||
<label for="layered_{$filter.type_lite}_{$id_value}"{if !$value.nbr} class="disabled"{else}{if isset($filter.is_color_group) && $filter.is_color_group} name="layered_{$filter.type_lite}_{$id_value}" class="layered_color" rel="{$id_value}_{$filter.id_key}"{/if}{/if}>{$value.name|escape:html:'UTF-8'}<span> ({$value.nbr})</span></label>
|
||||
</li>
|
||||
{/foreach}
|
||||
{else}
|
||||
<label for="{$filter.type}">{l s='Range'} : </label><span id="layered_{$filter.type}_range"></span>
|
||||
<div style="margin-top:5px;" class="layered_slider" id="layered_{$filter.type}_slider"></div>
|
||||
<script type="text/javascript">
|
||||
unit = '{$filter.unit}';
|
||||
{literal}
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#layered_{/literal}{$filter.type}{literal}_slider').slider({
|
||||
range: true,
|
||||
min: {/literal}{$filter.min}{literal},
|
||||
max: {/literal}{$filter.max}{literal},
|
||||
values: [ {/literal}{$filter.values[0]}{literal}, {/literal}{$filter.values[1]}{literal}],
|
||||
slide: function( event, ui ) {
|
||||
$('#layered_{/literal}{$filter.type}{literal}_range').html(ui.values[ 0 ] + unit + ' - ' + ui.values[ 1 ] + unit);
|
||||
console.log(event);
|
||||
console.log(ui);
|
||||
},
|
||||
stop: function () {
|
||||
reloadContent();
|
||||
}
|
||||
});
|
||||
$('#layered_{/literal}{$filter.type}{literal}_range').html($('#layered_{/literal}{$filter.type}{literal}_slider').slider('values', 0 ) +unit+
|
||||
' - ' + $('#layered_{/literal}{$filter.type}{literal}_slider').slider('values', 1 )+unit );
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
unit = '{$filter.unit}';
|
||||
type = '{$filter.type}';
|
||||
max = '{$filter.max}';
|
||||
min = '{$filter.min}';
|
||||
values = [{$filter.values[0]}, {$filter.values[1]}];
|
||||
{literal}
|
||||
$(document).ready(function()
|
||||
{
|
||||
initSlider(type, min, max, values, unit);
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
-->
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -89,4 +147,5 @@
|
||||
<p style="margin: 20px 0; text-align: center;"><img src="{$img_ps_dir}loader.gif" alt="" /><br />{l s='Loading...' mod='blocklayered'}</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<!-- /Block layered navigation module -->
|
||||
@@ -8,4 +8,5 @@
|
||||
<tab>front_office_features</tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -2,10 +2,11 @@
|
||||
<module>
|
||||
<name>ekomi</name>
|
||||
<displayName>eKomi</displayName>
|
||||
<version>0.8</version>
|
||||
<version>1.0</version>
|
||||
<description>Adds a eKomi block</description>
|
||||
<author></author>
|
||||
<tab>advertising_marketing</tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
</module>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
|
||||
@@ -34,7 +34,7 @@ class Ekomi extends Module
|
||||
{
|
||||
$this->name = 'ekomi';
|
||||
$this->tab = 'advertising_marketing';
|
||||
$this->version = 0.8;
|
||||
$this->version = 1.0;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
@@ -108,9 +108,8 @@ class Ekomi extends Module
|
||||
|
||||
public function hookNewOrder($params)
|
||||
{
|
||||
global $cookie;
|
||||
if (!Configuration::get('PS_EKOMI_EMAIL'))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
/* Email generation */
|
||||
$subject = '[Ekomi-Prestashop] '.Configuration::get('PS_SHOP_NAME');
|
||||
@@ -122,8 +121,8 @@ class Ekomi extends Module
|
||||
);
|
||||
|
||||
/* Email sending */
|
||||
if (!Mail::Send((int)($cookie->id_lang), 'ekomi', $subject, $templateVars, Configuration::get('PS_EKOMI_EMAIL'), NULL, $params['customer']->email, Configuration::get('PS_SHOP_NAME'), NULL, NULL, dirname(__FILE__).'/mails/'))
|
||||
return false;
|
||||
if (!Mail::Send(1, 'ekomi', $subject, $templateVars, Configuration::get('PS_EKOMI_EMAIL'), NULL, $params['customer']->email, Configuration::get('PS_SHOP_NAME'), NULL, NULL, dirname(__FILE__).'/mails/'))
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,10 @@ $_MODULE['<{ekomi}prestashop>ekomi_f4d1ea475eaa85102e2b4e6d95da84bd'] = 'Confirm
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_c888438d14855d7d96a2724ee9c306bd'] = 'Configuración actualizada';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_f4f70727dc34561dfde1a3c529b6205c'] = 'Configuración';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_597b9cfa17df5ac4e2a4b1f4b6de347a'] = 'configuración eKomi';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_c48c140af813696592daafbabe6d8b9f'] = 'script eKomi';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_c4fda5e26d4854b8718850c90694a54c'] = 'eKomi por e-mail';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_c48c140af813696592daafbabe6d8b9f'] = 'script eKomi';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Mostrar';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_b9f5c797ebbf55adccdd8539a65a0241'] = 'Ocultar';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_ccf7919cbd0248b0f86a8c39f74da5d0'] = 'Mostrar o no el bloque (los pedidos serán enviados a eKomi independientemente de que usted elija ocultar o mostrar el bloque).';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_0767b05248fcba405524f792944858ef'] = 'Por favor, rellene el formulario con los datos básicos que eKomi le da.';
|
||||
$_MODULE['<{ekomi}prestashop>ekomi_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar';
|
||||
|
||||
@@ -19,12 +19,15 @@ $_MODULE['<{hipay}prestashop>hipay_527557971b02f68ead6a278fb96ac396'] = 'vérifi
|
||||
$_MODULE['<{hipay}prestashop>hipay_1c5f361b20c116ab2324e28b1ac54e12'] = 'Su tienda no está en línea';
|
||||
$_MODULE['<{hipay}prestashop>hipay_66170e45eb6eb71c35fc3b259a866ff7'] = 'La categoría de productos Hipay no está configurada para cada ID del sitio web';
|
||||
$_MODULE['<{hipay}prestashop>hipay_1a1a01512e42b64541ed9b1f43a56036'] = 'imposible recuperar las categorías Hipay. Vea el diario de errores para más información.';
|
||||
$_MODULE['<{hipay}prestashop>hipay_8f19eb452ad0295c45ca62a099f10dc6'] = 'Hipay es una cartera electrónica segura que le ofrece una paleta de herramientas y de aplicaciones para facturar difertentes tipos de contenidos y de servicios: contenidos numéricos, descargas, bienes físicos... sin necesidad de negociar con un banco y sin gastos técnicos. ';
|
||||
$_MODULE['<{hipay}prestashop>hipay_e5ac60a0713182096ea3f9590f101b25'] = 'Simple y gratuita, la implementación de la solución Hipay constituye una ventaja para un sitio de venta en línea que desea impulsarse en Europa: pagos seguros con tarjetas internacionales, soluciones de pago locales, transferencias bancarias...';
|
||||
$_MODULE['<{hipay}prestashop>hipay_01ad06b7c5887516f56ff824278feb67'] = 'Nota : Para reenvolsar integramente una transacción, vaya al sitio www.hipay.com, en la gestión de venta Hipay/gestión de las ventas.';
|
||||
$_MODULE['<{hipay}prestashop>hipay_74e0ddca931daefcd88f3c118e8eb0f1'] = 'Hipay es un monedero electrónico seguro que tiene el aval bancario europeo. Hipay le ofrece muchas posibilidades, sin necesidad de negociar con un banco. Fácil y de uso gratuito, la solución Hipay constituye una real ventaja para los sitios de venta en línea que desean expandirse por Europa: pagos seguros con tarjetas internacionales, soluciones locales de pago, transferencias bancarias ...';
|
||||
$_MODULE['<{hipay}prestashop>hipay_01ad06b7c5887516f56ff824278feb67'] = 'Nota : Para reenbolsar integramente una transacción, vaya al sitio www.hipay.com, en la gestión de venta Hipay/gestión de las ventas.';
|
||||
$_MODULE['<{hipay}prestashop>hipay_254f642527b45bc260048e30704edb39'] = 'Configuración';
|
||||
$_MODULE['<{hipay}prestashop>hipay_d86590564b22be4d3b242472722bf969'] = 'La configuración de Hipay es muy fácil y funciona en 3 pasos';
|
||||
$_MODULE['<{hipay}prestashop>hipay_f21850b58e4866b30f7d3724cc29edb1'] = 'Acceder a su espacio de venta Hipay';
|
||||
$_MODULE['<{hipay}prestashop>hipay_dc32882bf2b1893d53aeaaa862c46d5c'] = 'Crear una cuenta Hipay';
|
||||
$_MODULE['<{hipay}prestashop>hipay_04c85eb0ee32a3a352e80c9bce37b038'] = 'Activar la solución Hipay en su PrestaShop, ¡es gratis!';
|
||||
$_MODULE['<{hipay}prestashop>hipay_b7ce0a1dce723a074049b88fb22dbb4d'] = 'Disfrutar de precios especiales en las transacciones a través de PrestaShop ';
|
||||
$_MODULE['<{hipay}prestashop>hipay_7667c2b31b9980267cb526ed2f0d235d'] = 'poniéndose en contacto con nuestro departamento de ventas';
|
||||
$_MODULE['<{hipay}prestashop>hipay_08bd40c7543007ad06e4fce31618f6ec'] = 'Cuenta Hipay';
|
||||
$_MODULE['<{hipay}prestashop>hipay_9596f310ab4657258496ab217d3b5d85'] = 'real / producción';
|
||||
$_MODULE['<{hipay}prestashop>hipay_aeda5c9c68fbc42071d76a8d2b3d73e8'] = 'test';
|
||||
|
||||
@@ -22,8 +22,12 @@ $_MODULE['<{hipay}prestashop>hipay_1a1a01512e42b64541ed9b1f43a56036'] = 'Impossi
|
||||
$_MODULE['<{hipay}prestashop>hipay_74e0ddca931daefcd88f3c118e8eb0f1'] = 'Hipay est un portefeuille électronique sécurisé et possédant l\'agrément bancaire européen. Hipay vous offre de nombreuses possibilités sans avoir besoin de négocier avec une banque. Facile et gratuite, l’implémentation de la solution Hipay constitue un véritable atout pour un site e-commerce qui souhaite se développer en Europe : paiements sécurisés par cartes internationales, solutions de paiement locales, virements bancaires...';
|
||||
$_MODULE['<{hipay}prestashop>hipay_01ad06b7c5887516f56ff824278feb67'] = 'Note : Pour rembourser intégralement une transaction, veuillez vous rendre sur le site www.hipay.com, dans la gestion marchande Hipay/gestion des ventes.';
|
||||
$_MODULE['<{hipay}prestashop>hipay_254f642527b45bc260048e30704edb39'] = 'Configuration';
|
||||
$_MODULE['<{hipay}prestashop>hipay_d86590564b22be4d3b242472722bf969'] = 'La configuration de Hipay est vraiment facile et fonctionne en 3 étapes';
|
||||
$_MODULE['<{hipay}prestashop>hipay_f21850b58e4866b30f7d3724cc29edb1'] = 'Accédez à votre espace marchand Hipay';
|
||||
$_MODULE['<{hipay}prestashop>hipay_dc32882bf2b1893d53aeaaa862c46d5c'] = 'Créez un compte Hipay';
|
||||
$_MODULE['<{hipay}prestashop>hipay_04c85eb0ee32a3a352e80c9bce37b038'] = 'Activer la solution Hipay dans votre PrestaShop, c\'est gratuit !';
|
||||
$_MODULE['<{hipay}prestashop>hipay_b7ce0a1dce723a074049b88fb22dbb4d'] = 'Profitez de tarifs préférentiels sur les transactions via Prestashop en';
|
||||
$_MODULE['<{hipay}prestashop>hipay_7667c2b31b9980267cb526ed2f0d235d'] = 'contactant notre département des ventes';
|
||||
$_MODULE['<{hipay}prestashop>hipay_08bd40c7543007ad06e4fce31618f6ec'] = 'Compte Hipay';
|
||||
$_MODULE['<{hipay}prestashop>hipay_9596f310ab4657258496ab217d3b5d85'] = 'réel / production';
|
||||
$_MODULE['<{hipay}prestashop>hipay_aeda5c9c68fbc42071d76a8d2b3d73e8'] = 'test';
|
||||
|
||||
@@ -48,6 +48,7 @@ $_MODULE['<{loyalty}prestashop>loyalty_928666bdf20510dfa5c58393b77f1798'] = 'Val
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_a9be824aae4f2381a27b7c699b1e041e'] = 'En espera de validación';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_78945de8de090e90045d299651a68a9b'] = 'Disponibles';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_4cb08bf5ad3d3c7b010dde725a078b28'] = 'Convertidos';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_df05c2db84dacb19b599b489bf3963db'] = 'No disponible en los descuentos';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_01371a1d58e9234c0b9dbc08cf54fa8b'] = 'No válidos en descuentos';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_d95cf4ab2cbf1dfb63f066b50558b07d'] = 'Mi cuenta:';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_c540093e64d84440025b2d8201f04336'] = 'Mis puntos recompensa';
|
||||
|
||||
@@ -48,6 +48,7 @@ $_MODULE['<{loyalty}prestashop>loyalty_928666bdf20510dfa5c58393b77f1798'] = 'Val
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_a9be824aae4f2381a27b7c699b1e041e'] = 'En attente de validation';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_78945de8de090e90045d299651a68a9b'] = 'Disponibles';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_4cb08bf5ad3d3c7b010dde725a078b28'] = 'Déjà convertis';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_df05c2db84dacb19b599b489bf3963db'] = 'Non disponible sur les remises';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_01371a1d58e9234c0b9dbc08cf54fa8b'] = 'Non valables sur les promotions';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_d95cf4ab2cbf1dfb63f066b50558b07d'] = 'Mon compte';
|
||||
$_MODULE['<{loyalty}prestashop>loyalty_c540093e64d84440025b2d8201f04336'] = 'Mes points de fidélité';
|
||||
|
||||
@@ -48,6 +48,7 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_90b95ae88150c6a34c4129dc4f1ebbd
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_c15b40b8c535191f6f0b6f9beaced3cf'] = 'Seguro complementario N4';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_b67a442fff3ca0a03ea253b0668f946d'] = 'Seguro complementario N5';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_33cbd0d8b6476501f55a8320481ec0f1'] = 'Lista de países :';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_aef71ba4fd060dea2e2c76d1b5076caf'] = 'Puede elegir varios países pulsando Ctrl mientras selecciona los países';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_0309a6c666a7a803fdb9db95de71cf01'] = 'Francia';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_6c1674d14bf5f95742f572cddb0641a7'] = 'Bélgica';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_06630c890abadde9228ea818ce52b621'] = 'Luxemburgo';
|
||||
@@ -120,6 +121,7 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_6c530987d533793b0f25fb18807b69c
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_3d2da0d2e731d59465a92f13216cf82d'] = 'La página señas';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_06b3355cd8a61603396c7e453bdb1025'] = 'Dirección vacía: ¿está seguro de haber introducio una dirección válida en la página Señas?';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_2f84f9d5731852c4d07d52ef0badc42e'] = 'Problemas para obtener las direcciones de servicio web MondialRelay: los servidores de Mondial Relay pueden estar fuera de servicio';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_016854c68c7122b18d89ff0f5e40502b'] = 'No hay Punto de entrega cerca de su domicilio, por favor cambie su dirección o utilice otro modo de transporte';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_21034ae6d01a83e702839a72ba8a77b0'] = '(sin IVA)';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_1f87346a16cf80c372065de3c54c86d9'] = '(IVA incluido)';
|
||||
$_MODULE['<{mondialrelay}prestashop>mondialrelay_e7a6ca4e744870d455a57b644f696457'] = '¡Gratis!';
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<div style="float: left; margin-left: 20px; margin-bottom: 10px;">
|
||||
{$c.name|escape:'html':'UTF-8'}<br />
|
||||
{section loop=6 step=1 start=1 name=average}
|
||||
<input class="auto-submit-star" disabled="disabled" type="radio" name="{$c.name|escape:'html':'UTF-8'}_{$smarty.section.average.index}" value="{$smarty.section.average.index}" {if $averages[$c.id_product_comment_criterion]|round neq 0 and $smarty.section.average.index eq $averages[$c.id_product_comment_criterion]|round}checked="checked"{/if} />
|
||||
<input class="auto-submit-star" disabled="disabled" type="radio" name="{$c.name|escape:'html':'UTF-8'}_{$smarty.section.average.index}" value="{$smarty.section.average.index}" {if isset($averages[$c.id_product_comment_criterion]) AND $averages[$c.id_product_comment_criterion]|round neq 0 AND $smarty.section.average.index eq $averages[$c.id_product_comment_criterion]|round}checked="checked"{/if} />
|
||||
{/section}
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
@@ -62,9 +62,9 @@
|
||||
{foreach from=$list_ids_product item=id_product}
|
||||
{assign var='tab_grade' value=$product_grades[$grade_id]}
|
||||
<td width="{$width}%" class="{$classname} comparison_infos ajax_block_product" align="center">
|
||||
{if $tab_grade[$id_product]}
|
||||
{if isset($tab_grade[$id_product]) AND $tab_grade[$id_product]}
|
||||
{section loop=6 step=1 start=1 name=average}
|
||||
<input class="auto-submit-star" disabled="disabled" type="radio" name="{$grade_id}_{$product_id}_{$smarty.section.average.index}" {if $tab_grade[$id_product]|round neq 0 and $smarty.section.average.index eq $tab_grade[$id_product]|round}checked="checked"{/if} />
|
||||
<input class="auto-submit-star" disabled="disabled" type="radio" name="{$grade_id}_{$product_id}_{$smarty.section.average.index}" {if isset($tab_grade[$id_product]) AND $tab_grade[$id_product]|round neq 0 and $smarty.section.average.index eq $tab_grade[$id_product]|round}checked="checked"{/if} />
|
||||
{/section}
|
||||
{else}
|
||||
-
|
||||
@@ -79,7 +79,7 @@
|
||||
<td class="{$classname} comparison_infos">{l s='Average' mod='productcomments'}</td>
|
||||
{foreach from=$list_ids_product item=id_product}
|
||||
<td width="{$width}%" class="{$classname} comparison_infos" align="center" >
|
||||
{if $list_product_average[$id_product]}
|
||||
{if isset($list_product_average[$id_product]) AND $list_product_average[$id_product]}
|
||||
{section loop=6 step=1 start=1 name=average}
|
||||
<input class="auto-submit-star" disabled="disabled" type="radio" name="average_{$id_product}" {if $list_product_average[$id_product]|round neq 0 and $smarty.section.average.index eq $list_product_average[$id_product]|round}checked="checked"{/if} />
|
||||
{/section}
|
||||
@@ -94,7 +94,7 @@
|
||||
<td class="{$classname} comparison_infos"> </td>
|
||||
{foreach from=$list_ids_product item=id_product}
|
||||
<td width="{$width}%" class="{$classname} comparison_infos" align="center" >
|
||||
{if $product_comments[$id_product]}
|
||||
{if isset($product_comments[$id_product]) AND $product_comments[$id_product]}
|
||||
<a href="#" rel="#comments_{$id_product}" class="cluetip">{l s='view comments' mod='productcomments'}</a>
|
||||
<div style="display:none" id="comments_{$id_product}">
|
||||
{foreach from=$product_comments[$id_product] item=comment}
|
||||
|
||||
@@ -10,6 +10,7 @@ $_MODULE['<{producttooltip}prestashop>producttooltip_93cba07454f06a4a960172bbd6e
|
||||
$_MODULE['<{producttooltip}prestashop>producttooltip_bafd7322c6e97d25b6299b5d6fe8920b'] = 'No';
|
||||
$_MODULE['<{producttooltip}prestashop>producttooltip_2c8de3180924949acc5f6250af689802'] = 'Periodo de validez:';
|
||||
$_MODULE['<{producttooltip}prestashop>producttooltip_640fd0cc0ffa0316ae087652871f4486'] = 'minutos';
|
||||
$_MODULE['<{producttooltip}prestashop>producttooltip_8a8110f8a25a0e445f51edf84fd98a96'] = 'Si activa la opción anterior, debe activar la primera opción del módulo StatData';
|
||||
$_MODULE['<{producttooltip}prestashop>producttooltip_1e358b149c2d4105f3a74c1961d1d9fb'] = '¿Mostrar la fecha del último pedido?';
|
||||
$_MODULE['<{producttooltip}prestashop>producttooltip_69cd5a64d37c70989558b58f0b484fb3'] = 'Si no hay pedido, ¿mostrar la última vez que un producto ha sido añadido al carrito?';
|
||||
$_MODULE['<{producttooltip}prestashop>producttooltip_a536f110cc080569666e95e8f49fda9b'] = 'No mostrar los acontecimientos de más de:';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>trustedshops</name>
|
||||
<displayName>Trusted Shops Customer Rating</displayName>
|
||||
<version>1.1</version>
|
||||
<version>1.2</version>
|
||||
<description>Boost consumer confidence and turn more shoppers into buyers.</description>
|
||||
<author></author>
|
||||
<tab>payment_security</tab>
|
||||
|
||||
@@ -4,6 +4,12 @@ global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_02ecb4a4709d9bcc590f1a25fc82c0e2'] = 'Trusted Shops protección comprador (recomendado)';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_b55aab8932a39ca85bb0a1b6eb83f83f'] = 'Protección comprador hasta';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_a53a5a9f38f31d62a791717b943e02f3'] = 'EUR IVA incluído';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_b3c25d2f94cf87ece3dbb2907318520c'] = 'La protección comprador Trusted Shops hace su compra en línea segura. Acepto que mi email sea trasferido y';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_536a056b710e94b16169efd17a4a657b'] = 'guardado';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_2dc4be4d5564180e6df95d5a5a679195'] = 'para el tratamiento de la protección comprador por Trusted Shops.';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_229eb04083e06f419f9ac494329f957d'] = 'Condiciones';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_4ccaceceffe4b5e58f6a7a7ed3ced4c4'] = 'para la protección del comprador.';
|
||||
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_7b5406da2d5f15923d6b01d3264c5619'] = 'Cuño Trusted Shops- Pulse aquí para comprobar';
|
||||
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_4052048c767f22e9071c3e6f404d00c6'] = 'Como miembro de Trusted Shops, le ofrecemos un servicio complementario excepcional: la garantía de reembolso Trusted Shops. ';
|
||||
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_f975f42362625cf21e592009ff4b3d7b'] = 'Inscríbase para obtener la garantía de reembolso de Trusted Shops. ';
|
||||
@@ -85,6 +91,7 @@ $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_259060bb469ed1256c2e758e32
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_8512ae7d57b1396273f76fe6ed341a23'] = 'idioma';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_f7ea4ac740662d2427d1ef1f2695206d'] = 'ha sido suprimido';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_3fb2ea84b90d4ea9fab48ea356a2319b'] = 'Se ha añadido el login del certificado';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_b18f5630d5ffdfcee5ab0a44ee6e1eb6'] = 'Tiene que crear un nombre de usuario y una contraseña antes de efectuar cualquier cambio.';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_e32263743aac776e5e32fc385d8b669a'] = 'Trusted Shops es el sello de calidad europea para sitios de venta en línea con garantía de reembolso para sus clientes. En el momento de la certificación, su tienda está sometida a una auditoría que agrupa más de 1000 criterios diferentes que respetan las exigencias de las asociaciones de protección de los consumidores, así como las legislaciones nacionales y europeas. ';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_2c786e15a571a442adf85460e6358883'] = '¡Más confianza implica más ventas!';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_e06f60bb083e167516a94aafd5a3a2e2'] = 'El sello de calidad Trusted Shops es ideal para aumentar la confianza de los clientes en su tienda en línea. Cuanto más confíen los clientes en su sitio Wab, más compras realizarán el el mismo.';
|
||||
@@ -92,6 +99,8 @@ $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_8dd66ca6788218bd7d2ba7fe43
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_26286e2764ccde55c99d1b258315aa1a'] = 'Puede proponer a sus clientes en línea un argumento importante: la protección comprador Trusted Shops que asegura al cliente en caso de no reembolso o si no reciba la mercancía. Este seguro suplementario permite reducir la interrupción de los pedidos. ';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_710142158c105c01ef807ce959cbc451'] = 'Una fidelización clientela fructuosa y durable';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_f7e15d97ad927ef705de61e787883ada'] = 'Para aumentar las compras en línea, el sello de calidad Trusted Shops con protección comprador es un criterio de calidad durable para compras en línea seguras. Es una manera de transformar clientes únicos en clientes fieles. ';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_7442a1e0ab5e2e26ca9363d226b93d13'] = 'Ambiente tipo';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_8e77e16312de3f95afdf5b92b10232a2'] = 'En este momento está usando el modo:';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_dc62561dd8d390e274487516e869fc93'] = 'Obtenir el link de registro';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_5c93149208b3885248b960eb22e6ba49'] = 'Esta variable ha sido enviada por email por Tructed Shops';
|
||||
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_233a96df2f68dbeafaa3126edadc1ce8'] = 'Identificación interna del software de la tienda en Trusted Shops';
|
||||
|
||||
@@ -8,6 +8,7 @@ $_MODULE['<{trustedshops}prestashop>display_products_a53a5a9f38f31d62a791717b943
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_b3c25d2f94cf87ece3dbb2907318520c'] = 'La protection acheteur Trusted Shops sécurise votre achat en ligne. J’accepte le transfert et la';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_536a056b710e94b16169efd17a4a657b'] = 'sauvegarde';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_2dc4be4d5564180e6df95d5a5a679195'] = 'de mon adresse email pour le traitement de la protection acheteur par Trusted Shops.';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_229eb04083e06f419f9ac494329f957d'] = 'Conditions';
|
||||
$_MODULE['<{trustedshops}prestashop>display_products_4ccaceceffe4b5e58f6a7a7ed3ced4c4'] = 'pour la protection acheteur.';
|
||||
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_7b5406da2d5f15923d6b01d3264c5619'] = 'Sceau Trusted Shops - Cliquez pour le verifier.';
|
||||
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_4052048c767f22e9071c3e6f404d00c6'] = 'En tant que membre Trusted Shops, nous vous offrons un service complémentaire exceptionnel: la garantie de remboursement Trusted Shops. Les frais relatifs à cette garantie sont entièrement à notre charge, alors n\'hésitez pas, il vous suffit de vous inscrire.';
|
||||
|
||||
@@ -42,7 +42,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
const DB_APPLI = 'ts_application_id';
|
||||
const WEBSERVICE_BO = 'administration';
|
||||
const WEBSERVICE_FO = 'front-end';
|
||||
|
||||
|
||||
/**
|
||||
* List of registration link, need to add parameters
|
||||
* @see TSBuyerProtection::_getRegistrationLink()
|
||||
@@ -54,7 +54,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
'FR' => 'http://www.trustedshops.com/marchands/affiliation.html',
|
||||
'PL' => 'http://www.trustedshops.pl/handlowcy/cennik.html',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Link to obtain the certificate about the shop.
|
||||
* Use by seal of approval.
|
||||
@@ -67,22 +67,22 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
'FR' => 'http://www.trustedshops.fr',
|
||||
'PL' => 'http://www.trustedshops.de/profil/#shop_name#_#shop_id#.html',
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Available language for used TrustedShops Buyer Protection
|
||||
* @see TSBuyerProtection::__construct()
|
||||
* @var array
|
||||
*/
|
||||
private $available_languages = array('EN'=>'', 'FR'=>'', 'DE'=>'', 'PL'=>'', );
|
||||
|
||||
|
||||
/**
|
||||
* @todo : be sure : see TrustedShopsRating::__construct()
|
||||
* @var array
|
||||
*/
|
||||
public $limited_countries = array('PL', 'GB', 'US', 'FR', 'DE');
|
||||
|
||||
|
||||
/**
|
||||
* Differents urls to call for Trusted Shops API
|
||||
* Differents urls to call for Trusted Shops API
|
||||
* @var array
|
||||
*/
|
||||
private static $webservice_urls = array(
|
||||
@@ -95,12 +95,12 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
'production' => 'https://protection.trustedshops.com/ts/protectionservices/ApplicationRequestService?wsdl',
|
||||
),
|
||||
);
|
||||
|
||||
// Configuration vars
|
||||
|
||||
// Configuration vars
|
||||
private static $SHOPSW;
|
||||
private static $ET_CID;
|
||||
private static $ET_LID;
|
||||
|
||||
|
||||
/**
|
||||
* Its must look like :
|
||||
* array(
|
||||
@@ -113,19 +113,19 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
private static $DEFAULT_LANG;
|
||||
private static $CAT_ID;
|
||||
private static $ENV_API;
|
||||
|
||||
|
||||
/**
|
||||
* save shop url
|
||||
* @var string
|
||||
*/
|
||||
private $site_url;
|
||||
|
||||
|
||||
/**
|
||||
* Payment type used by Trusted Shops.
|
||||
* @var array
|
||||
*/
|
||||
private static $payments_type;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// need to set this in constructor to allow translation
|
||||
@@ -177,16 +177,16 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!method_exists('Tools', 'jsonDecode') || !method_exists('Tools', 'jsonEncode'))
|
||||
return false;
|
||||
|
||||
foreach ($this->available_languages as $iso=>$lang)
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.strtoupper($iso),
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.strtoupper($iso),
|
||||
Tools::htmlentitiesUTF8(Tools::jsonEncode(array('stateEnum'=>'', 'typeEnum'=>'', 'url'=>'', 'tsID'=>'', 'user'=>'', 'password'=>''))));
|
||||
|
||||
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'SHOPSW', '');
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ET_CID', '');
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ET_LID', '');
|
||||
@@ -206,7 +206,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
);
|
||||
';
|
||||
Db::getInstance()->Execute($req);
|
||||
|
||||
|
||||
$req = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.TSBuyerProtection::DB_APPLI.'` (
|
||||
`id_application` INT NOT NULL PRIMARY KEY,
|
||||
`ts_id` VARCHAR( 33 ) NOT NULL,
|
||||
@@ -217,16 +217,16 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
);
|
||||
';
|
||||
Db::getInstance()->Execute($req);
|
||||
|
||||
|
||||
//add hidden category
|
||||
$category = new Category();
|
||||
$languages = Language::getLanguages(true);
|
||||
foreach ($this->available_languages as $iso=>$lang)
|
||||
foreach ($this->available_languages as $iso=>$lang)
|
||||
{
|
||||
$category->name[Language::getIdByIso(strtolower($iso))] = 'Trustedshops';
|
||||
$category->link_rewrite[Language::getIdByIso(strtolower($iso))] = 'trustedshops';
|
||||
}
|
||||
|
||||
|
||||
// If the default lang is different than available languages :
|
||||
// (Bug occurred otherwise)
|
||||
if (!array_key_exists(Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')), $this->available_languages))
|
||||
@@ -234,7 +234,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$category->name[(int)Configuration::get('PS_LANG_DEFAULT')] = 'Trustedshops';
|
||||
$category->link_rewrite[(int)Configuration::get('PS_LANG_DEFAULT')] = 'trustedshops';
|
||||
}
|
||||
|
||||
|
||||
$category->id_parent = 0;
|
||||
$category->level_depth = 0;
|
||||
$category->active = 0;
|
||||
@@ -242,12 +242,12 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CAT_ID', intval($category->id));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
foreach ($this->available_languages as $iso=>$lang)
|
||||
Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.strtoupper($iso));
|
||||
|
||||
|
||||
$category = new Category((int)TSBuyerProtection::$CAT_ID);
|
||||
$category->delete();
|
||||
Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE.'CAT_ID');
|
||||
@@ -257,7 +257,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE.'ENV_API');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Just for return the file path
|
||||
* @return string
|
||||
@@ -266,11 +266,11 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
{
|
||||
return $this->site_url.'modules/'.self::$module_name.'/cron_garantee.php';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is used to access of TrustedShops API
|
||||
* from a SoapClient object.
|
||||
*
|
||||
*
|
||||
* @uses TSBuyerProtection::$webservice_urls with TSBuyerProtection::$ENV_API
|
||||
* To get the api url according to the environment (test or production)
|
||||
* @param string $type
|
||||
@@ -282,11 +282,11 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$client = new SoapClient($url);
|
||||
return $client;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks the Trusted Shops IDs entered in the shop administration
|
||||
* and returns the characteristics of the corresponding certificate.
|
||||
*
|
||||
*
|
||||
* @uses TSBuyerProtection::_getClient()
|
||||
* @param string $certificate certificate code already send by Trusted Shops
|
||||
*/
|
||||
@@ -307,13 +307,13 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
} catch (SoapFault $fault) {
|
||||
$this->errors[] = $this->l('Code #').$fault->faultcode.',<br />'.$this->l('message:').$fault->faultstring;
|
||||
}
|
||||
|
||||
|
||||
if(is_int($validation))
|
||||
throw new TSBPException($validation, TSBPException::ADMINISTRATION);
|
||||
|
||||
|
||||
if (!$validation OR array_key_exists($validation->stateEnum, $array_state))
|
||||
{
|
||||
if ($validation->stateEnum === 'TEST' || $validation->stateEnum === 'PRODUCTION')
|
||||
if ($validation->stateEnum === 'TEST' || $validation->stateEnum === 'PRODUCTION' || $validation->stateEnum === 'INTEGRATION')
|
||||
{
|
||||
$this->confirmations[] = $array_state[$validation->stateEnum];
|
||||
return $validation;
|
||||
@@ -329,10 +329,10 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$this->errors[] = $this->l('Unknown error.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks the shop's web service access credentials.
|
||||
*
|
||||
*
|
||||
* @uses TSBuyerProtection::_getClient()
|
||||
* @param string $ts_id
|
||||
* @param string $user
|
||||
@@ -349,14 +349,14 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
}
|
||||
if ($return < 0)
|
||||
throw new TSBPException($return, TSBPException::ADMINISTRATION);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the characteristics of the buyer protection products
|
||||
* Returns the characteristics of the buyer protection products
|
||||
* that are allocated individually to each certificate by Trusted Shops.
|
||||
*
|
||||
*
|
||||
* @uses TSBuyerProtection::_getClient()
|
||||
* @param string $ts_id
|
||||
*/
|
||||
@@ -372,10 +372,10 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
return $items->item;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check validity for params required for TSBuyerProtection::_requestForProtectionV2()
|
||||
*
|
||||
*
|
||||
* @param array $params
|
||||
*/
|
||||
private function _requestForProtectionV2ParamsValidator(array $params)
|
||||
@@ -413,7 +413,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
if(isset($key['ereg']))
|
||||
$bool_flag = !preg_match($key['ereg'], $params[$key['name']]) ? false : $bool_flag ;
|
||||
}
|
||||
|
||||
|
||||
if (!$bool_flag)
|
||||
{
|
||||
$this->errors[] = sprintf($this->l('The field %s is wrong, please ensure it was correctly filled.'), $key['name']);
|
||||
@@ -421,13 +421,13 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
}
|
||||
}
|
||||
return $bool_flag;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the Buyer Protection application by the web service.
|
||||
* Applications are saved by Trusted Shops and are processed at regular intervals.
|
||||
*
|
||||
*
|
||||
* @uses TSBuyerProtection::_getClient()
|
||||
* @uses TSBuyerProtection::_requestForProtectionV2ParamsValidator()
|
||||
* to check required params
|
||||
@@ -445,13 +445,13 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
WHERE `id_order` = "'.$params['shopOrderID'].'"
|
||||
';
|
||||
$order = Db::getInstance()->ExecuteS($sql);
|
||||
|
||||
|
||||
// If an order was already added, no need to continue.
|
||||
// Otherwise a new application is created by TrustedShops.
|
||||
// this can occured when order confirmation page is reload.
|
||||
if(isset($order[0]))
|
||||
return false;
|
||||
|
||||
|
||||
if ($testing_params)
|
||||
{
|
||||
try {
|
||||
@@ -467,7 +467,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
{
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$sql = '
|
||||
INSERT INTO `'._DB_PREFIX_.TSBuyerProtection::DB_APPLI.'`
|
||||
INSERT INTO `'._DB_PREFIX_.TSBuyerProtection::DB_APPLI.'`
|
||||
(
|
||||
`id_application`,
|
||||
`ts_id`,
|
||||
@@ -485,7 +485,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
)
|
||||
';
|
||||
Db::getInstance()->Execute($sql);
|
||||
|
||||
|
||||
// To reset product quantity in database.
|
||||
$sql = '
|
||||
SELECT `id_product`
|
||||
@@ -501,13 +501,13 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
else
|
||||
$this->errors[] = $this->l('Some parameters sending to "requestForProtectionV2" method are wrong or missing.');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* With the getRequestState() method,
|
||||
* the status of a guarantee application is requested
|
||||
* the status of a guarantee application is requested
|
||||
* and in the event of a successful transaction,
|
||||
* the guarantee number is returned.
|
||||
*
|
||||
*
|
||||
* @uses TSBuyerProtection::_getClient()
|
||||
* @param array $params
|
||||
* @throws TSBPException
|
||||
@@ -527,22 +527,22 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check statut of last applications
|
||||
* Check statut of last applications
|
||||
* saved with TSBuyerProtection::_requestForProtectionV2()
|
||||
*
|
||||
*
|
||||
* Negative value means an error occured.
|
||||
* Error code are managed in TSBPException.
|
||||
* @see (exception) TSBPException::_getFrontEndMessage() method
|
||||
*
|
||||
* Trusted Shops recommends that the request
|
||||
*
|
||||
* Trusted Shops recommends that the request
|
||||
* should be automated by a cronjob with an interval of 10 minutes.
|
||||
* @see /../cron_garantee.php
|
||||
*
|
||||
*
|
||||
* A message is added to the sheet order in Back-office,
|
||||
* @see Message class
|
||||
*
|
||||
*
|
||||
* @uses TSBuyerProtection::_getRequestState()
|
||||
* @uses Message class
|
||||
* @return void
|
||||
@@ -584,10 +584,10 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$msg->add();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Registration link to Trusted Shops
|
||||
*
|
||||
*
|
||||
* @param string $shopsw
|
||||
* @param string $et_cid
|
||||
* @param string $et_lid
|
||||
@@ -601,22 +601,22 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
return $this->registration_link[$lang].sprintf('?shopsw=%s&et_cid=%s&et_lid=%s', urlencode($shopsw), urlencode($et_cid), urlencode($et_lid));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to display or redirect the subscription link.
|
||||
*
|
||||
*
|
||||
* @param string $link
|
||||
*/
|
||||
private function _getRegistrationLink($link)
|
||||
{
|
||||
|
||||
|
||||
return '<script type="text/javascript" >$().ready(function(){window.open("'.$link.'");});</script>
|
||||
<noscript><p><a href="'.$link.'" target="_blank" title="'.$this->l('Registration Link').'" class="link">'.$this->l('Click to get the Registration Link').'</a><p></noscript>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* saved paramter to acces of particular subscribtion link.
|
||||
*
|
||||
*
|
||||
* @return string the registration link.
|
||||
*/
|
||||
private function _submitRegistrationLink()
|
||||
@@ -625,7 +625,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
TSBuyerProtection::$SHOPSW = (Validate::isCleanHtml(Tools::getValue('shopsw'))) ? Tools::getValue('shopsw') : '';
|
||||
TSBuyerProtection::$ET_CID = (Validate::isCleanHtml(Tools::getValue('et_cid'))) ? Tools::getValue('et_cid') : '';
|
||||
TSBuyerProtection::$ET_LID = (Validate::isCleanHtml(Tools::getValue('et_lid'))) ? Tools::getValue('et_lid') : '';
|
||||
|
||||
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'SHOPSW', TSBuyerProtection::$SHOPSW);
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ET_CID', TSBuyerProtection::$ET_CID);
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ET_LID', TSBuyerProtection::$ET_LID);
|
||||
@@ -633,12 +633,12 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$this->confirmations[] = $this->l('Registration link has been created. Follow this link if you was not redirected ealier:').' <a href="'.$link_registration.'" class="link">>'.$this->l('Link').'<</a>';
|
||||
return $link_registration;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save in special database each buyer protection product for a certificate,
|
||||
* Each Trusted Shops particular characteristics is saved.
|
||||
* Create a product in Prestashop database to allow added each of them in cart.
|
||||
*
|
||||
*
|
||||
* @param array|stdClass $protection_items
|
||||
* @param string $ts_id
|
||||
*/
|
||||
@@ -651,12 +651,12 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
LEFT JOIN `ps_product_lang` AS pl ON ts.`id_product` = pl.`id_product`
|
||||
WHERE ts.`ts_id`="'.$ts_id.'"';
|
||||
Db::getInstance()->Execute($sql);
|
||||
|
||||
|
||||
foreach ($protection_items as $key=>$item)
|
||||
{
|
||||
//add hidden product
|
||||
$product = new Product();
|
||||
foreach ($this->available_languages as $iso=>$lang)
|
||||
foreach ($this->available_languages as $iso=>$lang)
|
||||
{
|
||||
$language = Language::getIdByIso(strtolower($iso));
|
||||
if ((int)$language !== 0)
|
||||
@@ -665,7 +665,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$product->link_rewrite[$language] = 'trustedshops_garantee';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If the default lang is different than available languages :
|
||||
// (Bug occurred otherwise)
|
||||
if (!array_key_exists(Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')), $this->available_languages))
|
||||
@@ -679,7 +679,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$product->active = true;
|
||||
$product->id_tax = 0;
|
||||
$product->add();
|
||||
|
||||
|
||||
if ($product->id)
|
||||
{
|
||||
$sql = '
|
||||
@@ -713,11 +713,11 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check and add a Trusted Shops certificate in shop.
|
||||
*
|
||||
* @uses TSBuyerProtection::_getProtectionItems()
|
||||
*
|
||||
* @uses TSBuyerProtection::_getProtectionItems()
|
||||
* to get all buyer protection products from Trusted Shops
|
||||
* @uses TSBuyerProtection::_saveProtectionItems()
|
||||
* to save buyer protection products in shop
|
||||
@@ -734,7 +734,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
if ($checked_certificate)
|
||||
{
|
||||
TSBuyerProtection::$CERTIFICATE[strtoupper($checked_certificate->certificationLanguage)] = array('stateEnum'=>$checked_certificate->stateEnum, 'typeEnum'=>$checked_certificate->typeEnum, 'url'=>$checked_certificate->url, 'tsID'=>$checked_certificate->tsID, 'user'=>'', 'password'=>'');
|
||||
|
||||
|
||||
// update the configuration var
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.strtoupper($checked_certificate->certificationLanguage), Tools::htmlentitiesUTF8(Tools::jsonEncode(TSBuyerProtection::$CERTIFICATE[strtoupper($checked_certificate->certificationLanguage)])));
|
||||
$this->confirmations[] = $this->l('Certificate has been well added.');
|
||||
@@ -752,11 +752,11 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Apply delete or edit action to a certificate
|
||||
*
|
||||
* @return boolean|array
|
||||
*
|
||||
* @return boolean|array
|
||||
* - false if action concerned multiple certificate
|
||||
* (in normal way, this never occured )
|
||||
* - return required $certificate to edit.
|
||||
@@ -771,7 +771,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$this->errors[] = $this->l('You must edit or delete a Certificate one per one');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// delete action :
|
||||
if (is_array($delete) AND isset(TSBuyerProtection::$CERTIFICATE[$delete[0]]['tsID']))
|
||||
{
|
||||
@@ -782,7 +782,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
.' "'.$certificate_to_delete.'" ('.$this->l('language').' : '.$delete[0].') '
|
||||
.$this->l('has been well deleted');
|
||||
}
|
||||
|
||||
|
||||
// edit action :
|
||||
if (is_array($edit))
|
||||
{
|
||||
@@ -792,12 +792,12 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change the certificate values.
|
||||
* concerns only excellence certificate
|
||||
* concerns only excellence certificate
|
||||
* for payment type, login and password values.
|
||||
*
|
||||
*
|
||||
* @uses TSBuyerProtection::_checkLogin()
|
||||
* @return true;
|
||||
*/
|
||||
@@ -816,7 +816,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
foreach ($all_payment_type as $key=>$module_id)
|
||||
TSBuyerProtection::$CERTIFICATE[$iso_lang]['payment_type'][(string)$key] = $module_id;
|
||||
}
|
||||
|
||||
|
||||
$check_login = false;
|
||||
try {
|
||||
$check_login = $this->_checkLogin(TSBuyerProtection::$CERTIFICATE[$iso_lang]['tsID'], $user, $password);
|
||||
@@ -829,7 +829,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
TSBuyerProtection::$CERTIFICATE[$iso_lang]['password'] = $password;
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.$iso_lang, Tools::htmlentitiesUTF8(Tools::jsonEncode(TSBuyerProtection::$CERTIFICATE[$iso_lang])));
|
||||
$this->confirmations[] = $this->l('Certificate login has been well added.');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -838,7 +838,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change the environment for working.
|
||||
* Not use anymore but keeped
|
||||
@@ -859,10 +859,10 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
TSBuyerProtection::$ENV_API = $env_api;
|
||||
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ENV_API', TSBuyerProtection::$ENV_API);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dispatch post process depends on each formular
|
||||
*
|
||||
*
|
||||
* @return array depend on the needs about each formular.
|
||||
*/
|
||||
private function _preProcess()
|
||||
@@ -878,10 +878,10 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$posts_return['change_certificate'] = $this->_submitChangeCertificate();
|
||||
return $posts_return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display each formaular in back-office
|
||||
*
|
||||
*
|
||||
* @see Module::getContent()
|
||||
* @return string for displaying form.
|
||||
*/
|
||||
@@ -899,12 +899,12 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$out .= '<br />';
|
||||
$out .= $this->_displayFormAddCertificate();
|
||||
$out .= '<br />';
|
||||
|
||||
|
||||
$bool_display_certificats = false;
|
||||
if (is_array(self::$CERTIFICATE))
|
||||
foreach (self::$CERTIFICATE as $certif)
|
||||
$bool_display_certificats = (isset($certif['tsID']) && $certif['tsID'] != '')? true : $bool_display_certificats;
|
||||
|
||||
|
||||
if ($bool_display_certificats)
|
||||
$out .= $this->_displayFormCertificatesList();
|
||||
if (isset($posts_return['edit_certificate']) && $posts_return['edit_certificate'] &&
|
||||
@@ -1045,7 +1045,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$out .= '<input type="checkbox" name="certificate_delete[]" value="'.$lang.'" />';
|
||||
} else {
|
||||
$out .= $this->l('No need');
|
||||
}
|
||||
}
|
||||
$out .= '
|
||||
</td>
|
||||
</tr>';
|
||||
@@ -1060,16 +1060,16 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
';
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a module is payment module.
|
||||
*
|
||||
* Method instanciate a $module by its name,
|
||||
* Module::getInstanceByName() rather than Module::getInstanceById()
|
||||
*
|
||||
* Method instanciate a $module by its name,
|
||||
* Module::getInstanceByName() rather than Module::getInstanceById()
|
||||
* is used for cache improvement and avoid an sql request.
|
||||
*
|
||||
*
|
||||
* Method test if PaymentMethod::getCurrency() is a method from the module.
|
||||
*
|
||||
*
|
||||
* @see Module::getInstanceByName() in classes/Module.php
|
||||
* @param string $module name of the module
|
||||
*/
|
||||
@@ -1077,7 +1077,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
{
|
||||
$return = false;
|
||||
$module = Module::getInstanceByName($module);
|
||||
|
||||
|
||||
if (method_exists($module, 'getCurrency')){
|
||||
$return = clone $module;
|
||||
}
|
||||
@@ -1106,7 +1106,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
});
|
||||
TSPayment.init();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
<form action="'.$this->_makeFormAction($_SERVER['REQUEST_URI'], $this->id_tab).'" method="post" >
|
||||
<fieldset>
|
||||
@@ -1192,7 +1192,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
/**
|
||||
* For Excellence certificate display Buyer protection products.
|
||||
* An error message if the certificate is not totally filled
|
||||
*
|
||||
*
|
||||
* @param array $params
|
||||
* @return string tpl content
|
||||
*/
|
||||
@@ -1200,15 +1200,15 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
{
|
||||
$lang = Language::getIsoById($params['cookie']->id_lang);
|
||||
$lang = strtoupper($lang);
|
||||
|
||||
if (!isset(TSBuyerProtection::$CERTIFICATE[$lang]) ||
|
||||
|
||||
if (!isset(TSBuyerProtection::$CERTIFICATE[$lang]) ||
|
||||
!isset(TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum']))
|
||||
return '';
|
||||
|
||||
|
||||
// This hook is available only with EXCELLENCE certificate.
|
||||
if(TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'CLASSIC' OR (TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'PRODUCTION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'TEST'))
|
||||
if(TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'CLASSIC' OR (TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'INTEGRATION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'PRODUCTION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'TEST'))
|
||||
return '';
|
||||
|
||||
|
||||
// If login parameters missing for the certificate an error occured
|
||||
if ((TSBuyerProtection::$CERTIFICATE[$lang]['user'] == '' OR TSBuyerProtection::$CERTIFICATE[$lang]['password'] == '') AND TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'EXCELLENCE')
|
||||
{
|
||||
@@ -1219,13 +1219,13 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
.$this->l('Problem occurred with your language:').' "'.$lang
|
||||
.'"</p>';
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists($lang, $this->available_languages))
|
||||
{
|
||||
$currency = new Currency((int)$params['cookie']->id_currency);
|
||||
$sql = '
|
||||
SELECT * FROM `'._DB_PREFIX_.TSBuyerProtection::DB_ITEMS.'`
|
||||
WHERE 1
|
||||
WHERE 1
|
||||
AND ts_id ="'.TSBuyerProtection::$CERTIFICATE[$lang]['tsID'].'"
|
||||
AND `protected_amount_decimal` >= "'.$params['cart']->getOrderTotal(true, Cart::BOTH).'"
|
||||
AND `currency` = "'.$currency->iso_code.'"
|
||||
@@ -1236,7 +1236,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
{
|
||||
$sql = '
|
||||
SELECT * FROM `'._DB_PREFIX_.TSBuyerProtection::DB_ITEMS.'`
|
||||
WHERE 1
|
||||
WHERE 1
|
||||
AND ts_id ="'.TSBuyerProtection::$CERTIFICATE[$lang]['tsID'].'"
|
||||
AND `protected_amount_decimal` <= "'.$params['cart']->getOrderTotal(true, Cart::BOTH).'"
|
||||
AND `currency` = "'.$currency->iso_code.'"
|
||||
@@ -1252,11 +1252,11 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
}
|
||||
return $this->display(TSBuyerProtection::$module_name, 'display_products.tpl');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This prepare values to create the Trusted Shops web service
|
||||
* for Excellence certificate.
|
||||
*
|
||||
*
|
||||
* @see TSBuyerProtection::_requestForProtectionV2() method
|
||||
* @param array $params
|
||||
* @param string $lang
|
||||
@@ -1267,32 +1267,32 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$currency = new Currency((int)$params['objOrder']->id_currency);
|
||||
$order_products = $params['objOrder']->getProducts();
|
||||
$order_item_ids = array();
|
||||
|
||||
|
||||
foreach ($order_products as $product)
|
||||
$order_item_ids[] = $product['product_id'];
|
||||
|
||||
|
||||
$sql = '
|
||||
SELECT * FROM `'._DB_PREFIX_.TSBuyerProtection::DB_ITEMS.'`
|
||||
WHERE 1
|
||||
WHERE 1
|
||||
AND `id_product` IN ('.implode(',', $order_item_ids).')
|
||||
AND `ts_id` ="'.TSBuyerProtection::$CERTIFICATE[$lang]['tsID'].'"
|
||||
AND `currency` = "'.$currency->iso_code.'"
|
||||
';
|
||||
$item = Db::getInstance()->ExecuteS($sql);
|
||||
|
||||
|
||||
// No items ? means no buyer protection products was bought.
|
||||
if(empty($item))
|
||||
return '';
|
||||
|
||||
// In normal context this never occured,
|
||||
|
||||
// In normal context this never occured,
|
||||
// because of a buyer could never add multiple Buyer protection products.
|
||||
if (count($item) > 1)
|
||||
{
|
||||
$this->errors[] = $this->l('A buyer can\'t buy multiple Buyer Protection Products.');
|
||||
die($this->errors);
|
||||
}
|
||||
$item = $item[0];
|
||||
|
||||
$item = $item[0];
|
||||
|
||||
$customer = new Customer($params['objOrder']->id_customer);
|
||||
$payment_module = Module::getInstanceByName($params['objOrder']->module);
|
||||
$arr_params = array();
|
||||
@@ -1317,17 +1317,17 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
$arr_params['shopSystemVersion'] = 'Prestashop '._PS_VERSION_;
|
||||
$arr_params['wsUser'] = TSBuyerProtection::$CERTIFICATE[$lang]['user'];
|
||||
$arr_params['wsPassword'] = TSBuyerProtection::$CERTIFICATE[$lang]['password'];
|
||||
|
||||
|
||||
$this->_requestForProtectionV2($arr_params);
|
||||
|
||||
|
||||
$return = '';
|
||||
if (!empty($this->errors))
|
||||
$return = '<p style="color:red">'.implode('<br />', $this->errors).'</p>';
|
||||
else
|
||||
$return = '<p>'.$this->l('You will receive a mail by Trusted Shops about your garantie number.').'</p>';
|
||||
$return = '<p>'.$this->l('You will receive a mail by Trusted Shops about your garantie number.').'</p>';
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trusted Shops Buyer Protection is integrated at the end of the checkout
|
||||
* as a form on the order confirmation page.
|
||||
@@ -1335,7 +1335,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
* the order data is processed to Trusted Shops.
|
||||
* The customer confirms the Buyer Protection on the Trusted Shops site.
|
||||
* The guarantee is then booked and the customer receives an email by Trusted Shops.
|
||||
*
|
||||
*
|
||||
* @param array $params
|
||||
* @param string $lang
|
||||
* @return string tpl content
|
||||
@@ -1344,7 +1344,7 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
{
|
||||
$customer = new Customer($params['objOrder']->id_customer);
|
||||
$currency = new Currency((int)$params['objOrder']->id_currency);
|
||||
|
||||
|
||||
$arr_params = array();
|
||||
$arr_params['charset'] = 'UTF-8';
|
||||
$arr_params['shop_id'] = TSBuyerProtection::$CERTIFICATE[$lang]['tsID'];
|
||||
@@ -1362,12 +1362,12 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
);
|
||||
return $this->display(TSBuyerProtection::$module_name, 'order-confirmation-tsbp-classic.tpl');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Order confirmation displaying and actions depend on the certificate type.
|
||||
*
|
||||
*
|
||||
* @uses TSBuyerProtection::_orderConfirmationClassic() for Classic certificate
|
||||
* @uses TSBuyerProtection::_orderConfirmationExcellence for Excellence certificate.
|
||||
* @uses TSBuyerProtection::_orderConfirmationExcellence for Excellence certificate.
|
||||
* @param array $params
|
||||
* @return string depend on which certificate is used.
|
||||
*/
|
||||
@@ -1375,15 +1375,16 @@ class TSBuyerProtection extends AbsTrustedShops
|
||||
{
|
||||
$lang = Language::getIsoById($params['objOrder']->id_lang);
|
||||
$lang = strtoupper($lang);
|
||||
|
||||
|
||||
// If certificate is a classic type or certificate login parameters missing
|
||||
if (((TSBuyerProtection::$CERTIFICATE[$lang]['user'] == '' OR TSBuyerProtection::$CERTIFICATE[$lang]['password'] == '') AND TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'EXCELLENCE')
|
||||
OR (TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'PRODUCTION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'TEST'))
|
||||
OR (TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'INTEGRATION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'PRODUCTION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'TEST'))
|
||||
return '';
|
||||
|
||||
|
||||
if(TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'CLASSIC')
|
||||
return $this->_orderConfirmationClassic($params, $lang);
|
||||
else
|
||||
return $this->_orderConfirmationExcellence($params, $lang);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -24,6 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<style>
|
||||
{literal}
|
||||
input.myButtonTricksTS
|
||||
{
|
||||
font-size:9px !important;
|
||||
@@ -31,6 +32,7 @@ input.myButtonTricksTS
|
||||
cursor:pointer;
|
||||
padding:3px;
|
||||
}
|
||||
{/literal}
|
||||
</style>
|
||||
<div class="trustedshops-form" style="text-align:center;border:1px solid #ccc;padding:10px;">
|
||||
<div style="float:left;width:72px;">
|
||||
@@ -58,3 +60,4 @@ input.myButtonTricksTS
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -45,10 +45,10 @@ class TrustedShops extends Module
|
||||
global $smarty;
|
||||
$this->name = 'trustedshops';
|
||||
$this->tab = 'payment_security';
|
||||
$this->version = 1.1;
|
||||
|
||||
$this->version = 1.2;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
|
||||
if (empty(self::$objects_list))
|
||||
{
|
||||
TSBuyerProtection::setTranslationObject($this);
|
||||
@@ -59,20 +59,20 @@ class TrustedShops extends Module
|
||||
self::$objects_list[0]->setModuleName($this->name);
|
||||
self::$objects_list[0]->setSmarty($smarty);
|
||||
}
|
||||
|
||||
|
||||
if (!extension_loaded('soap'))
|
||||
$this->warnings[] = $this->l('This module requires the SOAP PHP extension to function properly.');
|
||||
|
||||
|
||||
foreach (self::$objects_list as $object)
|
||||
{
|
||||
$this->limited_countries = array_merge($this->limited_countries, $object->limited_countries);
|
||||
if(!empty($object->warnings))
|
||||
$this->warnings = array_merge($this->warnings, $object->warnings);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($this->warnings))
|
||||
$this->warning = implode(',<br />', $this->warnings).'.';
|
||||
|
||||
|
||||
$this->displayName = $this->l('Trusted Shops Customer Rating');
|
||||
$this->description = $this->l('Boost consumer confidence and turn more shoppers into buyers.');
|
||||
$this->confirmUninstall = $this->l('Are you sure you want to delete all your settings?');
|
||||
@@ -85,7 +85,7 @@ class TrustedShops extends Module
|
||||
{
|
||||
$return = $object->install();
|
||||
if (!$return)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
$return = ($return) ? (parent::install() AND $this->registerHook('orderConfirmation') AND $this->registerHook('newOrder') AND $this->registerHook('rightColumn') AND $this->registerHook('paymentTop') AND $this->registerHook('orderConfirmation')) : $return;
|
||||
$id_hook = Hook::get('payment');
|
||||
@@ -100,7 +100,7 @@ class TrustedShops extends Module
|
||||
{
|
||||
$return = $object->uninstall();
|
||||
if (!$return)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
$return = ($return) ? parent::uninstall() : $return;
|
||||
return $return;
|
||||
@@ -122,14 +122,14 @@ class TrustedShops extends Module
|
||||
foreach($tabs['title'] as $key=>$title)
|
||||
$out .= '<li id="menuTab'.$key.'" class="menuTabButton'.( (int)$key === (int)Tools::getValue('id_tab') ? ' selected' : '' ).'">'.($key+1).'. '.$title.'</li>';
|
||||
$out .= '</ul>';
|
||||
|
||||
|
||||
// Display content Tabs
|
||||
$out .= '<div id="tabList">';
|
||||
foreach($tabs['content'] as $key=>$content)
|
||||
$out .= '<div id="menuTab'.$key.'Sheet" class="tabItem'.( (int)$key === (int)Tools::getValue('id_tab') ? ' selected' : '' ).'">'.$content.'</div>';
|
||||
$out .= '<br clear="left" />'.$this->displayCSSJSTab();
|
||||
|
||||
// Check If each object (display as Tab) contains errors message of
|
||||
|
||||
// Check If each object (display as Tab) contains errors message of
|
||||
$this->checkObjectsErrorsOrConfirmations();
|
||||
return ( !empty($this->errors) ? $this->displayErrors() : $this->displayConfirmations() ).$out;
|
||||
}
|
||||
@@ -162,10 +162,10 @@ class TrustedShops extends Module
|
||||
</script>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check If each object (display as Tab) contains errors message of
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function checkObjectsErrorsOrConfirmations()
|
||||
@@ -231,3 +231,4 @@ class TrustedShops extends Module
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_7545c5d3ad246a683a197a2903a4d5e6'
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_b089be65fd32939f1bf1c4aeff1a7457'] = 'No rectangular';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f8320b26d30ab433c5a54546d21f414c'] = 'Falso';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f827cf462f62848df37c5e1e94a4da74'] = 'Verdadero';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_386aad80d82f8245e9ef80352a2240e8'] = 'Todos los artículos en un solo paquete';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f35eb2a913a3fd6fd8e661012cf0ebd8'] = 'Un artículo en cada paquete';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f57cff5425b6e64843c5f066c5b310d0'] = 'Estado del módulo USPS';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_09bdd414ce843927aa3dceadc8bce034'] = '¡El transportista USPS ya es funcional!';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_ec8b84c83dfee20afa4c2f35245a254b'] = 'El transportista USPS aún no está completamente configurado, debe:';
|
||||
@@ -63,6 +65,8 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_8d2ee0603dfce09b57d60db628cde269'
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_795de10b1bdcb843b3703c63ad577fc6'] = 'Elija en la lista el tipo de paquete por defecto';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_93c8645dbbc33cf8d126266a827a5501'] = 'Machinable';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_67cd0f5256c40c16a6cfd6effe3ab06b'] = 'Elija si puede ser tratado por una máquina por defecto o no.';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_8d6bd50f3fe3ee2f4513066c25e5fb4a'] = 'Modo de cálculo';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_c5238c5f72dee585afdf4bddf6de518e'] = 'Al usar el modo de cálculo \"Todos los artículos en un solo paquete\" utilizará automáticamente el tamaño por defecto de embalaje, tipo de embalaje y entrega. Las configuraciones específicas para las categorías o producto no se utilizarán.';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_5cdd307ba6e260beb4801c0c10e22a3a'] = 'Servicio de entrega';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_78945de8de090e90045d299651a68a9b'] = 'Disponible';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_2d25c72c1b18e562f6654fff8e11711e'] = 'No disponible';
|
||||
|
||||
@@ -24,6 +24,8 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_7545c5d3ad246a683a197a2903a4d5e6'
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_b089be65fd32939f1bf1c4aeff1a7457'] = 'Non rectangular';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f8320b26d30ab433c5a54546d21f414c'] = 'False';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f827cf462f62848df37c5e1e94a4da74'] = 'True';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_386aad80d82f8245e9ef80352a2240e8'] = 'Tous les articles en un seul paquet';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f35eb2a913a3fd6fd8e661012cf0ebd8'] = 'Découper un article par paquet';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f57cff5425b6e64843c5f066c5b310d0'] = 'Statut du module USPS';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_09bdd414ce843927aa3dceadc8bce034'] = 'Le transporteur USPS est fonctionnel !';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_ec8b84c83dfee20afa4c2f35245a254b'] = 'Le transporteur USPS n\'est pas encore complètement configuré, vous devez :';
|
||||
@@ -63,6 +65,8 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_8d2ee0603dfce09b57d60db628cde269'
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_795de10b1bdcb843b3703c63ad577fc6'] = 'Choisissez le type de paquet par défaut';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_93c8645dbbc33cf8d126266a827a5501'] = 'Machinable';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_67cd0f5256c40c16a6cfd6effe3ab06b'] = 'Choisissez si cela peut être traité par une machine ou non par défaut';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_8d6bd50f3fe3ee2f4513066c25e5fb4a'] = 'Mode de calcul';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_c5238c5f72dee585afdf4bddf6de518e'] = 'Utilisation du mode de calcul : \"Tous les articles dans un seul paquet\" utilisera automatiquement la taille des emballages par défaut, le type d\'emballage et de livraison. Les configurations spécifiques pour les catégories ou un produit ne seront pas utilisées.';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_5cdd307ba6e260beb4801c0c10e22a3a'] = 'Service de livraison';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_78945de8de090e90045d299651a68a9b'] = 'Disponible';
|
||||
$_MODULE['<{uspscarrier}prestashop>uspscarrier_2d25c72c1b18e562f6654fff8e11711e'] = 'Non disponible';
|
||||
|
||||
Reference in New Issue
Block a user