'.$this->l('Only products that have this category as default category will be affected').'.
@@ -334,6 +335,7 @@ class AdminGroups extends AdminTab
$id_group_reductions = Tools::getValue('gr_id_group_reduction');
$reductions = Tools::getValue('gr_reduction');
if ($id_group_reductions)
+ {
foreach ($id_group_reductions AS $key => $id_group_reduction)
if (!Validate::isUnsignedId($id_group_reductions[$key]) OR !Validate::isPrice($reductions[$key]))
$this->_errors[] = Tools::displayError();
@@ -344,6 +346,7 @@ class AdminGroups extends AdminTab
if (!$groupReduction->update())
$this->_errors[] = Tools::displayError('Cannot update group reductions');
}
+ }
if (!sizeof($this->_errors))
parent::postProcess();
}
diff --git a/admin-dev/tabs/AdminLanguages.php b/admin-dev/tabs/AdminLanguages.php
index cabfd348d..8abe35e0e 100644
--- a/admin-dev/tabs/AdminLanguages.php
+++ b/admin-dev/tabs/AdminLanguages.php
@@ -93,7 +93,6 @@ class AdminLanguages extends AdminTab
}
unlink($tmpName);
}
-
}
/**
@@ -122,6 +121,13 @@ class AdminLanguages extends AdminTab
return !sizeof($this->_errors) ? true : false;
}
+ protected function copyFromPost(&$object, $table)
+ {
+ if($object->id AND ($object->iso_code != $_POST['iso_code']))
+ if(Validate::isLanguageIsoCode($_POST['iso_code']))
+ $object->moveToIso($_POST['iso_code']);
+ parent::copyFromPost($object, $table);
+ }
public function postProcess()
{
diff --git a/classes/Group.php b/classes/Group.php
index 5887ace1a..033a70d69 100644
--- a/classes/Group.php
+++ b/classes/Group.php
@@ -160,6 +160,8 @@ class GroupCore extends ObjectModel
{
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_group` = '.(int)($this->id));
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_group` = '.(int)($this->id));
+ Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_group` = '.(int)($this->id));
+ Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_group` = '.(int)($this->id));
Discount::deleteByIdGroup((int)($this->id));
return true;
}
diff --git a/classes/GroupReduction.php b/classes/GroupReduction.php
index d8b5e6bb2..8da11f4e2 100644
--- a/classes/GroupReduction.php
+++ b/classes/GroupReduction.php
@@ -61,10 +61,9 @@ class GroupReductionCore extends ObjectModel
public function delete()
{
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
- SELECT cp.`id_product`
- FROM `'._DB_PREFIX_.'category_product` cp
- INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = cp.`id_product`)
- WHERE cp.`id_category` = '.(int)($this->id_category)
+ SELECT p.`id_product`
+ FROM `'._DB_PREFIX_.'product` p
+ WHERE p.`id_category_default` = '.(int)($this->id_category)
, false);
while ($row = Db::getInstance()->nextRow($resource))
@@ -73,7 +72,7 @@ class GroupReductionCore extends ObjectModel
if (Db::getInstance()->Execute($query) === false)
return false;
}
- return ($this->_clearCache() AND parent::delete());
+ return (parent::delete());
}
protected function _clearCache()
@@ -84,10 +83,9 @@ class GroupReductionCore extends ObjectModel
protected function _setCache()
{
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
- SELECT cp.`id_product`
- FROM `'._DB_PREFIX_.'category_product` cp
- INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = cp.`id_product`)
- WHERE cp.`id_category` = '.(int)($this->id_category)
+ SELECT p.`id_product`
+ FROM `'._DB_PREFIX_.'product` p
+ WHERE p.`id_category_default` = '.(int)($this->id_category)
, false);
$query = 'INSERT INTO `'._DB_PREFIX_.'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`) VALUES ';
@@ -106,15 +104,16 @@ class GroupReductionCore extends ObjectModel
protected function _updateCache()
{
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
- SELECT cp.`id_product`
- FROM `'._DB_PREFIX_.'category_product` cp
- INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = cp.`id_product`)
- WHERE cp.`id_category` = '.(int)($this->id_category)
+ SELECT p.`id_product`
+ FROM `'._DB_PREFIX_.'product` p
+ WHERE p.`id_category_default` = '.(int)($this->id_category)
, false);
while ($row = Db::getInstance()->nextRow($resource))
{
- $query = 'UPDATE `'._DB_PREFIX_.'product_group_reduction_cache` SET `reduction` = '.(float)($this->reduction).' WHERE `id_product` = '.(int)($row['id_product']).' AND `id_group` = '.(int)($this->id_group);
+ $query = 'UPDATE `'._DB_PREFIX_.'product_group_reduction_cache`
+ SET `reduction` = '.(float)($this->reduction).'
+ WHERE `id_product` = '.(int)($row['id_product']).' AND `id_group` = '.(int)($this->id_group);
if (Db::getInstance()->Execute($query) === false)
return false;
}
@@ -134,13 +133,17 @@ class GroupReductionCore extends ObjectModel
public static function getValueForProduct($id_product, $id_group)
{
if (!isset(self::$reductionCache[$id_product.'-'.$id_group]))
- self::$reductionCache[$id_product.'-'.$id_group] = Db::getInstance()->getValue('SELECT `reduction` FROM `'._DB_PREFIX_.'product_group_reduction_cache` WHERE `id_product` = '.(int)($id_product).' AND `id_group` = '.(int)($id_group));
+ self::$reductionCache[$id_product.'-'.$id_group] = Db::getInstance()->getValue('SELECT `reduction`
+ FROM `'._DB_PREFIX_.'product_group_reduction_cache`
+ WHERE `id_product` = '.(int)($id_product).' AND `id_group` = '.(int)($id_group));
return self::$reductionCache[$id_product.'-'.$id_group];
}
public static function doesExist($id_group, $id_category)
{
- return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `id_group` FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_group` = '.(int)($id_group).' AND `id_category` = '.(int)($id_category));
+ return (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `id_group`
+ FROM `'._DB_PREFIX_.'group_reduction`
+ WHERE `id_group` = '.(int)($id_group).' AND `id_category` = '.(int)($id_category));
}
public function getGroupByCategoryId($id_category)
@@ -170,12 +173,13 @@ class GroupReductionCore extends ObjectModel
);
if (Db::getInstance()->NumRows() == 0)
- {
- $query = 'INSERT INTO `'._DB_PREFIX_.'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`) VALUES ';
- $query .= '('.(int)($id_product).', '.(int)($id_group).', '.(float)($reduction).')';
- }
+ $query = 'INSERT INTO `'._DB_PREFIX_.'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`)
+ VALUES ('.(int)($id_product).', '.(int)($id_group).', '.(float)($reduction).')';
else
- $query = 'UPDATE `'._DB_PREFIX_.'product_group_reduction_cache` SET `reduction` = '.(float)($reduction).' WHERE `id_product` = '.(int)($id_product).' AND `id_group` = '.(int)($id_group);
+ $query = 'UPDATE `'._DB_PREFIX_.'product_group_reduction_cache`
+ SET `reduction` = '.(float)($reduction).'
+ WHERE `id_product` = '.(int)($id_product).' AND `id_group` = '.(int)($id_group);
+
return (Db::getInstance()->Execute($query));
}
@@ -209,6 +213,4 @@ class GroupReductionCore extends ObjectModel
return false;
return true;
}
-}
-
-
+}
\ No newline at end of file
diff --git a/classes/Language.php b/classes/Language.php
index 2ee600125..4f97b137a 100644
--- a/classes/Language.php
+++ b/classes/Language.php
@@ -61,6 +61,13 @@ class LanguageCore extends ObjectModel
'objectsNodeName' => 'languages',
);
+ protected $translationsFilesAndVars = array(
+ 'fields' => '_FIELDS',
+ 'errors' => '_ERRORS',
+ 'admin' => '_LANGADM',
+ 'pdf' => '_LANGPDF',
+ );
+
public function __construct($id = NULL, $id_lang = NULL)
{
parent::__construct($id);
@@ -79,25 +86,53 @@ class LanguageCore extends ObjectModel
return $fields;
}
+ /**
+ * Generate traslations files
+ *
+ */
+ private function _generateFiles($newIso){
+ $iso_code = $newIso?$newIso:$this->iso_code;
+
+ if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
+ mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
+ foreach ($this->translationsFilesAndVars as $file => $var)
+ if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php'))
+ file_put_contents(_PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php', '');
+ }
+
+ /**
+ * Move translations files after editiing language iso code
+ */
+ public function moveToIso($newIso)
+ {
+ if($newIso == $this->iso_code)
+ return true;
+
+ if (file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code))
+ rename(_PS_TRANSLATIONS_DIR_.$this->iso_code, _PS_TRANSLATIONS_DIR_.$newIso);
+
+ if (file_exists(_PS_MAIL_DIR_.$this->iso_code))
+ rename(_PS_MAIL_DIR_.$this->iso_code, _PS_MAIL_DIR_.$newIso);
+
+ foreach (Module::getModulesDirOnDisk() as $moduleDir) {
+ if (file_exists(_PS_MODULE_DIR_.$moduleDir.'/mails/'.$this->iso_code))
+ rename(_PS_MODULE_DIR_.$moduleDir.'/mails/'.$this->iso_code, _PS_MODULE_DIR_.$moduleDir.'/mails/'.$newIso);
+
+ if (file_exists(_PS_MODULE_DIR_.$moduleDir.'/'.$this->iso_code.'.php'))
+ rename(_PS_MODULE_DIR_.$moduleDir.'/'.$this->iso_code.'.php', _PS_MODULE_DIR_.$moduleDir.'/'.$newIso.'.php');
+ }
+ }
+
public function add($autodate = true, $nullValues = false)
{
if (!parent::add($autodate))
return false;
- $translationsFiles = array(
- 'fields' => '_FIELDS',
- 'errors' => '_ERRORS',
- 'admin' => '_LANGADM',
- 'pdf' => '_LANGPDF',
- );
- if (!file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code))
- mkdir(_PS_TRANSLATIONS_DIR_.$this->iso_code);
- foreach ($translationsFiles as $file => $var)
- if (!file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code.'/'.$file.'.php'))
- file_put_contents(_PS_TRANSLATIONS_DIR_.$this->iso_code.'/'.$file.'.php', '');
+ // create empty files if they not exists
+ $this->_generateFiles();
$resUpdateSQL = $this->loadUpdateSQL();
// If url_rewrite is not enabled, we don't need to regenerate .htaccess
@@ -565,6 +600,8 @@ class LanguageCore extends ObjectModel
public function update($nullValues = false)
{
+
+
if (!parent::update($nullValues))
return false;
diff --git a/classes/LocalizationPack.php b/classes/LocalizationPack.php
index c5ae9506b..a7c78d92f 100644
--- a/classes/LocalizationPack.php
+++ b/classes/LocalizationPack.php
@@ -347,7 +347,7 @@ class LocalizationPackCore
{
if ($lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$attributes['iso_code'])))
{
- if ($content = file_get_contents('http://www.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
+ if ($content = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
{
$file = _PS_TRANSLATIONS_DIR_.$attributes['iso_code'].'.gzip';
if (file_put_contents($file, $content))
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index 87d01a417..7f0d58a73 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -296,7 +296,7 @@ abstract class PaymentModuleCore extends Module
$shrunk = false;
foreach ($discounts AS $discount)
{
- $objDiscount = new Discount((int)$discount['id_discount'], $order->id_lang);
+ $objDiscount = new Discount((int)$discount['id_discount']);
$value = $objDiscount->getValue(sizeof($discounts), $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS), $order->total_shipping, $cart->id);
if ($objDiscount->id_discount_type == 2 AND in_array($objDiscount->behavior_not_exhausted, array(1,2)))
$shrunk = true;
@@ -314,6 +314,9 @@ abstract class PaymentModuleCore extends Module
$voucher->add();
$params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);
$params['{voucher_num}'] = $voucher->name;
+ $params['{firstname}'] = $customer->firstname;
+ $params['{lastname}'] = $customer->lastname;
+ $params['{id_order}'] = $order->id;
@Mail::Send((int)$order->id_lang, 'voucher', Mail::l('New voucher regarding your order #').$order->id, $params, $customer->email, $customer->firstname.' '.$customer->lastname);
}
}
diff --git a/classes/Product.php b/classes/Product.php
index 1c50e13c2..3f37e41ed 100644
--- a/classes/Product.php
+++ b/classes/Product.php
@@ -686,7 +686,7 @@ class ProductCore extends ObjectModel
if (!$this->addToCategories($categories))
return false;
- if (!$this->setGroupReduction($categories))
+ if (!$this->setGroupReduction())
return false;
return true;
@@ -3427,26 +3427,17 @@ class ProductCore extends ObjectModel
/**
* Set Group reduction if needed
- * @param string $productCategories Categories the product belongs to
*/
- public function setGroupReduction($categories)
+ public function setGroupReduction()
{
- if (sizeof($categories) > 1) // Use category_default id if more than 1 category
- $row = GroupReduction::getGroupByCategoryId((int)$this->id_category_default);
- else
- $row = GroupReduction::getGroupByCategoryId((int)array_pop($categories));
-
- if (!$row)
+ $row = GroupReduction::getGroupByCategoryId($this->id_category_default);
+ if (!$row) // Remove
{
- // Then Remove
if (!GroupReduction::deleteProductReduction($this->id))
return false;
}
- else
- {
- if (!GroupReduction::setProductReduction($this->id, $row['id_group'], $category, $row['reduction'])) // Add or Edit
+ else if (!GroupReduction::setProductReduction($this->id, $row['id_group'], $this->id_category_default, (float)$row['reduction']))
return false;
- }
return true;
}
}
diff --git a/install-dev/img/bg_field.png b/install-dev/img/bg_field.png
new file mode 100644
index 000000000..e1f4ecc10
Binary files /dev/null and b/install-dev/img/bg_field.png differ
diff --git a/install-dev/img/bg_li_stepList.png b/install-dev/img/bg_li_stepList.png
index c0efe40a8..98615f41d 100755
Binary files a/install-dev/img/bg_li_stepList.png and b/install-dev/img/bg_li_stepList.png differ
diff --git a/install-dev/index.php b/install-dev/index.php
index 37d58979c..aeb8f4440 100644
--- a/install-dev/index.php
+++ b/install-dev/index.php
@@ -433,13 +433,13 @@ if ($lm->getIncludeTradFilename())
-
+
-
/config
+
/config
/tools/smarty/compile
/tools/smarty/cache
/tools/smarty_v2/compile
@@ -447,7 +447,7 @@ if ($lm->getIncludeTradFilename())
/sitemap.xml
/log
-
/img
+
/img
/mails
/modules
/themes/prestashop/lang
@@ -519,7 +519,7 @@ if ($lm->getIncludeTradFilename())
-
+
@@ -802,7 +802,7 @@ if ($lm->getIncludeTradFilename())
echo '
-
+
@@ -1214,13 +1214,13 @@ if ($lm->getIncludeTradFilename())
-
+
-
/config
+
/config
/tools/smarty/compile
/tools/smarty/cache
/tools/smarty_v2/compile
@@ -1228,7 +1228,7 @@ if ($lm->getIncludeTradFilename())
/sitemap.xml
/log
-
/img
+
/img
/mails
/modules
/themes/prestashop/lang
diff --git a/install-dev/view.css b/install-dev/view.css
index c015fdd8e..53df865f1 100644
--- a/install-dev/view.css
+++ b/install-dev/view.css
@@ -203,7 +203,7 @@ select {
div.field {
padding:10px 0;
- border-bottom:1px solid #ccc;
+ background:url(img/bg_field.png) repeat-x 0 100% transparent;
}
div.field label {
display:inline-block;
@@ -220,10 +220,13 @@ div.field {
display:inline-block;
width:200px;
font-size:11px;
+ font-family:Georgia;
font-style:italic;
color:#999;
}
+#uploadedImage {border:1px solid #ccc;}
+
.okBlock {
padding:20px 20px 20px 38px;
background:#b7e2a7 url(img/pict_ok.png) no-repeat 15px 21px;
@@ -376,11 +379,13 @@ ul#footer a:link, ul#footer a:active, ul#footer a:visited {
}
.sheet .contentTitle .stepList li {
float:left;
+ margin:0 0 0 5px;
height:42px;
width:42px;
text-indent:-5000px;
background:transparent url(img/bg_li_stepList.png) no-repeat 0 0;
}
+
.sheet .contentTitle .stepList li.ok {background-position:0 -50px;}
.sheet .contentTitle .stepList li.ko {background-position:0 -100px;}
.sheet .contentTitle h1 {text-shadow:0 1px 0 #fff;}
@@ -409,16 +414,21 @@ ul#langList {list-style-type:none;}
}*/
ul#required,
-ul#optional {list-style-type:none;}
+ul#optional {
+ list-style-type: none;
+ margin: 0;
+}
ul#required li,
ul#optional li {
padding:6px 8px 4px 8px;
+ font-size:12px;
background:#f8f8f8;
}
ul#required li.title,
ul#optional li.title {
margin-top: 20px;
padding:4px 8px;
+ font-size:13px;
background:#f8f8f8 url(img/bg_li_title.png) repeat-x 0 0;
}
ul#required li.required ,
@@ -428,11 +438,11 @@ ul#optional {list-style-type:none;}
}
ul#required li.ok,
ul#optional li.ok{
- background:#f8f8f8 url(img/pict_ok.png) no-repeat 100% 10px;
+ background:#f8f8f8 url(img/pict_ok.png) no-repeat 99% 10px
}
ul#required li.fail,
ul#optional li.fail {
- background:#f8f8f8 url(img/pict_error.png) no-repeat 100% 8px;
+ background:#f8f8f8 url(img/pict_error.png) no-repeat 99% 8px;
}
/* ETAPE 3 - DB ************************************************************* */
@@ -443,15 +453,22 @@ ul#optional {list-style-type:none;}
#formCheckSQL p,
#mailSMTPParam p {
- /*
- USELESS
padding:10px 0;
- border-top:1px solid #fff;
- border-bottom:1px solid #ccc;*/
+ background:url(img/bg_field.png) repeat-x 0 100% transparent;
}
#formCheckSQL p.first {border-top:none;}
#formCheckSQL p.last {border-bottom:none;}
-/*USELESS #formCheckSQL p#dbResultCheck {border:none;}*/
+#formCheckSQL p#dbResultCheck {background:none;}
+#formCheckSQL p#dbResultCheck.errorBlock {
+ background: url("img/pict_error.png") no-repeat scroll 15px 21px #FFEBE8;
+ border: 1px solid #CC0000;
+ padding: 20px 20px 20px 38px;
+}
+#formCheckSQL p#dbResultCheck.okBlock {
+ padding:20px 20px 20px 38px;
+ background:#b7e2a7 url(img/pict_ok.png) no-repeat 15px 21px;
+ border:1px solid #85c10c;
+}
#formCheckSQL p label,
#mailSMTPParam p label {
display:inline-block;
@@ -477,7 +494,7 @@ ul#optional {list-style-type:none;}
#mailPart .userInfos {
padding-left:18px;
- font: 11px Georgia, Arial, Sans-serif italic;
+ font:italic 11px Georgia, Arial, Sans-serif italic;
color:#999;
}
@@ -509,7 +526,6 @@ ul#optional {list-style-type:none;}
.moduleTable {
padding: 5px;
width: 650px;
- background:#fff;
border: 1px solid #CCC;
border-bottom:none;
}
diff --git a/modules/authorizeaim/authorizeaim.php b/modules/authorizeaim/authorizeaim.php
index abc43ae39..d042fc378 100755
--- a/modules/authorizeaim/authorizeaim.php
+++ b/modules/authorizeaim/authorizeaim.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class authorizeAIM extends PaymentModule
diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php
index f59d800a3..99d36be89 100644
--- a/modules/bankwire/bankwire.php
+++ b/modules/bankwire/bankwire.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BankWire extends PaymentModule
diff --git a/modules/birthdaypresent/birthdaypresent.php b/modules/birthdaypresent/birthdaypresent.php
index 3789eeab7..2988da372 100644
--- a/modules/birthdaypresent/birthdaypresent.php
+++ b/modules/birthdaypresent/birthdaypresent.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BirthdayPresent extends Module
diff --git a/modules/blockadvertising/blockadvertising.php b/modules/blockadvertising/blockadvertising.php
index 83e015595..08c47ee08 100644
--- a/modules/blockadvertising/blockadvertising.php
+++ b/modules/blockadvertising/blockadvertising.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BlockAdvertising extends Module
diff --git a/modules/blockbestsellers/blockbestsellers.php b/modules/blockbestsellers/blockbestsellers.php
index 8db005a4a..979ac15bd 100644
--- a/modules/blockbestsellers/blockbestsellers.php
+++ b/modules/blockbestsellers/blockbestsellers.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BlockBestSellers extends Module
diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php
index 3e631d471..324bc0658 100644
--- a/modules/blockcart/blockcart.php
+++ b/modules/blockcart/blockcart.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BlockCart extends Module
diff --git a/modules/blockcategories/blockcategories.php b/modules/blockcategories/blockcategories.php
index ce7a75be9..50a7aeead 100644
--- a/modules/blockcategories/blockcategories.php
+++ b/modules/blockcategories/blockcategories.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BlockCategories extends Module
diff --git a/modules/blockcms/blockcms.php b/modules/blockcms/blockcms.php
index 48da22861..388a306d8 100755
--- a/modules/blockcms/blockcms.php
+++ b/modules/blockcms/blockcms.php
@@ -24,7 +24,8 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+
+if (!defined('_PS_VERSION_'))
exit;
class BlockCms extends Module
@@ -110,8 +111,14 @@ class BlockCms extends Module
LEFT JOIN `'._DB_PREFIX_.'cms_block_lang` cbl ON (cbl.`id_cms_block` = cb.`id_cms_block`)
WHERE cb.`id_cms_block` = '.(int)$id_cms_block);
+ $store_display_update = array(0, $size = count($cmsBlocks), $display = Configuration::get('PS_STORES_DISPLAY_FOOTER'));
foreach ($cmsBlocks AS $cmsBlock)
+ {
$cmsBlocks['name'][(int)$cmsBlock['id_lang']] = $cmsBlock['name'];
+ if ($store_display_update['0'] < $store_display_update['1'])
+ $cmsBlocks[$store_display_update['0']]['display_store'] = $store_display_update['2'];
+ ++$store_display_update['0'];
+ }
return $cmsBlocks;
}
@@ -589,6 +596,10 @@ class BlockCms extends Module
INSERT INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`, `name`)
VALUES('.(int)$id_cms_block.', '.(int)$language['id_lang'].',
"'.pSQL(Tools::getValue('block_name_'.$language['id_lang'])).'")');
+
+ Db::getInstance()->Execute('
+ UPDATE `'._DB_PREFIX_.'cms_block
+ SET `display_store` = '.Configuration::get('PS_STORES_DISPLAY_FOOTER'));
}
elseif (Tools::isSubmit('editBlockCMS'))
{
@@ -619,6 +630,8 @@ class BlockCms extends Module
`display_store` = '.(int)(Tools::getValue('PS_STORES_DISPLAY_CMS')).'
WHERE `id_cms_block` = '.(int)($id_cms_block));
+ Configuration::updateValue('PS_STORES_DISPLAY_FOOTER', (int)(Tools::getValue('PS_STORES_DISPLAY_CMS')));
+
foreach ($languages as $language)
Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'cms_block_lang`
diff --git a/modules/blockcurrencies/blockcurrencies.php b/modules/blockcurrencies/blockcurrencies.php
index b7dd0366e..20817b01a 100644
--- a/modules/blockcurrencies/blockcurrencies.php
+++ b/modules/blockcurrencies/blockcurrencies.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BlockCurrencies extends Module
diff --git a/modules/blockcustomerprivacy/blockcustomerprivacy.php b/modules/blockcustomerprivacy/blockcustomerprivacy.php
index d3b8a1e88..eb037bf1a 100644
--- a/modules/blockcustomerprivacy/blockcustomerprivacy.php
+++ b/modules/blockcustomerprivacy/blockcustomerprivacy.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class blockcustomerprivacy extends Module
@@ -157,4 +157,4 @@ class blockcustomerprivacy extends Module
));
return $this->display(__FILE__, 'blockcustomerprivacy.tpl');
}
-}
\ No newline at end of file
+}
diff --git a/modules/blocklanguages/blocklanguages.php b/modules/blocklanguages/blocklanguages.php
index 0c340f47a..91ba7d20b 100644
--- a/modules/blocklanguages/blocklanguages.php
+++ b/modules/blocklanguages/blocklanguages.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BlockLanguages extends Module
diff --git a/modules/blocklayered/blocklayered.js b/modules/blocklayered/blocklayered.js
index fb3560db6..2d333da2c 100644
--- a/modules/blocklayered/blocklayered.js
+++ b/modules/blocklayered/blocklayered.js
@@ -170,9 +170,9 @@ function reloadContent(params_plus)
reloadContent();
return false;
});
+ ajaxCart.overrideButtonsInThePage();
}
});
-
ajaxQueries.push(ajaxQuery);
}
diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php
index 1ca703b1e..c4ee21e5a 100644
--- a/modules/blocklayered/blocklayered.php
+++ b/modules/blocklayered/blocklayered.php
@@ -25,7 +25,7 @@
* International Registred Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BlockLayered extends Module
@@ -1491,4 +1491,4 @@ if (!isset($doneCategories[(int)$id_category]['p']))
else
return $share_url;
}
-}
\ No newline at end of file
+}
diff --git a/modules/blocklink/blocklink.php b/modules/blocklink/blocklink.php
index ea2460d76..91c3c3bbd 100644
--- a/modules/blocklink/blocklink.php
+++ b/modules/blocklink/blocklink.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-if (!defined('_CAN_LOAD_FILES_'))
+if (!defined('_PS_VERSION_'))
exit;
class BlockLink extends Module
@@ -35,56 +35,56 @@ class BlockLink extends Module
public function __construct()
{
- $this->name = 'blocklink';
- $this->tab = 'front_office_features';
- $this->version = '1.5';
+ $this->name = 'blocklink';
+ $this->tab = 'front_office_features';
+ $this->version = '1.5';
$this->author = 'PrestaShop';
$this->need_instance = 0;
parent::__construct();
- $this->displayName = $this->l('Link block');
- $this->description = $this->l('Adds a block with additional links.');
+ $this->displayName = $this->l('Link block');
+ $this->description = $this->l('Adds a block with additional links.');
$this->confirmUninstall = $this->l('Are you sure you want to delete all your links ?');
}
public function install()
{
- if (!parent::install() OR
- !$this->registerHook('leftColumn') OR
- !Db::getInstance()->Execute('
- CREATE TABLE '._DB_PREFIX_.'blocklink (
- `id_blocklink` int(2) NOT NULL AUTO_INCREMENT,
- `url` varchar(255) NOT NULL,
- `new_window` TINYINT(1) NOT NULL,
- PRIMARY KEY(`id_blocklink`))
- ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8') OR
- !Db::getInstance()->Execute('
- CREATE TABLE '._DB_PREFIX_.'blocklink_lang (
- `id_blocklink` int(2) NOT NULL,
- `id_lang` int(2) NOT NULL,
- `text` varchar(64) NOT NULL,
- PRIMARY KEY(`id_blocklink`, `id_lang`))
- ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8') OR
- !Configuration::updateValue('PS_BLOCKLINK_TITLE', array('1' => 'Block link', '2' => 'Bloc lien')))
- return false;
- return true;
+ if (!parent::install() OR
+ !$this->registerHook('leftColumn') OR
+ !Db::getInstance()->Execute('
+ CREATE TABLE '._DB_PREFIX_.'blocklink (
+ `id_blocklink` int(2) NOT NULL AUTO_INCREMENT,
+ `url` varchar(255) NOT NULL,
+ `new_window` TINYINT(1) NOT NULL,
+ PRIMARY KEY(`id_blocklink`))
+ ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8') OR
+ !Db::getInstance()->Execute('
+ CREATE TABLE '._DB_PREFIX_.'blocklink_lang (
+ `id_blocklink` int(2) NOT NULL,
+ `id_lang` int(2) NOT NULL,
+ `text` varchar(64) NOT NULL,
+ PRIMARY KEY(`id_blocklink`, `id_lang`))
+ ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8') OR
+ !Configuration::updateValue('PS_BLOCKLINK_TITLE', array('1' => 'Block link', '2' => 'Bloc lien')))
+ return false;
+ return true;
}
public function uninstall()
{
- if (!parent::uninstall() OR
- !Db::getInstance()->Execute('DROP TABLE '._DB_PREFIX_.'blocklink') OR
- !Db::getInstance()->Execute('DROP TABLE '._DB_PREFIX_.'blocklink_lang') OR
- !Configuration::deleteByName('PS_BLOCKLINK_TITLE') OR
- !Configuration::deleteByName('PS_BLOCKLINK_URL'))
- return false;
- return true;
+ if (!parent::uninstall() OR
+ !Db::getInstance()->Execute('DROP TABLE '._DB_PREFIX_.'blocklink') OR
+ !Db::getInstance()->Execute('DROP TABLE '._DB_PREFIX_.'blocklink_lang') OR
+ !Configuration::deleteByName('PS_BLOCKLINK_TITLE') OR
+ !Configuration::deleteByName('PS_BLOCKLINK_URL'))
+ return false;
+ return true;
}
public function hookLeftColumn($params)
{
- $links = $this->getLinks();
+ $links = $this->getLinks();
$this->context->smarty->assign(array(
'blocklink_links' => $links,
@@ -92,7 +92,7 @@ class BlockLink extends Module
'url' => Configuration::get('PS_BLOCKLINK_URL'),
'lang' => 'text_'.$this->context->language->id
));
- if (!$links)
+ if (!$links)
return false;
return $this->display(__FILE__, 'blocklink.tpl');
}
@@ -104,14 +104,14 @@ class BlockLink extends Module
public function getLinks()
{
- $result = array();
- /* Get id and url */
- if (!$links = Db::getInstance()->ExecuteS('SELECT `id_blocklink`, `url`, `new_window` FROM '._DB_PREFIX_.'blocklink'.((int)(Configuration::get('PS_BLOCKLINK_ORDERWAY')) == 1 ? ' ORDER BY `id_blocklink` DESC' : '')))
- return false;
- $i = 0;
- foreach ($links AS $link)
- {
- $result[$i]['id'] = $link['id_blocklink'];
+ $result = array();
+ /* Get id and url */
+ if (!$links = Db::getInstance()->ExecuteS('SELECT `id_blocklink`, `url`, `new_window` FROM '._DB_PREFIX_.'blocklink'.((int)(Configuration::get('PS_BLOCKLINK_ORDERWAY')) == 1 ? ' ORDER BY `id_blocklink` DESC' : '')))
+ return false;
+ $i = 0;
+ foreach ($links AS $link)
+ {
+ $result[$i]['id'] = $link['id_blocklink'];
$result[$i]['url'] = $link['url'];
$result[$i]['newWindow'] = $link['new_window'];
/* Get multilingual text */
@@ -121,58 +121,58 @@ class BlockLink extends Module
$result[$i]['text_'.$text['id_lang']] = $text['text'];
$i++;
}
- return $result;
+ return $result;
}
public function addLink()
{
- /* Url registration */
- if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'blocklink VALUES (NULL, \''.pSQL($_POST['url']).'\', '.((isset($_POST['newWindow']) AND $_POST['newWindow']) == 'on' ? 1 : 0).')') OR !$lastId = Db::getInstance()->Insert_ID())
- return false;
- /* Multilingual text */
- $languages = Language::getLanguages();
- $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
- if (!$languages)
- return false;
- foreach ($languages AS $language)
- if (!empty($_POST['text_'.$language['id_lang']]))
- {
- if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang VALUES ('.(int)($lastId).', '.(int)($language['id_lang']).', \''.pSQL($_POST['text_'.$language['id_lang']]).'\')'))
- return false;
- }
- else
- if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang VALUES ('.(int)($lastId).', '.(int)($language['id_lang']).', \''.pSQL($_POST['text_'.$defaultLanguage]).'\')'))
- return false;
- return true;
+ /* Url registration */
+ if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'blocklink VALUES (NULL, \''.pSQL($_POST['url']).'\', '.((isset($_POST['newWindow']) AND $_POST['newWindow']) == 'on' ? 1 : 0).')') OR !$lastId = Db::getInstance()->Insert_ID())
+ return false;
+ /* Multilingual text */
+ $languages = Language::getLanguages();
+ $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
+ if (!$languages)
+ return false;
+ foreach ($languages AS $language)
+ if (!empty($_POST['text_'.$language['id_lang']]))
+ {
+ if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang VALUES ('.(int)($lastId).', '.(int)($language['id_lang']).', \''.pSQL($_POST['text_'.$language['id_lang']]).'\')'))
+ return false;
+ }
+ else
+ if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang VALUES ('.(int)($lastId).', '.(int)($language['id_lang']).', \''.pSQL($_POST['text_'.$defaultLanguage]).'\')'))
+ return false;
+ return true;
}
public function updateLink()
{
- /* Url registration */
- if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'blocklink SET `url`=\''.pSQL($_POST['url']).'\', `new_window`='.(isset($_POST['newWindow']) ? 1 : 0).' WHERE `id_blocklink`='.(int)($_POST['id'])))
- return false;
- /* Multilingual text */
- $languages = Language::getLanguages();
- $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
- if (!$languages)
+ /* Url registration */
+ if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'blocklink SET `url`=\''.pSQL($_POST['url']).'\', `new_window`='.(isset($_POST['newWindow']) ? 1 : 0).' WHERE `id_blocklink`='.(int)($_POST['id'])))
+ return false;
+ /* Multilingual text */
+ $languages = Language::getLanguages();
+ $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
+ if (!$languages)
return false;
if (!Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'blocklink_lang WHERE `id_blocklink` = '.(int)($_POST['id'])))
return false ;
- foreach ($languages AS $language)
- if (!empty($_POST['text_'.$language['id_lang']]))
+ foreach ($languages AS $language)
+ if (!empty($_POST['text_'.$language['id_lang']]))
{
- if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang VALUES ('.(int)($_POST['id']).', '.(int)($language['id_lang']).', \''.pSQL($_POST['text_'.$language['id_lang']]).'\')'))
- return false;
+ if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang VALUES ('.(int)($_POST['id']).', '.(int)($language['id_lang']).', \''.pSQL($_POST['text_'.$language['id_lang']]).'\')'))
+ return false;
}
- else
+ else
if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang VALUES ('.(int)($_POST['id']).', '.$language['id_lang'].', \''.pSQL($_POST['text_'.$defaultLanguage]).'\')'))
- return false;
- return true;
+ return false;
+ return true;
}
public function deleteLink()
{
- return Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'blocklink WHERE `id_blocklink`='.(int)($_GET['id']));
+ return Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'blocklink WHERE `id_blocklink`='.(int)($_GET['id']));
}
public function updateTitle()
@@ -181,92 +181,98 @@ class BlockLink extends Module
$result = array();
foreach ($languages AS $language)
$result[$language['id_lang']] = $_POST['title_'.$language['id_lang']];
- if (!Configuration::updateValue('PS_BLOCKLINK_TITLE', $result))
- return false;
- return Configuration::updateValue('PS_BLOCKLINK_URL', $_POST['title_url']);
+ if (!Configuration::updateValue('PS_BLOCKLINK_TITLE', $result))
+ return false;
+ return Configuration::updateValue('PS_BLOCKLINK_URL', $_POST['title_url']);
}
public function getContent()
{
- $this->_html = '
'.$this->displayName.'
+ $this->_html = '
'.$this->displayName.'
';
- /* Add a link */
- if (isset($_POST['submitLinkAdd']))
+ /* Add a link */
+ if (isset($_POST['submitLinkAdd']))
{
- if (empty($_POST['text_'.Configuration::get('PS_LANG_DEFAULT')]) OR empty($_POST['url']))
- $this->_html .= $this->displayError($this->l('You must fill in all fields'));
- elseif (!Validate::isUrl(str_replace('http://', '', $_POST['url'])))
- $this->_html .= $this->displayError($this->l('Bad URL'));
- else
- if ($this->addLink())
+ if (empty($_POST['text_'.Configuration::get('PS_LANG_DEFAULT')]) OR empty($_POST['url']))
+ $this->_html .= $this->displayError($this->l('You must fill in all fields'));
+ elseif (!Validate::isUrl(str_replace('http://', '', $_POST['url'])))
+ $this->_html .= $this->displayError($this->l('Bad URL'));
+ else
+ if ($this->addLink())
$this->_html .= $this->displayConfirmation($this->l('The link has been added.'));
- else
- $this->_html .= $this->displayError($this->l('An error occurred during link creation.'));
+ else
+ $this->_html .= $this->displayError($this->l('An error occurred during link creation.'));
}
- /* Update a link */
- elseif (isset($_POST['submitLinkUpdate']))
- {
- if (empty($_POST['text_'.Configuration::get('PS_LANG_DEFAULT')]) OR empty($_POST['url']))
- $this->_html .= $this->displayError($this->l('You must fill in all fields'));
- elseif (!Validate::isUrl(str_replace('http://', '', $_POST['url'])))
- $this->_html .= $this->displayError($this->l('Bad URL'));
- else
- if (empty($_POST['id']) OR !is_numeric($_POST['id']) OR !$this->updateLink())
- $this->_html .= $this->displayError($this->l('An error occurred during link updating.'));
- else
- $this->_html .= $this->displayConfirmation($this->l('The link has been updated.'));
- }
- /* Update the block title */
- elseif (isset($_POST['submitTitle']))
- {
- if (empty($_POST['title_'.Configuration::get('PS_LANG_DEFAULT')]))
- $this->_html .= $this->displayError($this->l('"title" field cannot be empty.'));
- elseif (!empty($_POST['title_url']) AND !Validate::isUrl(str_replace('http://', '', $_POST['title_url'])))
- $this->_html .= $this->displayError($this->l('The \'title\' field is invalid'));
- elseif (!Validate::isGenericName($_POST['title_'.Configuration::get('PS_LANG_DEFAULT')]))
- $this->_html .= $this->displayError($this->l('The \'title\' field is invalid'));
- elseif (!$this->updateTitle())
- $this->_html .= $this->displayError($this->l('An error occurred during title updating.'));
- else
- $this->_html .= $this->displayConfirmation($this->l('The block title has been updated.'));
- }
- /* Delete a link*/
- elseif (isset($_GET['id']))
- {
- if (!is_numeric($_GET['id']) OR !$this->deleteLink())
- $this->_html .= $this->displayError($this->l('An error occurred during link deletion.'));
- else
- $this->_html .= $this->displayConfirmation($this->l('The link has been deleted.'));
- }
- if (isset($_POST['submitOrderWay']))
+ /* Update a link */
+ elseif (isset($_POST['submitLinkUpdate']))
{
- if (Configuration::updateValue('PS_BLOCKLINK_ORDERWAY', (int)Tools::getValue('orderWay')))
+
+ if (empty($_POST['text_'.Configuration::get('PS_LANG_DEFAULT')]) OR empty($_POST['url']))
+ $this->_html .= $this->displayError($this->l('You must fill in all fields'));
+ elseif (!Validate::isUrl(str_replace('http://', '', $_POST['url'])))
+ $this->_html .= $this->displayError($this->l('Bad URL'));
+ else
+ if (empty($_POST['id']) OR !is_numeric($_POST['id']) OR !$this->updateLink())
+ $this->_html .= $this->displayError($this->l('An error occurred during link updating.'));
+ else
+ $this->_html .= $this->displayConfirmation($this->l('The link has been updated.'));
+ }
+
+ /* Update the block title */
+ elseif (isset($_POST['submitTitle']))
+ {
+
+ if (empty($_POST['title_'.Configuration::get('PS_LANG_DEFAULT')]))
+ $this->_html .= $this->displayError($this->l('"title" field cannot be empty.'));
+ elseif (!empty($_POST['title_url']) AND !Validate::isUrl(str_replace('http://', '', $_POST['title_url'])))
+ $this->_html .= $this->displayError($this->l('The \'title\' field is invalid'));
+ elseif (!Validate::isGenericName($_POST['title_'.Configuration::get('PS_LANG_DEFAULT')]))
+ $this->_html .= $this->displayError($this->l('The \'title\' field is invalid'));
+ elseif (!$this->updateTitle())
+ $this->_html .= $this->displayError($this->l('An error occurred during title updating.'));
+ else
+ $this->_html .= $this->displayConfirmation($this->l('The block title has been updated.'));
+ }
+
+ /* Delete a link*/
+ elseif (isset($_GET['id']))
+ {
+
+ if (!is_numeric($_GET['id']) OR !$this->deleteLink())
+ $this->_html .= $this->displayError($this->l('An error occurred during link deletion.'));
+ else
+ $this->_html .= $this->displayConfirmation($this->l('The link has been deleted.'));
+ }
+
+ if (isset($_POST['submitOrderWay']))
+ {
+ if (Configuration::updateValue('PS_BLOCKLINK_ORDERWAY', (int)(Tools::getValue('orderWay'))))
$this->_html .= $this->displayConfirmation($this->l('Sort order updated'));
else
$this->_html .= $this->displayError($this->l('An error occurred during sort order set-up.'));
}
- $this->_displayForm();
- $this->_list();
+ $this->_displayForm();
+ $this->_list();
- return $this->_html;
- }
+ return $this->_html;
+ }
private function _displayForm()
{
/* Language */
- $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
+ $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages(false);
$divLangName = 'text¤title';
/* Title */
- $title_url = Configuration::get('PS_BLOCKLINK_URL');
+ $title_url = Configuration::get('PS_BLOCKLINK_URL');
- $this->_html .= '
+ $this->_html .= '
-