//Merge branch release
This commit is contained in:
@@ -126,7 +126,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('Reduction percent must be between 0% and 100%');
|
||||
if ((int)Tools::getValue('reduction_amount') < 0)
|
||||
$this->errors[] = Tools::displayError('Reduction amount cannot be lower than 0');
|
||||
if (Tools::getValue('code') && ($same_code = (int)CartRule::getIdByCode(Tools::getValue('code'))))
|
||||
if (Tools::getValue('code') && ($same_code = (int)CartRule::getIdByCode(Tools::getValue('code'))) && $same_code != Tools::getValue('id_cart_rule'))
|
||||
$this->errors[] = sprintf(Tools::displayError('This cart rule code is already used (conflict with cart rule %d)'), $same_code);
|
||||
}
|
||||
|
||||
|
||||
@@ -462,7 +462,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
{
|
||||
$cart_rule = new CartRule();
|
||||
$cart_rule->code = 'BO_ORDER_'.(int)$this->context->cart->id;
|
||||
$cart_rule->name = array(Configuration::get('PS_LANG_DEFAULT') => $this->l('Free Shipping'));
|
||||
$cart_rule->name = array(Configuration::get('PS_LANG_DEFAULT') => $this->l('Free Shipping', 'AdminTab', false, false));
|
||||
$cart_rule->id_customer = (int)$this->context->cart->id_customer;
|
||||
$cart_rule->free_shipping = true;
|
||||
$cart_rule->quantity = 1;
|
||||
|
||||
@@ -31,7 +31,6 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
$this->table = 'currency';
|
||||
$this->className = 'Currency';
|
||||
$this->lang = false;
|
||||
$this->multishop_context = Shop::CONTEXT_ALL;
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
@@ -69,6 +68,9 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->_select .= 'currency_shop.conversion_rate conversion_rate';
|
||||
$this->_join .= Shop::addSqlAssociation('currency', 'a');
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
|
||||
@@ -184,11 +184,13 @@ class AdminCustomersControllerCore extends AdminController
|
||||
parent::initToolbar();
|
||||
if (!$this->can_add_customer)
|
||||
unset($this->toolbar_btn['new']);
|
||||
else
|
||||
else if (!$this->display) //display import button only on listing
|
||||
{
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table,
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function initProcess()
|
||||
|
||||
@@ -115,7 +115,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
'PS_PRODUCT_PICTURE_MAX_SIZE' => array(
|
||||
'title' => $this->l('Maximum size of product pictures'),
|
||||
'desc' => $this->l('The maximum size of pictures uploadable by customers (in Bytes)'),
|
||||
'validation' => 'isUnsignedId',
|
||||
'validation' => 'isUnsignedInt',
|
||||
'required' => true,
|
||||
'cast' => 'intval',
|
||||
'type' => 'text',
|
||||
@@ -125,7 +125,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
'PS_PRODUCT_PICTURE_WIDTH' => array(
|
||||
'title' => $this->l('Product picture width'),
|
||||
'desc' => $this->l('The maximum width of pictures uploadable by customers'),
|
||||
'validation' => 'isUnsignedId',
|
||||
'validation' => 'isUnsignedInt',
|
||||
'required' => true,
|
||||
'cast' => 'intval',
|
||||
'type' => 'text',
|
||||
@@ -135,7 +135,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
'PS_PRODUCT_PICTURE_HEIGHT' => array(
|
||||
'title' => $this->l('Product picture height'),
|
||||
'desc' => $this->l('The maximum height of pictures uploadable by customers'),
|
||||
'validation' => 'isUnsignedId',
|
||||
'validation' => 'isUnsignedInt',
|
||||
'required' => true,
|
||||
'cast' => 'intval',
|
||||
'type' => 'text',
|
||||
@@ -369,14 +369,14 @@ class AdminImagesControllerCore extends AdminController
|
||||
|| !Configuration::updateValue('PS_PNG_QUALITY', Tools::getValue('PS_PNG_QUALITY')))
|
||||
$this->errors[] = Tools::displayError('Unknown error.');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4');
|
||||
return parent::postProcess();
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
|
||||
else
|
||||
parent::postProcess();
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public static function printEntityActiveIcon($value, $object)
|
||||
|
||||
@@ -323,6 +323,10 @@ class AdminLocalizationControllerCore extends AdminController
|
||||
public function updateOptionPsCurrencyDefault($value)
|
||||
{
|
||||
Configuration::updateValue('PS_CURRENCY_DEFAULT', $value);
|
||||
|
||||
/* Set conversion rate of default currency to 1 */
|
||||
ObjectModel::updateMultishopTable('Currency', array('conversion_rate' => 1), 'a.id_currency');
|
||||
|
||||
Currency::refreshCurrencies();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ class AdminModulesControllerCore extends AdminController
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
register_shutdown_function('displayFatalError');
|
||||
|
||||
include_once(_PS_ADMIN_DIR_.'/../tools/tar/Archive_Tar.php');
|
||||
|
||||
// Set the modules categories
|
||||
@@ -316,10 +318,13 @@ class AdminModulesControllerCore extends AdminController
|
||||
//check if it's a real module
|
||||
foreach($zip_folders as $folder)
|
||||
if (!in_array($folder, array('.', '..', '.svn', '.git', '__MACOSX')) && !Module::getInstanceByName($folder))
|
||||
{
|
||||
$this->errors[] = Tools::displayError('The module '.$folder.' you uploaded is not a module');
|
||||
|
||||
$this->recursiveDeleteOnDisk(_PS_MODULE_DIR_.$folder);
|
||||
}
|
||||
|
||||
@unlink($file);
|
||||
@unlink($tmp_folder);
|
||||
$this->recursiveDeleteOnDisk($tmp_folder);
|
||||
if (!count($this->errors) && $success && $redirect)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=8'.'&token='.$this->token);
|
||||
}
|
||||
|
||||
@@ -53,11 +53,6 @@ class AdminOrderPreferencesControllerCore extends AdminController
|
||||
)
|
||||
);
|
||||
|
||||
// Tax list
|
||||
$taxes[] = array('id' => 0, 'name' => $this->l('None'));
|
||||
foreach (Tax::getTaxes($this->context->language->id) as $tax)
|
||||
$taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
|
||||
|
||||
$this->fields_options = array(
|
||||
'general' => array(
|
||||
'title' => $this->l('General'),
|
||||
@@ -140,14 +135,14 @@ class AdminOrderPreferencesControllerCore extends AdminController
|
||||
'cast' => 'floatval',
|
||||
'type' => 'price'
|
||||
),
|
||||
'PS_GIFT_WRAPPING_TAX' => array(
|
||||
'PS_GIFT_WRAPPING_TAX_RULES_GROUP' => array(
|
||||
'title' => $this->l('Gift-wrapping tax'),
|
||||
'desc' => $this->l('Set a tax for gift-wrapping'),
|
||||
'validation' => 'isInt',
|
||||
'cast' => 'intval',
|
||||
'type' => 'select',
|
||||
'list' => $taxes,
|
||||
'identifier' => 'id'
|
||||
'list' => array_merge(array(array('id_tax_rules_group' => 0, 'name' => $this->l('None'))), TaxRulesGroup::getTaxRulesGroups(true)),
|
||||
'identifier' => 'id_tax_rules_group'
|
||||
),
|
||||
'PS_RECYCLABLE_PACK' => array(
|
||||
'title' => $this->l('Offer recycled packaging'),
|
||||
|
||||
@@ -1345,15 +1345,23 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (($id_image = Tools::getValue('id_image')) && ($id_shop = (int)Tools::getValue('id_shop')))
|
||||
if (Tools::getValue('active') == 'true')
|
||||
$res = Db::getInstance()->execute(
|
||||
'INSERT INTO '._DB_PREFIX_.'image_shop (`id_image`, `id_shop`)
|
||||
VALUES('.(int)$id_image.', '.(int)$id_shop.')
|
||||
');
|
||||
$res = Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'image_shop (`id_image`, `id_shop`) VALUES('.(int)$id_image.', '.(int)$id_shop.')');
|
||||
else
|
||||
$res = Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'image_shop
|
||||
WHERE `id_image`='.(int)$id_image.' && `id_shop`='.(int)$id_shop
|
||||
);
|
||||
$res = Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'image_shop WHERE `id_image` = '.(int)$id_image.' AND `id_shop` = '.(int)$id_shop);
|
||||
|
||||
// Clean covers in image table
|
||||
$count_cover_image = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'image i INNER JOIN '._DB_PREFIX_.'image_shop is ON (i.id_image = is.id_image AND is.id_shop = '.(int)$id_shop.') WHERE i.cover = 1');
|
||||
if ($count_cover_image < 1)
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image i, '._DB_PREFIX_.'image_shop is SET i.cover = 1 WHERE i.id_image = is.id_image AND is.id_shop = '.(int)$id_shop.' LIMIT 1');
|
||||
if ($count_cover_image > 1)
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image i, '._DB_PREFIX_.'image_shop is SET i.cover = 0 WHERE cover = 1 AND i.id_image = is.id_image AND is.id_shop = '.(int)$id_shop.' LIMIT '.intval($count_cover_image - 1));
|
||||
|
||||
// Clean covers in image_shop table
|
||||
$count_cover_image_shop = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'image_shop is WHERE is.id_shop = '.(int)$id_shop.' AND is.cover = 1');
|
||||
if ($count_cover_image_shop < 1)
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image_shop is SET is.cover = 1 WHERE is.id_shop = '.(int)$id_shop.' LIMIT 1');
|
||||
if ($count_cover_image_shop > 1)
|
||||
Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'image_shop is SET is.cover = 0 WHERE is.cover = 1 AND is.id_shop = '.(int)$id_shop.' LIMIT '.intval($count_cover_image_shop - 1));
|
||||
|
||||
if ($res)
|
||||
$this->jsonConfirmation($this->_conf[27]);
|
||||
|
||||
@@ -98,7 +98,7 @@ class AdminShippingControllerCore extends AdminController
|
||||
else
|
||||
$array_carrier[] = $carrier['id_carrier'];
|
||||
|
||||
$id_carrier = Tools::getValue('id_carrier');
|
||||
$id_carrier = (int)Tools::getValue('id_carrier');
|
||||
|
||||
if (count($carriers) && isset($array_carrier[0]))
|
||||
{
|
||||
|
||||
@@ -298,7 +298,7 @@ class AdminTaxRulesGroupControllerCore extends AdminController
|
||||
'id' => 'id_tax',
|
||||
'name' => 'name',
|
||||
'default' => array(
|
||||
'value' => 'name',
|
||||
'value' => 0,
|
||||
'label' => $this->l('No Tax')
|
||||
)
|
||||
),
|
||||
|
||||
@@ -249,7 +249,8 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$path = dirname($dest);
|
||||
|
||||
// If folder wasn't already added
|
||||
if (!Tools::file_exists_cache($path))
|
||||
// Do not use Tools::file_exists_cache because it changes over time!
|
||||
if (!file_exists($path))
|
||||
if (!mkdir($path, 0777, true))
|
||||
{
|
||||
$bool &= false;
|
||||
@@ -328,14 +329,27 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
|
||||
public function submitCopyLang()
|
||||
{
|
||||
if (!($from_lang = strval(Tools::getValue('fromLang'))) || !($to_lang = strval(Tools::getValue('toLang'))))
|
||||
if (!($from_lang = Tools::getValue('fromLang')) || !($to_lang = Tools::getValue('toLang')))
|
||||
$this->errors[] = $this->l('You must select 2 languages in order to copy data from one to another');
|
||||
else if (!($from_theme = strval(Tools::getValue('fromTheme'))) || !($to_theme = strval(Tools::getValue('toTheme'))))
|
||||
else if (!($from_theme = Tools::getValue('fromTheme')) || !($to_theme = Tools::getValue('toTheme')))
|
||||
$this->errors[] = $this->l('You must select 2 themes in order to copy data from one to another');
|
||||
else if (!Language::copyLanguageData(Language::getIdByIso($from_lang), Language::getIdByIso($to_lang)))
|
||||
$this->errors[] = $this->l('An error occurred while copying data');
|
||||
else if ($from_lang == $to_lang && $from_theme == $to_theme)
|
||||
$this->errors[] = $this->l('Nothing to copy! (same language and theme)');
|
||||
else
|
||||
{
|
||||
$theme_exists = array('from_theme' => false, 'to_theme' => false);
|
||||
foreach ($this->themes as $theme)
|
||||
{
|
||||
if ($theme->directory == $from_theme)
|
||||
$theme_exists['from_theme'] = true;
|
||||
if ($theme->directory == $to_theme)
|
||||
$theme_exists['to_theme'] = true;
|
||||
}
|
||||
if ($theme_exists['from_theme'] == false || $theme_exists['to_theme'] == false)
|
||||
$this->errors[] = $this->l('Theme(s) not found');
|
||||
}
|
||||
if (count($this->errors))
|
||||
return;
|
||||
|
||||
@@ -553,6 +567,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
*/
|
||||
public static function addNewTabs($iso_code, $files)
|
||||
{
|
||||
$errors = array();
|
||||
foreach ($files as $file)
|
||||
{
|
||||
// Check if file is a file theme
|
||||
@@ -572,12 +587,44 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$id_lang = Language::getIdByIso($iso_code);
|
||||
$tab->name[(int)$id_lang] = $translations;
|
||||
|
||||
// Update this tab
|
||||
$tab->update();
|
||||
if (!Validate::isGenericName($tab->name[(int)$id_lang]))
|
||||
$errors[] = sprintf(Tools::displayError('Tab "%s" is not valid'), $tab->name[(int)$id_lang]);
|
||||
else
|
||||
$tab->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
public static function checkTranslationFile($content)
|
||||
{
|
||||
$lines = array_map('trim', explode("\n", $content));
|
||||
$global = false;
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
if (in_array($line, array('<?php', '?>', '')))
|
||||
continue;
|
||||
if (!$global && preg_match('/^global\s+\$([a-z0-9-_]+)\s*;$/i', $line, $matches))
|
||||
{
|
||||
$global = $matches[1];
|
||||
continue;
|
||||
}
|
||||
if ($global != false && preg_match('/^\$'.preg_quote($global, '/').'\s*=\s*array\(\s*\)\s*;$/i', $line))
|
||||
continue;
|
||||
if (!$global && preg_match('/^\$([a-z0-9-_]+)\s*=\s*array\(\s*\)\s*;$/i', $line, $matches))
|
||||
{
|
||||
$global = $matches[1];
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/^\$'.preg_quote($global, '/').'\[\''._PS_TRANS_PATTERN_.'\'\]\s*=\s*\''._PS_TRANS_PATTERN_.'\'\s*;$/i', $line))
|
||||
continue;
|
||||
if (preg_match('/^return\s+\$'.preg_quote($global, '/').'\s*;$/i', $line, $matches))
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function submitImportLang()
|
||||
@@ -593,11 +640,45 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
{
|
||||
$themes_selected = Tools::getValue('theme', array(self::DEFAULT_THEME_NAME));
|
||||
$files_list = $gz->listContent();
|
||||
|
||||
$uniqid = uniqid();
|
||||
$sandbox = _PS_CACHE_DIR_.'sandbox'.DIRECTORY_SEPARATOR.$uniqid.DIRECTORY_SEPARATOR;
|
||||
if ($gz->extract($sandbox, false))
|
||||
{
|
||||
foreach ($files_list as $file2check)
|
||||
{
|
||||
//don't validate index.php, will be overwrite when extract in translation directory
|
||||
if (pathinfo($file2check['filename'], PATHINFO_BASENAME) == 'index.php')
|
||||
continue;
|
||||
|
||||
if (preg_match('@^[0-9a-z-_/\\\\]+\.php$@i', $file2check['filename']))
|
||||
{
|
||||
if (!AdminTranslationsController::checkTranslationFile(file_get_contents($sandbox.$file2check['filename'])))
|
||||
$this->errors[] = sprintf(Tools::displayError('Validation failed for: %s'), $file2check['filename']);
|
||||
}
|
||||
elseif (!preg_match('@^[0-9a-z-_/\\\\]+\.(html|tpl|txt)$@i', $file2check['filename']))
|
||||
$this->errors[] = sprintf(Tools::displayError('Unidentified file found: %s'), $file2check['filename']);
|
||||
}
|
||||
Tools::deleteDirectory($sandbox, true);
|
||||
}
|
||||
|
||||
if (count($this->errors))
|
||||
return false;
|
||||
|
||||
if ($gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
|
||||
{
|
||||
foreach ($files_list as $file2check)
|
||||
if (pathinfo($file2check['filename'], PATHINFO_BASENAME) == 'index.php' && file_put_contents(_PS_TRANSLATIONS_DIR_.'../'.$file2check['filename'], Tools::getDefaultIndexContent()))
|
||||
continue;
|
||||
|
||||
AdminTranslationsController::checkAndAddMailsFiles($iso_code, $files_list);
|
||||
$this->checkAndAddThemesFiles($files_list, $themes_selected);
|
||||
AdminTranslationsController::addNewTabs($iso_code, $files_list);
|
||||
$tab_errors = AdminTranslationsController::addNewTabs($iso_code, $files_list);
|
||||
if (count($tab_errors))
|
||||
{
|
||||
$this->errors += $tab_errors;
|
||||
return false;
|
||||
}
|
||||
if (Validate::isLanguageFileName($filename))
|
||||
{
|
||||
if (!Language::checkAndAddLanguage($iso_code))
|
||||
@@ -629,9 +710,14 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if ($gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
|
||||
{
|
||||
AdminTranslationsController::checkAndAddMailsFiles($arr_import_lang[0], $files_list);
|
||||
AdminTranslationsController::addNewTabs($arr_import_lang[0], $files_list);
|
||||
if (!Language::checkAndAddLanguage($arr_import_lang[0]))
|
||||
$conf = 20;
|
||||
$tab_errors = AdminTranslationsController::addNewTabs($arr_import_lang[0], $files_list);
|
||||
if (count($tab_errors))
|
||||
$this->errors += $tab_errors;
|
||||
else
|
||||
{
|
||||
if (!Language::checkAndAddLanguage($arr_import_lang[0]))
|
||||
$conf = 20;
|
||||
}
|
||||
if (!unlink($file))
|
||||
$this->errors[] = Tools::displayError('Cannot delete archive');
|
||||
|
||||
@@ -1080,7 +1166,16 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
|
||||
// Get folder name of theme
|
||||
if (($theme = Tools::getValue('theme')) && !is_array($theme))
|
||||
$this->theme_selected = Tools::safeOutput($theme);
|
||||
{
|
||||
$theme_exists = false;
|
||||
foreach ($this->themes as $existing_theme)
|
||||
if ($existing_theme->directory == $theme)
|
||||
$theme_exists = true;
|
||||
if ($theme_exists)
|
||||
$this->theme_selected = Tools::safeOutput($theme);
|
||||
else
|
||||
throw new PrestaShopException(sprintf(Tools::displayError('Invalid theme "%s"'), $theme));
|
||||
}
|
||||
else
|
||||
$this->theme_selected = self::DEFAULT_THEME_NAME;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class BestSalesControllerCore extends FrontController
|
||||
'products' => ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay),
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'nbProducts' => $nbProducts,
|
||||
'homeSize' => Image::getSize('home_default'),
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
|
||||
'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')
|
||||
));
|
||||
|
||||
|
||||
@@ -120,10 +120,10 @@ class CategoryControllerCore extends FrontController
|
||||
'return_category_name' => Tools::safeOutput($this->category->name),
|
||||
'path' => Tools::getPath($this->category->id),
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'categorySize' => Image::getSize('category_default'),
|
||||
'mediumSize' => Image::getSize('medium_default'),
|
||||
'thumbSceneSize' => Image::getSize('m_scene_default'),
|
||||
'homeSize' => Image::getSize('home_default'),
|
||||
'categorySize' => Image::getSize(ImageType::getFormatedName('category')),
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
'thumbSceneSize' => Image::getSize(ImageType::getFormatedName('m_scene')),
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
|
||||
'allow_oosp' => (int)Configuration::get('PS_ORDER_OUT_OF_STOCK'),
|
||||
'comparator_max_item' => (int)Configuration::get('PS_COMPARATOR_MAX_ITEM'),
|
||||
'suppliers' => Supplier::getSuppliers()
|
||||
@@ -144,9 +144,9 @@ class CategoryControllerCore extends FrontController
|
||||
{
|
||||
foreach ($sceneImageTypes as $sceneImageType)
|
||||
{
|
||||
if ($sceneImageType['name'] == 'm_scene_default')
|
||||
if ($sceneImageType['name'] == ImageType::getFormatedName('m_scene'))
|
||||
$thumbSceneImageType = $sceneImageType;
|
||||
elseif ($sceneImageType['name'] == 'scene_default')
|
||||
elseif ($sceneImageType['name'] == ImageType::getFormatedName('scene'))
|
||||
$largeSceneImageType = $sceneImageType;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ class CompareControllerCore extends FrontController
|
||||
'product_features' => $listFeatures,
|
||||
'products' => $listProducts,
|
||||
'width' => $width,
|
||||
'homeSize' => Image::getSize('home_default')
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
|
||||
));
|
||||
$this->context->smarty->assign('HOOK_EXTRA_PRODUCT_COMPARISON', Hook::exec('displayProductComparison', array('list_ids_product' => $ids)));
|
||||
}
|
||||
|
||||
@@ -116,12 +116,12 @@ class ManufacturerControllerCore extends FrontController
|
||||
$this->pagination($nbProducts);
|
||||
|
||||
foreach ($data as &$item)
|
||||
$item['image'] = (!file_exists(_PS_MANU_IMG_DIR_.'/'.$item['id_manufacturer'].'-medium_default.jpg')) ? $this->context->language->iso_code.'-default' : $item['id_manufacturer'];
|
||||
$item['image'] = (!file_exists(_PS_MANU_IMG_DIR_.'/'.$item['id_manufacturer'].'-'.ImageType::getFormatedName('medium').'.jpg')) ? $this->context->language->iso_code.'-default' : $item['id_manufacturer'];
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'pages_nb' => ceil($nbProducts / (int)($this->n)),
|
||||
'nbManufacturers' => $nbProducts,
|
||||
'mediumSize' => Image::getSize('medium_default'),
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
'manufacturers' => $data,
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
));
|
||||
|
||||
@@ -60,7 +60,7 @@ class NewProductsControllerCore extends FrontController
|
||||
'products' => Product::getNewProducts($this->context->language->id, (int)($this->p) - 1, (int)($this->n), false, $this->orderBy, $this->orderWay),
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'nbProducts' => (int)($nbProducts),
|
||||
'homeSize' => Image::getSize('home_default'),
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
|
||||
'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')
|
||||
));
|
||||
|
||||
|
||||
@@ -141,9 +141,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$this->_processAddressFormat();
|
||||
$this->_assignAddress();
|
||||
// Wrapping fees
|
||||
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
|
||||
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
|
||||
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
|
||||
$wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
|
||||
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
|
||||
$return = array_merge(array(
|
||||
'order_opc_adress' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-address.tpl'),
|
||||
'block_user_info' => (isset($blockUserInfo) ? $blockUserInfo->hookTop(array()) : ''),
|
||||
@@ -203,9 +202,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
{
|
||||
$result = $this->_getCarrierList();
|
||||
// Wrapping fees
|
||||
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
|
||||
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
|
||||
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
|
||||
$wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
|
||||
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
|
||||
$result = array_merge($result, array(
|
||||
'HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'),
|
||||
'HOOK_PAYMENT' => $this->_getPaymentMethods(),
|
||||
@@ -493,9 +491,10 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
|
||||
$carriers = $this->context->cart->simulateCarriersOutput();
|
||||
$delivery_option = $this->context->cart->getDeliveryOption(null, false, false);
|
||||
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
|
||||
$wrapping_fees_tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
|
||||
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
|
||||
|
||||
$wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
|
||||
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
|
||||
|
||||
$vars = array(
|
||||
'free_shipping' => $free_shipping,
|
||||
'checkedTOS' => (int)($this->context->cookie->checkedTOS),
|
||||
@@ -505,7 +504,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
'conditions' => (int)(Configuration::get('PS_CONDITIONS')),
|
||||
'link_conditions' => $link_conditions,
|
||||
'recyclable' => (int)($this->context->cart->recyclable),
|
||||
'gift_wrapping_price' => (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE')),
|
||||
'gift_wrapping_price' => (float)$wrapping_fees,
|
||||
'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, $this->context->currency),
|
||||
'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, $this->context->currency),
|
||||
'delivery_option_list' => $this->context->cart->getDeliveryOptionList(),
|
||||
|
||||
@@ -328,9 +328,19 @@ class ParentOrderControllerCore extends FrontController
|
||||
$available_cart_rules = CartRule::getCustomerCartRules($this->context->language->id, (isset($this->context->customer->id) ? $this->context->customer->id : 0), true, true, true, $this->context->cart);
|
||||
$cart_cart_rules = $this->context->cart->getCartRules();
|
||||
foreach ($available_cart_rules as $key => $available_cart_rule)
|
||||
{
|
||||
if (strpos($available_cart_rule['code'], 'BO_ORDER_') === 0)
|
||||
{
|
||||
unset($available_cart_rules[$key]);
|
||||
continue;
|
||||
}
|
||||
foreach ($cart_cart_rules as $cart_cart_rule)
|
||||
if ($available_cart_rule['id_cart_rule'] == $cart_cart_rule['id_cart_rule'])
|
||||
{
|
||||
unset($available_cart_rules[$key]);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
$show_option_allow_separate_package = (!$this->context->cart->isAllProductsInStock(true) && Configuration::get('PS_SHIP_WHEN_AVAILABLE'));
|
||||
|
||||
@@ -470,9 +480,8 @@ class ParentOrderControllerCore extends FrontController
|
||||
protected function _assignWrappingAndTOS()
|
||||
{
|
||||
// Wrapping fees
|
||||
$wrapping_fees = (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
|
||||
$wrapping_fees_tax = new Tax(Configuration::get('PS_GIFT_WRAPPING_TAX'));
|
||||
$wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100)));
|
||||
$wrapping_fees = $this->context->cart->getGiftWrappingPrice(false);
|
||||
$wrapping_fees_tax_inc = $wrapping_fees = $this->context->cart->getGiftWrappingPrice();
|
||||
|
||||
// TOS
|
||||
$cms = new CMS(Configuration::get('PS_CONDITIONS_CMS_ID'), $this->context->language->id);
|
||||
@@ -495,7 +504,7 @@ class ParentOrderControllerCore extends FrontController
|
||||
'checked' => $this->context->cart->simulateCarrierSelectedOutput(),
|
||||
'address_collection' => $this->context->cart->getAddressCollection(),
|
||||
'delivery_option' => $this->context->cart->getDeliveryOption(null, false),
|
||||
'gift_wrapping_price' => (float)(Configuration::get('PS_GIFT_WRAPPING_PRICE')),
|
||||
'gift_wrapping_price' => (float)$wrapping_fees,
|
||||
'total_wrapping_cost' => Tools::convertPrice($wrapping_fees_tax_inc, $this->context->currency),
|
||||
'total_wrapping_tax_exc_cost' => Tools::convertPrice($wrapping_fees, $this->context->currency)));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class PricesDropControllerCore extends FrontController
|
||||
'products' => Product::getPricesDrop($this->context->language->id, (int)$this->p - 1, (int)$this->n, false, $this->orderBy, $this->orderWay),
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
'nbProducts' => $nbProducts,
|
||||
'homeSize' => Image::getSize('home_default'),
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
|
||||
'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')
|
||||
));
|
||||
|
||||
|
||||
@@ -345,15 +345,19 @@ class ProductControllerCore extends FrontController
|
||||
$product_images[(int)$image['id_image']] = $image;
|
||||
}
|
||||
if (!isset($cover))
|
||||
$cover = array('id_image' => $this->context->language->iso_code.'-default', 'legend' => 'No picture', 'title' => 'No picture');
|
||||
$size = Image::getSize('large_default');
|
||||
$cover = array(
|
||||
'id_image' => $this->context->language->iso_code.'-default',
|
||||
'legend' => 'No picture',
|
||||
'title' => 'No picture'
|
||||
);
|
||||
$size = Image::getSize(ImageType::getFormatedName('large'));
|
||||
$this->context->smarty->assign(array(
|
||||
'have_image' => Product::getCover((int)Tools::getValue('id_product')),
|
||||
'cover' => $cover,
|
||||
'imgWidth' => (int)$size['width'],
|
||||
'mediumSize' => Image::getSize('medium_default'),
|
||||
'largeSize' => Image::getSize('large_default'),
|
||||
'homeSize' => Image::getSize('home_default'),
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
'largeSize' => Image::getSize(ImageType::getFormatedName('large')),
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
|
||||
'col_img_dir' => _PS_COL_IMG_DIR_));
|
||||
if (count($product_images))
|
||||
$this->context->smarty->assign('images', $product_images);
|
||||
|
||||
@@ -81,7 +81,7 @@ class SearchControllerCore extends FrontController
|
||||
'nbProducts' => $search['total'],
|
||||
'search_query' => $query,
|
||||
'instant_search' => $this->instant_search,
|
||||
'homeSize' => Image::getSize('home_default')));
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
|
||||
}
|
||||
else if (($query = Tools::getValue('search_query', Tools::getValue('ref'))) && !is_array($query))
|
||||
{
|
||||
@@ -97,7 +97,7 @@ class SearchControllerCore extends FrontController
|
||||
'search_products' => $search['result'],
|
||||
'nbProducts' => $search['total'],
|
||||
'search_query' => $query,
|
||||
'homeSize' => Image::getSize('home_default')));
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
|
||||
}
|
||||
else if (($tag = urldecode(Tools::getValue('tag'))) && !is_array($tag))
|
||||
{
|
||||
@@ -110,7 +110,7 @@ class SearchControllerCore extends FrontController
|
||||
'products' => $result, // DEPRECATED (since to 1.4), not use this: conflict with block_cart module
|
||||
'search_products' => $result,
|
||||
'nbProducts' => $nbProducts,
|
||||
'homeSize' => Image::getSize('home_default')));
|
||||
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -262,7 +262,7 @@ class StoresControllerCore extends FrontController
|
||||
$this->assignStores();
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'mediumSize' => Image::getSize('medium_default'),
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
'defaultLat' => (float)Configuration::get('PS_STORES_CENTER_LAT'),
|
||||
'defaultLong' => (float)Configuration::get('PS_STORES_CENTER_LONG'),
|
||||
'searchUrl' => $this->context->link->getPageLink('stores'),
|
||||
|
||||
@@ -119,12 +119,12 @@ class SupplierControllerCore extends FrontController
|
||||
|
||||
$suppliers = Supplier::getSuppliers(true, $this->context->language->id, true, $this->p, $this->n);
|
||||
foreach ($suppliers as &$row)
|
||||
$row['image'] = (!file_exists(_PS_SUPP_IMG_DIR_.'/'.$row['id_supplier'].'-medium_default.jpg')) ? $this->context->language->iso_code.'-default' : $row['id_supplier'];
|
||||
$row['image'] = (!file_exists(_PS_SUPP_IMG_DIR_.'/'.$row['id_supplier'].'-'.ImageType::getFormatedName('medium').'.jpg')) ? $this->context->language->iso_code.'-default' : $row['id_supplier'];
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'pages_nb' => ceil($nbProducts / (int)$this->n),
|
||||
'nbSuppliers' => $nbProducts,
|
||||
'mediumSize' => Image::getSize('medium_default'),
|
||||
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
|
||||
'suppliers_list' => $suppliers,
|
||||
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user