// Merge -> revision 8734
This commit is contained in:
+2
-2
@@ -1957,7 +1957,7 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getPrice($tax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false, $usereduc = true, $quantity = 1)
|
public function getPrice($tax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false, $usereduc = true, $quantity = 1)
|
||||||
{
|
{
|
||||||
return self::getPriceStatic((int)($this->id), $tax, $id_product_attribute, $decimals, $divisor, $only_reduc, $usereduc, $quantity);
|
return Product::getPriceStatic((int)($this->id), $tax, $id_product_attribute, $decimals, $divisor, $only_reduc, $usereduc, $quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIdProductAttributeMostExpensive()
|
public function getIdProductAttributeMostExpensive()
|
||||||
@@ -1975,7 +1975,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public function getPriceWithoutReduct($notax = false, $id_product_attribute = false)
|
public function getPriceWithoutReduct($notax = false, $id_product_attribute = false)
|
||||||
{
|
{
|
||||||
return self::getPriceStatic((int)($this->id), !$notax, $id_product_attribute, 6, NULL, false, false);
|
return Product::getPriceStatic((int)($this->id), !$notax, $id_product_attribute, 6, NULL, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class ToolsInstall
|
|||||||
!isset($_GET['name']) OR empty($_GET['name']) OR !Validate::isUnixName($_GET['name']),
|
!isset($_GET['name']) OR empty($_GET['name']) OR !Validate::isUnixName($_GET['name']),
|
||||||
!isset($_GET['login']) OR empty($_GET['login']) OR !Validate::isUnixName($_GET['login']),
|
!isset($_GET['login']) OR empty($_GET['login']) OR !Validate::isUnixName($_GET['login']),
|
||||||
!isset($_GET['password']),
|
!isset($_GET['password']),
|
||||||
!isset($_GET['tablePrefix']) OR !Validate::isTablePrefix($_GET['tablePrefix']),
|
(!isset($_GET['tablePrefix']) OR !Validate::isTablePrefix($_GET['tablePrefix'])) && !empty($_GET['tablePrefix']),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($data_check AS $data)
|
foreach ($data_check AS $data)
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ function verifyDbAccess ()
|
|||||||
+"&password="+encodeURIComponent($("#dbPassword").val())
|
+"&password="+encodeURIComponent($("#dbPassword").val())
|
||||||
+"&engine="+$("#dbEngine option:selected").val()
|
+"&engine="+$("#dbEngine option:selected").val()
|
||||||
+ "&name=" + $("#dbName").val()
|
+ "&name=" + $("#dbName").val()
|
||||||
+ "&tablePrefix=" + $("#db_prefix").val(),
|
+ "&tablePrefix=" + encodeURIComponent($("#db_prefix").val()),
|
||||||
success: function(ret)
|
success: function(ret)
|
||||||
{
|
{
|
||||||
ret = ret.getElementsByTagName('action')[0];
|
ret = ret.getElementsByTagName('action')[0];
|
||||||
|
|||||||
@@ -49,15 +49,14 @@ class BlockLayered extends Module
|
|||||||
|
|
||||||
public function install()
|
public function install()
|
||||||
{
|
{
|
||||||
if ($this->registerHook('leftColumn') && $this->registerHook('header') && $this->registerHook('footer')
|
if (parent::install() && $this->registerHook('leftColumn') && $this->registerHook('header') && $this->registerHook('footer')
|
||||||
&& $this->registerHook('categoryAddition') && $this->registerHook('categoryUpdate') && $this->registerHook('attributeGroupForm')
|
&& $this->registerHook('categoryAddition') && $this->registerHook('categoryUpdate') && $this->registerHook('attributeGroupForm')
|
||||||
&& $this->registerHook('afterSaveAttributeGroup') && $this->registerHook('afterDeleteAttributeGroup') && $this->registerHook('featureForm')
|
&& $this->registerHook('afterSaveAttributeGroup') && $this->registerHook('afterDeleteAttributeGroup') && $this->registerHook('featureForm')
|
||||||
&& $this->registerHook('afterDeleteFeature') && $this->registerHook('afterSaveFeature') && $this->registerHook('categoryDeletion')
|
&& $this->registerHook('afterDeleteFeature') && $this->registerHook('afterSaveFeature') && $this->registerHook('categoryDeletion')
|
||||||
&& $this->registerHook('afterSaveProduct') && $this->registerHook('productListAssign') && $this->registerHook('postProcessAttributeGroup')
|
&& $this->registerHook('afterSaveProduct') && $this->registerHook('productListAssign') && $this->registerHook('postProcessAttributeGroup')
|
||||||
&& $this->registerHook('postProcessFeature') && $this->registerHook('featureValueForm') && $this->registerHook('postProcessFeatureValue')
|
&& $this->registerHook('postProcessFeature') && $this->registerHook('featureValueForm') && $this->registerHook('postProcessFeatureValue')
|
||||||
&& $this->registerHook('afterDeleteFeatureValue') && $this->registerHook('afterSaveFeatureValue') && $this->registerHook('attributeForm')
|
&& $this->registerHook('afterDeleteFeatureValue') && $this->registerHook('afterSaveFeatureValue') && $this->registerHook('attributeForm')
|
||||||
&& $this->registerHook('postProcessAttribute') && $this->registerHook('afterDeleteAttribute') && $this->registerHook('afterSaveAttribute')
|
&& $this->registerHook('postProcessAttribute') && $this->registerHook('afterDeleteAttribute') && $this->registerHook('afterSaveAttribute'))
|
||||||
&& parent::install())
|
|
||||||
{
|
{
|
||||||
Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', 0);
|
Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', 0);
|
||||||
Configuration::updateValue('PS_LAYERED_SHOW_QTIES', 1);
|
Configuration::updateValue('PS_LAYERED_SHOW_QTIES', 1);
|
||||||
@@ -65,24 +64,32 @@ class BlockLayered extends Module
|
|||||||
$this->rebuildLayeredStructure();
|
$this->rebuildLayeredStructure();
|
||||||
$this->rebuildLayeredCache();
|
$this->rebuildLayeredCache();
|
||||||
self::_installPriceIndexTable();
|
self::_installPriceIndexTable();
|
||||||
self::_installFriendlyUrlTable();
|
$this->_installFriendlyUrlTable();
|
||||||
self::_installIndexableAttributeTable();
|
$this->_installIndexableAttributeTable();
|
||||||
self::_installProductAttributeTable();
|
$this->_installProductAttributeTable();
|
||||||
|
|
||||||
$this->indexUrl();
|
$this->indexUrl();
|
||||||
$this->indexAttribute();
|
$this->indexAttribute();
|
||||||
|
|
||||||
|
if(Db::getInstance()->getValue('SELECT count(*) FROM `'._DB_PREFIX_.'product`') < 10000) // Lock price indexation if too many products
|
||||||
self::fullIndexProcess();
|
self::fullIndexProcess();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Installation failed (or hook registration) => uninstall the module
|
||||||
|
$this->uninstall();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function uninstall()
|
public function uninstall()
|
||||||
{
|
{
|
||||||
/* Delete all configurations */
|
/* Delete all configurations */
|
||||||
Configuration::deleteByName('PS_LAYERED_HIDE_0_VALUES');
|
Configuration::deleteByName('PS_LAYERED_HIDE_0_VALUES');
|
||||||
Configuration::deleteByName('PS_LAYERED_SHOW_QTIES');
|
Configuration::deleteByName('PS_LAYERED_SHOW_QTIES');
|
||||||
|
Configuration::deleteByName('PS_LAYERED_INDEXED');
|
||||||
|
|
||||||
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_price_index');
|
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_price_index');
|
||||||
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_friendly_url');
|
Db::getInstance()->Execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_friendly_url');
|
||||||
@@ -96,7 +103,7 @@ class BlockLayered extends Module
|
|||||||
return parent::uninstall();
|
return parent::uninstall();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _installPriceIndexTable()
|
private static function _installPriceIndexTable()
|
||||||
{
|
{
|
||||||
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_price_index`');
|
Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_price_index`');
|
||||||
|
|
||||||
@@ -986,7 +993,8 @@ class BlockLayered extends Module
|
|||||||
|
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->Execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'layered_price_index` (id_product, id_currency, price_min, price_max)
|
INSERT INTO `'._DB_PREFIX_.'layered_price_index` (id_product, id_currency, price_min, price_max)
|
||||||
VALUES '.implode(',', $values));
|
VALUES '.implode(',', $values).'
|
||||||
|
ON DUPLICATE KEY UPDATE id_product = id_product # avoid duplicate keys');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hookLeftColumn($params)
|
public function hookLeftColumn($params)
|
||||||
|
|||||||
Reference in New Issue
Block a user