Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release

This commit is contained in:
Vincent Augagneur
2013-08-09 10:44:24 +02:00
22 changed files with 193 additions and 135 deletions
@@ -40,6 +40,7 @@
|&nbsp;<a href="http://www.prestashop.com/en/contact_us/" target="_blank" class="footer_link">{l s='Contact'}</a> |&nbsp;<a href="http://www.prestashop.com/en/contact_us/" target="_blank" class="footer_link">{l s='Contact'}</a>
|&nbsp;<a href="http://forge.prestashop.com" target="_blank" class="footer_link">{l s='Bug Tracker'}</a> |&nbsp;<a href="http://forge.prestashop.com" target="_blank" class="footer_link">{l s='Bug Tracker'}</a>
|&nbsp;<a href="http://www.prestashop.com/forums/" target="_blank" class="footer_link">{l s='Forum'}</a> |&nbsp;<a href="http://www.prestashop.com/forums/" target="_blank" class="footer_link">{l s='Forum'}</a>
|&nbsp;<a href="http://addons.prestashop.com/" target="_blank" class="footer_link">{l s='Addons'}</a>
</div> </div>
</div> </div>
</div> </div>
+4 -1
View File
@@ -249,7 +249,7 @@ class EmployeeCore extends ObjectModel
/* Employee is valid only if it can be load and if cookie password is the same as database one */ /* Employee is valid only if it can be load and if cookie password is the same as database one */
Cache::store('isLoggedBack'.$this->id, ( Cache::store('isLoggedBack'.$this->id, (
$this->id && Validate::isUnsignedId($this->id) && Employee::checkPassword($this->id, Context::getContext()->cookie->passwd) $this->id && Validate::isUnsignedId($this->id) && Employee::checkPassword($this->id, Context::getContext()->cookie->passwd)
&& (!isset($this->remote_addr) || $this->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP')) && (!isset(Context::getContext()->cookie->remote_addr) || Context::getContext()->cookie->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))
)); ));
} }
return Cache::retrieve('isLoggedBack'.$this->id); return Cache::retrieve('isLoggedBack'.$this->id);
@@ -261,7 +261,10 @@ class EmployeeCore extends ObjectModel
public function logout() public function logout()
{ {
if (isset(Context::getContext()->cookie)) if (isset(Context::getContext()->cookie))
{
Context::getContext()->cookie->logout(); Context::getContext()->cookie->logout();
Context::getContext()->cookie->write();
}
$this->id = null; $this->id = null;
} }
+1 -1
View File
@@ -4493,7 +4493,7 @@ class ProductCore extends ObjectModel
return true; return true;
} }
/*
/** /**
* Webservice getter : get virtual field default combination * Webservice getter : get virtual field default combination
* *
+4 -1
View File
@@ -66,7 +66,10 @@ class ProductSaleCore
if ($page_number < 0) $page_number = 0; if ($page_number < 0) $page_number = 0;
if ($nb_products < 1) $nb_products = 10; if ($nb_products < 1) $nb_products = 10;
$final_order_by = $order_by; $final_order_by = $order_by;
$order_table = '';
if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales'; if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales';
if ($order_by == 'date_add' || $order_by == 'date_upd')
$order_table = 'product_shop';
if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC'; if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC';
$groups = FrontController::getCurrentCustomerGroups(); $groups = FrontController::getCurrentCustomerGroups();
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
@@ -108,7 +111,7 @@ class ProductSaleCore
WHERE cg.`id_group` '.$sql_groups.' WHERE cg.`id_group` '.$sql_groups.'
) )
GROUP BY product_shop.id_product GROUP BY product_shop.id_product
ORDER BY '.$prefix.'`'.pSQL($order_by).'` '.pSQL($order_way).' ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
+38 -12
View File
@@ -93,8 +93,12 @@ define('PREG_CLASS_CJK', '\x{3041}-\x{30ff}\x{31f0}-\x{31ff}\x{3400}-\x{4db5}\x{
class SearchCore class SearchCore
{ {
public static function sanitize($string, $id_lang, $indexation = false) public static function sanitize($string, $id_lang, $indexation = false, $iso_code = false)
{ {
$string = trim($string);
if (empty($string))
return '';
$string = Tools::strtolower(strip_tags($string)); $string = Tools::strtolower(strip_tags($string));
$string = html_entity_decode($string, ENT_NOQUOTES, 'utf-8'); $string = html_entity_decode($string, ENT_NOQUOTES, 'utf-8');
@@ -138,14 +142,34 @@ class SearchCore
if ($indexation) if ($indexation)
{ {
$minWordLen = (int)Configuration::get('PS_SEARCH_MINWORDLEN'); // If the language is constituted with symbol and there is no "words", then split every chars
if ($minWordLen > 1) if (in_array($iso_code, array('zh', 'tw', 'ja')) && function_exists('mb_strlen'))
{ {
$minWordLen -= 1; // Cut symbols from letters
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}(?=\s)/Su', ' ', $string); $symbols = '';
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}(?=\s)/Su', '', $string); $letters = '';
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}$/Su', '', $string); foreach (explode(' ', $string) as $mb_word)
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}$/Su', '', $string); if (strlen(Tools::replaceAccentedChars($mb_word)) == mb_strlen(Tools::replaceAccentedChars($mb_word)))
$letters .= $mb_word.' ';
else
$symbols .= $mb_word.' ';
if (preg_match_all('/./u', $symbols, $matches))
$symbols = implode(' ', $matches[0]);
$string = $letters.$symbols;
}
else
{
$minWordLen = (int)Configuration::get('PS_SEARCH_MINWORDLEN');
if ($minWordLen > 1)
{
$minWordLen -= 1;
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}(?=\s)/Su', ' ', $string);
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}(?=\s)/Su', '', $string);
$string = preg_replace('/(?<=\s)[^\s]{1,'.$minWordLen.'}$/Su', '', $string);
$string = preg_replace('/^[^\s]{1,'.$minWordLen.'}$/Su', '', $string);
}
} }
} }
@@ -175,7 +199,7 @@ class SearchCore
$intersect_array = array(); $intersect_array = array();
$score_array = array(); $score_array = array();
$words = explode(' ', Search::sanitize($expr, $id_lang)); $words = explode(' ', Search::sanitize($expr, $id_lang, false, $context->language->iso_code));
foreach ($words as $key => $word) foreach ($words as $key => $word)
if (!empty($word) && strlen($word) >= (int)Configuration::get('PS_SEARCH_MINWORDLEN')) if (!empty($word) && strlen($word) >= (int)Configuration::get('PS_SEARCH_MINWORDLEN'))
@@ -383,7 +407,7 @@ class SearchCore
return Db::getInstance()->executeS(' return Db::getInstance()->executeS('
SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc, SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc,
pl.description_short, pl.description, cl.name cname, m.name mname pl.description_short, pl.description, cl.name cname, m.name mname, l.iso_code
FROM '._DB_PREFIX_.'product p FROM '._DB_PREFIX_.'product p
LEFT JOIN '._DB_PREFIX_.'product_lang pl LEFT JOIN '._DB_PREFIX_.'product_lang pl
ON p.id_product = pl.id_product ON p.id_product = pl.id_product
@@ -392,6 +416,8 @@ class SearchCore
ON (cl.id_category = product_shop.id_category_default AND pl.id_lang = cl.id_lang AND cl.id_shop = product_shop.id_shop) ON (cl.id_category = product_shop.id_category_default AND pl.id_lang = cl.id_lang AND cl.id_shop = product_shop.id_shop)
LEFT JOIN '._DB_PREFIX_.'manufacturer m LEFT JOIN '._DB_PREFIX_.'manufacturer m
ON m.id_manufacturer = p.id_manufacturer ON m.id_manufacturer = p.id_manufacturer
LEFT JOIN '._DB_PREFIX_.'lang l
ON l.id_lang = pl.id_lang
WHERE product_shop.indexed = 0 WHERE product_shop.indexed = 0
AND product_shop.visibility IN ("both", "search") AND product_shop.visibility IN ("both", "search")
'.($id_product ? 'AND p.id_product = '.(int)$id_product : '').' '.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
@@ -482,9 +508,9 @@ class SearchCore
// Data must be cleaned of html, bad characters, spaces and anything, then if the resulting words are long enough, they're added to the array // Data must be cleaned of html, bad characters, spaces and anything, then if the resulting words are long enough, they're added to the array
$product_array = array(); $product_array = array();
foreach ($product as $key => $value) foreach ($product as $key => $value)
if (strncmp($key, 'id_', 3)) if (strncmp($key, 'id_', 3) && isset($weight_array[$key]))
{ {
$words = explode(' ', Search::sanitize($value, (int)$product['id_lang'], true)); $words = explode(' ', Search::sanitize($value, (int)$product['id_lang'], true, $product['iso_code']));
foreach ($words as $word) foreach ($words as $word)
if (!empty($word)) if (!empty($word))
{ {
+4
View File
@@ -1813,7 +1813,11 @@ class AdminControllerCore extends Controller
$this->context->employee->logout(); $this->context->employee->logout();
if ($this->controller_name != 'AdminLogin' && (!isset($this->context->employee) || !$this->context->employee->isLoggedBack())) if ($this->controller_name != 'AdminLogin' && (!isset($this->context->employee) || !$this->context->employee->isLoggedBack()))
{
if (isset($this->context->employee))
$this->context->employee->logout();
Tools::redirectAdmin($this->context->link->getAdminLink('AdminLogin').((!isset($_GET['logout']) && $this->controller_name != 'AdminNotFound') ? '&redirect='.$this->controller_name : '')); Tools::redirectAdmin($this->context->link->getAdminLink('AdminLogin').((!isset($_GET['logout']) && $this->controller_name != 'AdminNotFound') ? '&redirect='.$this->controller_name : ''));
}
// Set current index // Set current index
$current_index = 'index.php'.(($controller = Tools::getValue('controller')) ? '?controller='.$controller : ''); $current_index = 'index.php'.(($controller = Tools::getValue('controller')) ? '?controller='.$controller : '');
+6 -9
View File
@@ -114,18 +114,15 @@ class FrontControllerCore extends Controller
$css_files = $this->css_files; $css_files = $this->css_files;
$js_files = $this->js_files; $js_files = $this->js_files;
if ($this->ssl && !Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) // If we call a SSL controller without SSL or a non SSL controller with SSL, we redirect with the right protocol
if (Configuration::get('PS_SSL_ENABLED') && ($_SERVER['REQUEST_METHOD'] != 'POST') && $this->ssl != Tools::usingSecureMode())
{ {
header('HTTP/1.1 301 Moved Permanently'); header('HTTP/1.1 301 Moved Permanently');
header('Cache-Control: no-cache'); header('Cache-Control: no-cache');
header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']); if ($this->ssl)
exit(); header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
} else
elseif (Configuration::get('PS_SSL_ENABLED') && Tools::usingSecureMode() && !($this->ssl)) header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']);
{
header('HTTP/1.1 301 Moved Permanently');
header('Cache-Control: no-cache');
header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']);
exit(); exit();
} }
+19 -14
View File
@@ -292,15 +292,17 @@ abstract class ModuleCore
else else
{ {
if (!$upgrade_detail['number_upgraded']) if (!$upgrade_detail['number_upgraded'])
$this->_errors[] = $this->l('None upgrades have been applied'); $this->_errors[] = $this->l('No upgrade has been applied');
else else
{ {
$this->_errors[] = $this->l('Upgraded from: ').$upgrade_detail['upgraded_from'].$this->l(' to '). $this->_errors[] = sprintf($this->l('Upgraded from: %S to %s'), $upgrade_detail['upgraded_from'], $upgrade_detail['upgraded_to']);
$upgrade_detail['upgraded_to'];
$this->_errors[] = $upgrade_detail['number_upgrade_left'].' '.$this->l('upgrade left'); $this->_errors[] = $upgrade_detail['number_upgrade_left'].' '.$this->l('upgrade left');
} }
$this->_errors[] = $this->l('To prevent any problem, this module has been turned off'); if ($upgrade_detail['duplicate'])
$this->_errors[] = sprintf(Tools::displayError('Module %s cannot be upgraded this time: please refresh this page to update it.'), $this->name);
else
$this->_errors[] = $this->l('To prevent any problem, this module has been turned off');
} }
} }
} }
@@ -348,19 +350,21 @@ abstract class ModuleCore
$upgrade = &self::$modules_cache[$this->name]['upgrade']; $upgrade = &self::$modules_cache[$this->name]['upgrade'];
foreach ($upgrade['upgrade_file_left'] as $num => $file_detail) foreach ($upgrade['upgrade_file_left'] as $num => $file_detail)
{ {
// Default variable required in the included upgrade file need to be set by default there: if (function_exists($file_detail['upgrade_function']))
// upgrade_version, success_upgrade {
$upgrade_result = false; $upgrade['success'] = false;
$upgrade['duplicate'] = true;
break;
}
include($file_detail['file']); include($file_detail['file']);
// Call the upgrade function if defined // Call the upgrade function if defined
$upgrade['success'] = false;
if (function_exists($file_detail['upgrade_function'])) if (function_exists($file_detail['upgrade_function']))
$upgrade_result = $file_detail['upgrade_function']($this); $upgrade['success'] = $file_detail['upgrade_function']($this);
$upgrade['success'] = $upgrade_result;
// Set detail when an upgrade succeed or failed // Set detail when an upgrade succeed or failed
if ($upgrade_result) if ($upgrade['success'])
{ {
$upgrade['number_upgraded'] += 1; $upgrade['number_upgraded'] += 1;
$upgrade['upgraded_to'] = $file_detail['version']; $upgrade['upgraded_to'] = $file_detail['version'];
@@ -378,6 +382,7 @@ abstract class ModuleCore
} }
$upgrade['number_upgrade_left'] = count($upgrade['upgrade_file_left']); $upgrade['number_upgrade_left'] = count($upgrade['upgrade_file_left']);
// Update module version in DB with the last succeed upgrade // Update module version in DB with the last succeed upgrade
if ($upgrade['upgraded_to']) if ($upgrade['upgraded_to'])
Module::upgradeModuleVersion($this->name, $upgrade['upgraded_to']); Module::upgradeModuleVersion($this->name, $upgrade['upgraded_to']);
@@ -396,9 +401,9 @@ abstract class ModuleCore
public static function upgradeModuleVersion($name, $version) public static function upgradeModuleVersion($name, $version)
{ {
return Db::getInstance()->execute(' return Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'module` m UPDATE `'._DB_PREFIX_.'module` m
SET m.version = \''.bqSQL($version).'\' SET m.version = \''.bqSQL($version).'\'
WHERE m.name = \''.bqSQL($name).'\''); WHERE m.name = \''.bqSQL($name).'\'');
} }
/** /**
+1 -1
View File
@@ -45,7 +45,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
$this->smarty = $smarty; $this->smarty = $smarty;
// header informations // header informations
$this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang); $this->date = Tools::displayDate($this->order_slip->date_add, (int)$this->order->id_lang);
$this->title = HTMLTemplateOrderSlip::l('Slip #').Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id).sprintf('%06d', (int)$this->order_slip->id); $this->title = HTMLTemplateOrderSlip::l('Slip #').Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id).sprintf('%06d', (int)$this->order_slip->id);
// footer informations // footer informations
@@ -716,7 +716,8 @@ class AdminCarrierWizardControllerCore extends AdminController
if ($logo && !empty($logo['tmp_name']) && $logo['tmp_name'] != 'none' if ($logo && !empty($logo['tmp_name']) && $logo['tmp_name'] != 'none'
&& (!isset($logo['error']) || !$logo['error']) && (!isset($logo['error']) || !$logo['error'])
&& preg_match('/\.(jpe?g|gif|png)$/', $logo['name']) && preg_match('/\.(jpe?g|gif|png)$/', $logo['name'])
&& is_uploaded_file($logo['tmp_name'])) && is_uploaded_file($logo['tmp_name'])
&& ImageManager::isRealImage($logo['tmp_name']))
{ {
$file = $logo['tmp_name']; $file = $logo['tmp_name'];
do $tmp_name = uniqid().'.jpg'; do $tmp_name = uniqid().'.jpg';
+1 -1
View File
@@ -499,7 +499,7 @@ class AdminHomeControllerCore extends AdminController
// DISCOVER PRESTASHOP // DISCOVER PRESTASHOP
$result['discover_prestashop'] = '<div id="block_tips">'.$this->getBlockDiscover().'</div>'; $result['discover_prestashop'] = '<div id="block_tips">'.$this->getBlockDiscover().'</div>';
$result['discover_prestashop'] .= '<div class="row-news"><div id="block_discover"><iframe frameborder="no" style="margin: 0px; padding: 0px; width: 100%; height:300px; overflow:hidden;" src="'.$protocol.'://api.prestashop.com/rss2/news2.php?v='._PS_VERSION_.'&lang='.$isoUser.'"></iframe></div>'; $result['discover_prestashop'] .= '<div class="row-news"><div id="block_discover"><iframe frameborder="no" style="margin: 0px; padding: 0px; width: 100%; height:300px; overflow:hidden;" src="'.$protocol.'api.prestashop.com/rss2/news2.php?v='._PS_VERSION_.'&lang='.$isoUser.'"></iframe></div>';
// SHOW TIPS OF THE DAY // SHOW TIPS OF THE DAY
$content = Tools::file_get_contents($protocol.'api.prestashop.com/partner/tipsoftheday/?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser), false, $stream_context); $content = Tools::file_get_contents($protocol.'api.prestashop.com/partner/tipsoftheday/?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser), false, $stream_context);
+3 -7
View File
@@ -630,9 +630,8 @@ class AdminModulesControllerCore extends AdminController
if (!$download_ok) if (!$download_ok)
$this->errors[] = $this->l('Error on downloading the lastest version'); $this->errors[] = $this->l('Error on downloading the lastest version');
else elseif (!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
if(!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false)) $this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
} }
} }
} }
@@ -768,10 +767,8 @@ class AdminModulesControllerCore extends AdminController
Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params); Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
} }
if(isset($_GET['update'])) if (isset($_GET['update']))
{
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params); Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
}
} }
public function postProcess() public function postProcess()
@@ -779,7 +776,6 @@ class AdminModulesControllerCore extends AdminController
// Parent Post Process // Parent Post Process
parent::postProcess(); parent::postProcess();
// Get the list of installed module ans prepare it for ajax call. // Get the list of installed module ans prepare it for ajax call.
if (($list = Tools::getValue('installed_modules'))) if (($list = Tools::getValue('installed_modules')))
Context::getContext()->smarty->assign('installed_modules', Tools::jsonEncode(explode('|', $list))); Context::getContext()->smarty->assign('installed_modules', Tools::jsonEncode(explode('|', $list)));
+1
View File
@@ -33,6 +33,7 @@ class CartControllerCore extends FrontController
protected $id_address_delivery; protected $id_address_delivery;
protected $customization_id; protected $customization_id;
protected $qty; protected $qty;
public $ssl = false;
protected $ajax_refresh = false; protected $ajax_refresh = false;
+2 -1
View File
@@ -44,7 +44,8 @@ function initCarrierWizard()
'onLeaveStep' : onLeaveStepCallback, 'onLeaveStep' : onLeaveStepCallback,
'onFinish' : onFinishCallback, 'onFinish' : onFinishCallback,
'transitionEffect' : 'slideleft', 'transitionEffect' : 'slideleft',
'enableAllSteps' : enableAllSteps 'enableAllSteps' : enableAllSteps,
'keyNavigation' : false
}); });
displayRangeType(); displayRangeType();
} }
+69 -61
View File
@@ -445,14 +445,21 @@ class BlockLayered extends Module
static $_MODULES = array(); static $_MODULES = array();
global $_MODULE; global $_MODULE;
$file = _PS_MODULE_DIR_.$this->name.'/'.Language::getIsoById($id_lang).'.php';
if (!array_key_exists($id_lang, $_MODULES)) if (!array_key_exists($id_lang, $_MODULES))
{ {
if (!file_exists($file)) if (file_exists($file1 = _PS_MODULE_DIR_.$this->name.'/translations/'.Language::getIsoById($id_lang).'.php'))
{
include($file1);
$_MODULES[$id_lang] = $_MODULE;
}
elseif (file_exists($file2 = _PS_MODULE_DIR_.$this->name.'/'.Language::getIsoById($id_lang).'.php'))
{
include($file2);
$_MODULES[$id_lang] = $_MODULE;
}
else
return $string; return $string;
include($file);
$_MODULES[$id_lang] = $_MODULE;
} }
$string = str_replace('\'', '\\\'', $string); $string = str_replace('\'', '\\\'', $string);
@@ -936,25 +943,25 @@ class BlockLayered extends Module
SELECT count(DISTINCT p.`id_product`) SELECT count(DISTINCT p.`id_product`)
FROM '._DB_PREFIX_.'product p FROM '._DB_PREFIX_.'product p
INNER JOIN `'._DB_PREFIX_.'product_shop` ps INNER JOIN `'._DB_PREFIX_.'product_shop` ps
ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1)'); ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1 AND ps.`visibility` IN ("both", "catalog"))');
else else
$nb_products = (int)Db::getInstance()->getValue(' $nb_products = (int)Db::getInstance()->getValue('
SELECT count(DISTINCT p.`id_product`) SELECT count(DISTINCT p.`id_product`)
FROM '._DB_PREFIX_.'product p FROM '._DB_PREFIX_.'product p
WHERE `active` = 1'); WHERE `active` = 1 AND `visibility` IN ("both", "catalog")');
else else
if (version_compare(_PS_VERSION_,'1.5','>')) if (version_compare(_PS_VERSION_,'1.5','>'))
$nb_products = (int)Db::getInstance()->getValue(' $nb_products = (int)Db::getInstance()->getValue('
SELECT COUNT(DISTINCT p.`id_product`) FROM `'._DB_PREFIX_.'product` p SELECT COUNT(DISTINCT p.`id_product`) FROM `'._DB_PREFIX_.'product` p
INNER JOIN `'._DB_PREFIX_.'product_shop` ps INNER JOIN `'._DB_PREFIX_.'product_shop` ps
ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1) ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1 AND ps.`visibility` IN ("both", "catalog"))
LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product) LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product)
WHERE psi.id_product IS NULL'); WHERE psi.id_product IS NULL');
else else
$nb_products = (int)Db::getInstance()->getValue(' $nb_products = (int)Db::getInstance()->getValue('
SELECT COUNT(DISTINCT p.`id_product`) FROM `'._DB_PREFIX_.'product` p SELECT COUNT(DISTINCT p.`id_product`) FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product) LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product)
WHERE `active` = 1 AND psi.id_product IS NULL'); WHERE `active` = 1 AND `visibility` IN ("both", "catalog") AND psi.id_product IS NULL');
$max_executiontime = @ini_get('max_execution_time'); $max_executiontime = @ini_get('max_execution_time');
if ($max_executiontime > 5 || $max_executiontime <= 0) if ($max_executiontime > 5 || $max_executiontime <= 0)
@@ -1015,14 +1022,14 @@ class BlockLayered extends Module
SELECT p.`id_product` SELECT p.`id_product`
FROM `'._DB_PREFIX_.'product` p FROM `'._DB_PREFIX_.'product` p
INNER JOIN `'._DB_PREFIX_.'product_shop` ps INNER JOIN `'._DB_PREFIX_.'product_shop` ps
ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1) ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1 AND ps.`visibility` IN ("both", "catalog"))
GROUP BY p.`id_product` GROUP BY p.`id_product`
ORDER BY p.`id_product` LIMIT '.(int)$cursor.','.(int)$length; ORDER BY p.`id_product` LIMIT '.(int)$cursor.','.(int)$length;
else else
$query = ' $query = '
SELECT p.`id_product` SELECT p.`id_product`
FROM `'._DB_PREFIX_.'product` p FROM `'._DB_PREFIX_.'product` p
WHERE `active` = 1 WHERE `active` = 1 AND `visibility` IN ("both", "catalog")
GROUP BY p.`id_product` GROUP BY p.`id_product`
ORDER BY p.`id_product` LIMIT '.(int)$cursor.','.(int)$length; ORDER BY p.`id_product` LIMIT '.(int)$cursor.','.(int)$length;
else else
@@ -1031,7 +1038,7 @@ class BlockLayered extends Module
SELECT p.`id_product` SELECT p.`id_product`
FROM `'._DB_PREFIX_.'product` p FROM `'._DB_PREFIX_.'product` p
INNER JOIN `'._DB_PREFIX_.'product_shop` ps INNER JOIN `'._DB_PREFIX_.'product_shop` ps
ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1) ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1 AND ps.`visibility` IN ("both", "catalog"))
LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product) LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product)
WHERE psi.id_product IS NULL WHERE psi.id_product IS NULL
GROUP BY p.`id_product` GROUP BY p.`id_product`
@@ -1041,7 +1048,7 @@ class BlockLayered extends Module
SELECT p.`id_product` SELECT p.`id_product`
FROM `'._DB_PREFIX_.'product` p FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product) LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product)
WHERE `active` = 1 AND psi.id_product IS NULL WHERE `active` = 1 AND `visibility` IN ("both", "catalog") AND psi.id_product IS NULL
GROUP BY p.`id_product` GROUP BY p.`id_product`
ORDER BY p.`id_product` LIMIT 0,'.(int)$length; ORDER BY p.`id_product` LIMIT 0,'.(int)$length;
@@ -2322,7 +2329,7 @@ class BlockLayered extends Module
$alias_where = 'p'; $alias_where = 'p';
if (version_compare(_PS_VERSION_,'1.5','>')) if (version_compare(_PS_VERSION_,'1.5','>'))
$alias_where = 'product_shop'; $alias_where = 'product_shop';
$query_filters_where = ' AND '.$alias_where.'.`active` = 1'; $query_filters_where = ' AND '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog")';
$query_filters_from = ''; $query_filters_from = '';
$parent = new Category((int)$id_parent); $parent = new Category((int)$id_parent);
@@ -2518,7 +2525,7 @@ class BlockLayered extends Module
'.($alias_where == 'p' ? '' : 'product_shop.*,' ).' '.($alias_where == 'p' ? '' : 'product_shop.*,' ).'
'.$alias_where.'.id_category_default, '.$alias_where.'.id_category_default,
pl.*, pl.*,
i.id_image, image_shop.`id_image`,
il.legend, il.legend,
m.name manufacturer_name, m.name manufacturer_name,
DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB(NOW(), INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB(NOW(), INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new
@@ -2527,12 +2534,12 @@ class BlockLayered extends Module
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product` LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
'.$join.' '.$join.'
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.') LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.')
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1) LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.Shop::addSqlAssociation('image', 'i', false, 'image_shop.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_.'image_lang` il ON (image_shop.`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) LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
WHERE '.$alias_where.'.`active` = 1 AND WHERE (i.id_image IS NULL OR image_shop.id_shop='.(int)Context::getContext()->shop->id.')
'.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.' AND '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog")
AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).' AND '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.' AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).'
AND c.active = 1 AND c.active = 1
AND p.id_product IN ('.implode(',', $product_id_list).') AND p.id_product IN ('.implode(',', $product_id_list).')
GROUP BY cp.id_product GROUP BY cp.id_product
@@ -2632,10 +2639,10 @@ class BlockLayered extends Module
{ {
$sql_query['join'] .= 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sa $sql_query['join'] .= 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sa
ON (sa.id_product = p.id_product AND sa.id_shop = '.(int)$this->context->shop->id.') '; ON (sa.id_product = p.id_product AND sa.id_shop = '.(int)$this->context->shop->id.') ';
$sql_query['where'] = 'WHERE product_shop.`active` = 1 '; $sql_query['where'] = 'WHERE product_shop.`active` = 1 AND product_shop.`visibility` IN ("both", "catalog") ';
} }
else else
$sql_query['where'] = 'WHERE p.`active` = 1 '; $sql_query['where'] = 'WHERE p.`active` = 1 AND p.`visibility` IN ("both", "catalog") ';
$sql_query['group'] = ' GROUP BY p.id_product '; $sql_query['group'] = ' GROUP BY p.id_product ';
break; break;
@@ -2650,8 +2657,8 @@ class BlockLayered extends Module
'.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.' '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.'
AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).' AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).'
AND c.active = 1 AND c.active = 1
AND '.$alias.'.active = 1'; AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")';
$sql_query['group'] = ' GROUP BY p.id_manufacturer '; $sql_query['group'] = ' GROUP BY p.id_manufacturer ORDER BY m.name';
if (!Configuration::get('PS_LAYERED_HIDE_0_VALUES')) if (!Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
{ {
@@ -2667,8 +2674,8 @@ class BlockLayered extends Module
WHERE '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.' WHERE '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.'
AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).' AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).'
AND c.active = 1 AND c.active = 1
AND '.$alias.'.active = 1 AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")
GROUP BY p.id_manufacturer'; GROUP BY p.id_manufacturer ORDER BY m.name';
} }
break; break;
@@ -2698,13 +2705,15 @@ class BlockLayered extends Module
$sql_query['where'] = 'WHERE a.id_attribute_group = '.(int)$filter['id_value']; $sql_query['where'] = 'WHERE a.id_attribute_group = '.(int)$filter['id_value'];
if (version_compare(_PS_VERSION_,'1.5','>')) if (version_compare(_PS_VERSION_,'1.5','>'))
$sql_query['where'] .= ' AND lpa.`id_shop` = '.(int)Context::getContext()->shop->id; $sql_query['where'] .= ' AND lpa.`id_shop` = '.(int)Context::getContext()->shop->id;
$sql_query['where'] .= ' AND '.$alias.'.active = 1 AND p.id_product IN ( $sql_query['where'] .= ' AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")
SELECT id_product AND p.id_product IN (
FROM '._DB_PREFIX_.'category_product cp SELECT id_product
INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND FROM '._DB_PREFIX_.'category_product cp
'.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.' INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND
AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).' '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.'
AND c.active = 1)) '; AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).'
AND c.active = 1)
) ';
$sql_query['group'] = ' $sql_query['group'] = '
GROUP BY lpa.id_attribute GROUP BY lpa.id_attribute
ORDER BY ag.`position` ASC, a.`position` ASC'; ORDER BY ag.`position` ASC, a.`position` ASC';
@@ -2713,31 +2722,28 @@ class BlockLayered extends Module
{ {
$sql_query['second_query'] = ' $sql_query['second_query'] = '
SELECT 0 nbr, lpa.id_attribute_group, SELECT 0 nbr, lpa.id_attribute_group,
a.color, al.name attribute_name, agl.public_name attribute_group_name , lpa.id_attribute, ag.is_color_group, a.color, al.name attribute_name, agl.public_name attribute_group_name , lpa.id_attribute, ag.is_color_group,
liagl.url_name name_url_name, liagl.meta_title name_meta_title, lial.url_name value_url_name, lial.meta_title value_meta_title liagl.url_name name_url_name, liagl.meta_title name_meta_title, lial.url_name value_url_name, lial.meta_title value_meta_title
FROM '._DB_PREFIX_.'layered_product_attribute lpa FROM '._DB_PREFIX_.'layered_product_attribute lpa
'.(version_compare(_PS_VERSION_,'1.5','>') ? Shop::addSqlAssociation('product', 'lpa') : '').' '.(version_compare(_PS_VERSION_,'1.5','>') ? Shop::addSqlAssociation('product', 'lpa') : '').'
INNER JOIN '._DB_PREFIX_.'attribute a INNER JOIN '._DB_PREFIX_.'attribute a
ON a.id_attribute = lpa.id_attribute ON a.id_attribute = lpa.id_attribute
INNER JOIN '._DB_PREFIX_.'attribute_lang al INNER JOIN '._DB_PREFIX_.'attribute_lang al
ON al.id_attribute = a.id_attribute ON al.id_attribute = a.id_attribute AND al.id_lang = '.$id_lang.'
AND al.id_lang = '.$id_lang.'
INNER JOIN '._DB_PREFIX_.'product as p INNER JOIN '._DB_PREFIX_.'product as p
ON p.id_product = lpa.id_product ON p.id_product = lpa.id_product
INNER JOIN '._DB_PREFIX_.'attribute_group ag INNER JOIN '._DB_PREFIX_.'attribute_group ag
ON ag.id_attribute_group = lpa.id_attribute_group ON ag.id_attribute_group = lpa.id_attribute_group
INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl
ON agl.id_attribute_group = lpa.id_attribute_group ON agl.id_attribute_group = lpa.id_attribute_group
AND agl.id_lang = '.$id_lang.' AND agl.id_lang = '.$id_lang.'
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value liagl LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value liagl
ON (liagl.id_attribute_group = lpa.id_attribute_group AND liagl.id_lang = '.$id_lang.') ON (liagl.id_attribute_group = lpa.id_attribute_group AND liagl.id_lang = '.$id_lang.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang_value lial LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang_value lial
ON (lial.id_attribute = lpa.id_attribute AND lial.id_lang = '.$id_lang.') ON (lial.id_attribute = lpa.id_attribute AND lial.id_lang = '.$id_lang.')
WHERE '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")
WHERE '.$alias.'.active = 1 AND a.id_attribute_group = '.(int)$filter['id_value'].' AND a.id_attribute_group = '.(int)$filter['id_value'].'
'.(version_compare(_PS_VERSION_,'1.5','>') ? 'AND lpa.`id_shop` = '.(int)Context::getContext()->shop->id : '').' '.(version_compare(_PS_VERSION_,'1.5','>') ? 'AND lpa.`id_shop` = '.(int)Context::getContext()->shop->id : '').'
GROUP BY lpa.id_attribute GROUP BY lpa.id_attribute
ORDER BY id_attribute_group, id_attribute'; ORDER BY id_attribute_group, id_attribute';
} }
@@ -2757,7 +2763,8 @@ class BlockLayered extends Module
ON (lifl.id_feature = fp.id_feature AND lifl.id_lang = '.$id_lang.') ON (lifl.id_feature = fp.id_feature AND lifl.id_lang = '.$id_lang.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang_value lifvl LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang_value lifvl
ON (lifvl.id_feature_value = fp.id_feature_value AND lifvl.id_lang = '.$id_lang.') '; ON (lifvl.id_feature_value = fp.id_feature_value AND lifvl.id_lang = '.$id_lang.') ';
$sql_query['where'] = 'WHERE '.$alias.'.`active` = 1 AND fp.id_feature = '.(int)$filter['id_value'].' $sql_query['where'] = 'WHERE '.$alias.'.`active` = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")
AND fp.id_feature = '.(int)$filter['id_value'].'
AND p.id_product IN ( AND p.id_product IN (
SELECT id_product SELECT id_product
FROM '._DB_PREFIX_.'category_product cp FROM '._DB_PREFIX_.'category_product cp
@@ -2781,10 +2788,11 @@ class BlockLayered extends Module
INNER JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature_value = fp.id_feature_value AND (fv.custom IS NULL OR fv.custom = 0)) INNER JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature_value = fp.id_feature_value AND (fv.custom IS NULL OR fv.custom = 0))
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang = '.$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang = '.$id_lang.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_lang_value lifl LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_lang_value lifl
ON (lifl.id_feature = fp.id_feature AND lifl.id_lang = '.$id_lang.') ON (lifl.id_feature = fp.id_feature AND lifl.id_lang = '.$id_lang.')
LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang_value lifvl LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang_value lifvl
ON (lifvl.id_feature_value = fp.id_feature_value AND lifvl.id_lang = '.$id_lang.') ON (lifvl.id_feature_value = fp.id_feature_value AND lifvl.id_lang = '.$id_lang.')
WHERE '.$alias.'.`active` = 1 AND fp.id_feature = '.(int)$filter['id_value'].' WHERE '.$alias.'.`active` = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")
AND fp.id_feature = '.(int)$filter['id_value'].'
GROUP BY fv.id_feature_value'; GROUP BY fv.id_feature_value';
} }
@@ -2801,7 +2809,8 @@ class BlockLayered extends Module
FROM '._DB_PREFIX_.'category_product cp FROM '._DB_PREFIX_.'category_product cp
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = cp.id_product) '; LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = cp.id_product) ';
$sql_query['where'] = ' $sql_query['where'] = '
WHERE cp.id_category = c.id_category AND '.$alias.'.active = 1 '; WHERE cp.id_category = c.id_category
AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")';
$sql_query['group'] = ') count_products $sql_query['group'] = ') count_products
FROM '._DB_PREFIX_.'category c FROM '._DB_PREFIX_.'category c
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category AND cl.id_lang = '.$id_lang.') LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category AND cl.id_lang = '.$id_lang.')
@@ -3855,10 +3864,9 @@ class BlockLayered extends Module
public function ajaxCall() public function ajaxCall()
{ {
global $smarty; global $smarty, $cookie;
$selected_filters = $this->getSelectedFilters(); $selected_filters = $this->getSelectedFilters();
$this->getProducts($selected_filters, $products, $nb_products, $p, $n, $pages_nb, $start, $stop, $range); $this->getProducts($selected_filters, $products, $nb_products, $p, $n, $pages_nb, $start, $stop, $range);
// Add pagination variable // Add pagination variable
@@ -3871,8 +3879,8 @@ class BlockLayered extends Module
array( array(
'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
'nb_products' => $nb_products, 'nb_products' => $nb_products,
'category' => (object)array('id' => Tools::getValue('id_category_layered', 1)), 'category' => new Category(Tools::getValue('id_category_layered', 1), (int)$cookie->id_lang),
'pages_nb' => (int)($pages_nb), 'pages_nb' => (int)$pages_nb,
'p' => (int)$p, 'p' => (int)$p,
'n' => (int)$n, 'n' => (int)$n,
'range' => (int)$range, 'range' => (int)$range,
@@ -4013,8 +4021,8 @@ class BlockLayered extends Module
LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category) LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category)
WHERE c.active = 1'. WHERE c.active = 1'.
(count($categories_ids) ? ' AND cp.id_category IN ('.implode(',', $categories_ids).')' : '').' (count($categories_ids) ? ' AND cp.id_category IN ('.implode(',', $categories_ids).')' : '').'
AND '.$alias.'.active = 1'. AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")
(count($products_ids) ? ' AND p.id_product IN ('.implode(',', $products_ids).')' : '')); '.(count($products_ids) ? 'AND p.id_product IN ('.implode(',', $products_ids).')' : ''));
$attribute_groups_by_id = array(); $attribute_groups_by_id = array();
while ($row = $db->nextRow($attribute_groups)) while ($row = $db->nextRow($attribute_groups))
@@ -4029,7 +4037,7 @@ class BlockLayered extends Module
LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = p.id_product) LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = p.id_product)
LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category) LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category)
WHERE (fv.custom IS NULL OR fv.custom = 0) AND c.active = 1'.(count($categories_ids) ? ' AND cp.id_category IN ('.implode(',', $categories_ids).')' : '').' WHERE (fv.custom IS NULL OR fv.custom = 0) AND c.active = 1'.(count($categories_ids) ? ' AND cp.id_category IN ('.implode(',', $categories_ids).')' : '').'
AND '.$alias.'.active = 1'.(count($products_ids) ? ' AND p.id_product IN ('.implode(',', $products_ids).')' : '')); AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog") '.(count($products_ids) ? 'AND p.id_product IN ('.implode(',', $products_ids).')' : ''));
$features_by_id = array(); $features_by_id = array();
while ($row = $db->nextRow($features)) while ($row = $db->nextRow($features))
@@ -4048,9 +4056,9 @@ class BlockLayered extends Module
LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product = p.id_product) LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product = p.id_product)
'.$join_product.$join_product_attribute.' '.$join_product.$join_product_attribute.'
LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_product_attribute = pa.id_product_attribute) LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_product_attribute = pa.id_product_attribute)
WHERE c.active = 1'.(count($categories_ids) ? ' AND cp.id_category IN ('.implode(',', $categories_ids).')' : ''). WHERE c.active = 1'.(count($categories_ids) ? ' AND cp.id_category IN ('.implode(',', $categories_ids).')' : '').'
' AND '.$alias.'.active = 1'. AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")
(count($products_ids) ? ' AND p.id_product IN ('.implode(',', $products_ids).')' : ''). '.(count($products_ids) ? 'AND p.id_product IN ('.implode(',', $products_ids).')' : '').
' AND (fv.custom IS NULL OR fv.custom = 0) ' AND (fv.custom IS NULL OR fv.custom = 0)
GROUP BY p.id_product'); GROUP BY p.id_product');
+2 -2
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<module> <module>
<name>blocklayered</name> <name>blocklayered</name>
<displayName><![CDATA[Bloc navigation &agrave; facettes]]></displayName> <displayName><![CDATA[Layered navigation block]]></displayName>
<version><![CDATA[1.8.9]]></version> <version><![CDATA[1.8.9]]></version>
<description><![CDATA[Affiche un bloc avec les filtres de la navigation &agrave; facettes]]></description> <description><![CDATA[Displays a block with layered navigation filters.]]></description>
<author><![CDATA[PrestaShop]]></author> <author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab> <tab><![CDATA[front_office_features]]></tab>
<is_configurable>1</is_configurable> <is_configurable>1</is_configurable>
@@ -1,6 +1,7 @@
/* block myaccount */ /* block myaccount */
.myaccount ul {margin-bottom:10px} .myaccount ul {margin-bottom:10px;}
.myaccount li {border-bottom: 1px solid #eee} .myaccount .bullet .icon {display: none;}
.myaccount li {border-bottom: 1px solid #eee;}
.myaccount li a { .myaccount li a {
display: block; display: block;
padding: 7px 11px 5px 22px; padding: 7px 11px 5px 22px;
@@ -10,16 +11,14 @@
.myaccount p.logout { .myaccount p.logout {
padding-bottom:0; padding-bottom:0;
font-weight:bold; font-weight:bold;
text-align:right text-align:right;
} }
/* block myaccount in footer */ /* block myaccount in footer */
#footer .myaccount .title_block, #footer .myaccount h4 {background: none;} #footer .myaccount .title_block, #footer .myaccount h4 {background: none;}
#footer .myaccount .logout {display:none;} #footer .myaccount .logout {display:none;}
#footer .myaccount .title_block, #footer .myaccount h4 { #footer .myaccount .title_block, #footer .myaccount h4 {
padding:0 0 10px 0; padding:0 0 10px 0;
background:none background:none;
} }
#footer .myaccount ul {margin-bottom:0} #footer .myaccount ul {margin-bottom:0}
#footer .myaccount li {border-bottom:none} #footer .myaccount li {border-bottom:none}
@@ -27,7 +26,6 @@
display: block; display: block;
padding:0; padding:0;
color: #fff; color: #fff;
background: none background: none;
}
#footer .myaccount li.lnk_wishlist img {display:none
} }
#footer .myaccount li.lnk_wishlist img {display:none;}
+6 -1
View File
@@ -52,7 +52,7 @@ class Blocktopmenu extends Module
{ {
$this->name = 'blocktopmenu'; $this->name = 'blocktopmenu';
$this->tab = 'front_office_features'; $this->tab = 'front_office_features';
$this->version = 1.5; $this->version = 1.6;
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
parent::__construct(); parent::__construct();
@@ -69,6 +69,7 @@ class Blocktopmenu extends Module
!Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_SEARCH', '1') || !Configuration::updateGlobalValue('MOD_BLOCKTOPMENU_SEARCH', '1') ||
!$this->registerHook('actionObjectCategoryUpdateAfter') || !$this->registerHook('actionObjectCategoryUpdateAfter') ||
!$this->registerHook('actionObjectCategoryDeleteAfter') || !$this->registerHook('actionObjectCategoryDeleteAfter') ||
!$this->registerHook('actionObjectCategoryAddAfter') ||
!$this->registerHook('actionObjectCmsUpdateAfter') || !$this->registerHook('actionObjectCmsUpdateAfter') ||
!$this->registerHook('actionObjectCmsDeleteAfter') || !$this->registerHook('actionObjectCmsDeleteAfter') ||
!$this->registerHook('actionObjectSupplierUpdateAfter') || !$this->registerHook('actionObjectSupplierUpdateAfter') ||
@@ -798,6 +799,10 @@ class Blocktopmenu extends Module
return Db::getInstance()->executeS($sql); return Db::getInstance()->executeS($sql);
} }
public function hookActionObjectCategoryAddAfter($params)
{
$this->clearMenuCache();
}
public function hookActionObjectCategoryUpdateAfter($params) public function hookActionObjectCategoryUpdateAfter($params)
{ {
+1 -1
View File
@@ -2,7 +2,7 @@
<module> <module>
<name>blocktopmenu</name> <name>blocktopmenu</name>
<displayName><![CDATA[Top horizontal menu]]></displayName> <displayName><![CDATA[Top horizontal menu]]></displayName>
<version><![CDATA[1.5]]></version> <version><![CDATA[1.6]]></version>
<description><![CDATA[Add a new horizontal menu to the top of your e-commerce website.]]></description> <description><![CDATA[Add a new horizontal menu to the top of your e-commerce website.]]></description>
<author><![CDATA[PrestaShop]]></author> <author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab> <tab><![CDATA[front_office_features]]></tab>
@@ -0,0 +1,9 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_6($object)
{
return ($object->registerHook('actionObjectCategoryAddAfter'));
}
+3 -3
View File
@@ -16,9 +16,9 @@ function upgrade_module_1_2_1($object)
function homeslider_stripslashes_field($field) function homeslider_stripslashes_field($field)
{ {
$quotes = array('\'\\\\\'\'', '\'\\\'\''); $quotes = array('"\\\'"', '"\'"');
$dquotes = array('\'\\"\'', '\'"\''); $dquotes = array('\'\\\\"\'', '\'"\'');
$backslashes = array('\'\\\\\'', '\'\\\''); $backslashes = array('"\\\\\\\\"', '"\\\\"');
return '`'.bqSQL($field).'` = replace(replace(replace(`'.bqSQL($field).'`, '.$quotes[0].', '.$quotes[1].'), '.$dquotes[0].', '.$dquotes[1].'), '.$backslashes[0].', '.$backslashes[1].')'; return '`'.bqSQL($field).'` = replace(replace(replace(`'.bqSQL($field).'`, '.$quotes[0].', '.$quotes[1].'), '.$dquotes[0].', '.$dquotes[1].'), '.$backslashes[0].', '.$backslashes[1].')';
} }
+2 -2
View File
@@ -24,11 +24,11 @@
*} *}
<script type="text/javascript"> <script type="text/javascript">
{if isset($smarty.get.ad) && isset($smarty.get.live_edit)} {if isset($smarty.get.ad) && isset($smarty.get.live_edit)}
var ad = "{$smarty.get.ad}"; var ad = '{$smarty.get.ad}';
{/if} {/if}
var lastMove = ''; var lastMove = '';
var saveOK = '{l s='Module position saved' js=1}'; var saveOK = '{l s='Module position saved' js=1}';
var confirmClose = "{l s='Are you sure? If you close this window, its position won't be saved' js=1}"; var confirmClose = '{l s='Are you sure? If you close this window, its position won\'t be saved' js=1}';
var close = '{l s='Close' js=1}'; var close = '{l s='Close' js=1}';
var cancel = '{l s='Cancel' js=1}'; var cancel = '{l s='Cancel' js=1}';
var confirm = '{l s='Confirm' js=1}'; var confirm = '{l s='Confirm' js=1}';