diff --git a/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl index eceafdb0c..e2503c9a6 100755 --- a/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl @@ -58,6 +58,7 @@

{l s='Members of this customer group'}

+

{l s='Limited to the 100th first customers.'} {l s='Please use filters to narrow your search.'}

{$customerList} {/block} \ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl index 059ccfdd2..c867b6c6d 100644 --- a/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl @@ -1,8 +1,8 @@ {* * 2007-2013 PrestaShop -* +** * NOTICE OF LICENSE -* +** * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: @@ -10,72 +10,25 @@ * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. -* +** * DISCLAIMER -* +** * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. -* +** * @author PrestaShop SA * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} - {include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
{block name="leadin"}{/block}
- {if $module_confirmation}
{l s='Your .CSV file has been sucessfully imported into your shop.'}
{/if} - - - -{** - * Upload fancybox - *}
 
@@ -97,28 +50,16 @@
-
 
- -{** - * Import fieldset - *} -
- +
{l s='Import '} -
{if count($files_to_import)} {/if} @@ -146,13 +87,12 @@
-
- +
- +
{l s='If you don\'t use this option, all ID\'s will be auto-incremented.'}
+ +
+ +
{if empty($files_to_import)}{l s='You must upload a file in order to proceed to the next step'}{/if} @@ -210,13 +154,10 @@ {/if}
-
- {l s='Available fields'} -
{$available_fields}
@@ -224,74 +165,88 @@


{l s='* Required field'}
-
-
 
- + \ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl index 618d1a819..a7c20b5d8 100644 --- a/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl @@ -22,20 +22,52 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} - {extends file="helpers/view/view.tpl"} - {block name="override_tpl"}

{l s='View your data'}

- {l s='Save and load your configuration for importing files'} :

- - {l s='Save'}

+ {l s='Save and load your configuration for importing files'} :

+ + {l s='Save'}

{l s='lines'} + {if $fields_value.truncate} @@ -72,49 +101,8 @@ {if $fields_value.match_ref} {/if} - - - - + +
@@ -123,7 +111,7 @@
- + {section name=nb_i start=0 loop=$nb_table step=1} @@ -132,12 +120,10 @@ {/section} - +
-
-{/block} - +{/block} \ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl index ef8cc81c5..af01d0657 100755 --- a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -153,7 +153,7 @@
{l s='Customer information'} - {$customer->firstname} {$customer->lastname} ({l s='#'}{$customer->id})
+ {$gender->name|escape:'htmlall':'UTF-8'} {$customer->firstname} {$customer->lastname} ({l s='#'}{$customer->id})
({$customer->email})

{if ($customer->isGuest())} {l s='This order has been placed by a guest.'} diff --git a/admin-dev/themes/default/template/helpers/form/form.tpl b/admin-dev/themes/default/template/helpers/form/form.tpl index ee9ee638a..ed77b5c40 100644 --- a/admin-dev/themes/default/template/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/helpers/form/form.tpl @@ -30,7 +30,7 @@ {if isset($fields.title)}

{$fields.title}

{/if} {block name="defaultForm"} -
+ {if $form_id} {/if} diff --git a/admin-dev/themes/default/template/helpers/options/options.tpl b/admin-dev/themes/default/template/helpers/options/options.tpl index ea9bb26c2..3c1309690 100644 --- a/admin-dev/themes/default/template/helpers/options/options.tpl +++ b/admin-dev/themes/default/template/helpers/options/options.tpl @@ -34,7 +34,7 @@ {block name="defaultOptions"}
- X + X
diff --git a/classes/Link.php b/classes/Link.php index 03cf66c36..cb207e6db 100644 --- a/classes/Link.php +++ b/classes/Link.php @@ -91,12 +91,8 @@ class LinkCore if (!$id_lang) $id_lang = Context::getContext()->language->id; - if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null) - $shop = new Shop($id_shop); - else - $shop = Context::getContext()->shop; - - $url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop); + + $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); if (!is_object($product)) { @@ -163,11 +159,7 @@ class LinkCore if (!$id_lang) $id_lang = Context::getContext()->language->id; - if ($id_shop === null) - $shop = Context::getContext()->shop; - else - $shop = new Shop($id_shop); - $url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop); + $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); if (!is_object($category)) $category = new Category($category, $id_lang); @@ -206,11 +198,7 @@ class LinkCore if (!$id_lang) $id_lang = Context::getContext()->language->id; - if ($id_shop === null) - $shop = Context::getContext()->shop; - else - $shop = new Shop($id_shop); - $url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop); + $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); $dispatcher = Dispatcher::getInstance(); if (!is_object($cms_category)) @@ -239,19 +227,12 @@ class LinkCore * @param int $id_lang * @return string */ - public function getCMSLink($cms, $alias = null, $ssl = false, $id_lang = null, $id_shop = null) + public function getCMSLink($cms, $alias = null, $ssl = null, $id_lang = null, $id_shop = null) { if (!$id_lang) $id_lang = Context::getContext()->language->id; - - if ($id_shop === null) - $shop = Context::getContext()->shop; - else - $shop = new Shop($id_shop); - - $base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain); - $url = $base.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop); + $url = $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop); $dispatcher = Dispatcher::getInstance(); if (!is_object($cms)) @@ -290,11 +271,8 @@ class LinkCore if (!$id_lang) $id_lang = Context::getContext()->language->id; - if ($id_shop === null) - $shop = Context::getContext()->shop; - else - $shop = new Shop($id_shop); - $url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop); + + $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); $dispatcher = Dispatcher::getInstance(); if (!is_object($supplier)) @@ -327,11 +305,7 @@ class LinkCore if (!$id_lang) $id_lang = Context::getContext()->language->id; - if ($id_shop === null) - $shop = Context::getContext()->shop; - else - $shop = new Shop($id_shop); - $url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop); + $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); $dispatcher = Dispatcher::getInstance(); if (!is_object($manufacturer)) @@ -360,18 +334,12 @@ class LinkCore * @param int $id_lang * @return string */ - public function getModuleLink($module, $controller = 'default', array $params = array(), $ssl = false, $id_lang = null, $id_shop = null) + public function getModuleLink($module, $controller = 'default', array $params = array(), $ssl = null, $id_lang = null, $id_shop = null) { if (!$id_lang) $id_lang = Context::getContext()->language->id; - if ($id_shop === null) - $shop = Context::getContext()->shop; - else - $shop = new Shop($id_shop); - - $base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain); - $url = $base.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop); + $url = $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop); // If the module has its own route ... just use it ! if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang, $id_shop)) @@ -453,10 +421,9 @@ class LinkCore * * @return string Page link */ - public function getPageLink($controller, $ssl = false, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null) + public function getPageLink($controller, $ssl = null, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null) { $controller = Tools::strReplaceFirst('.php', '', $controller); - if (!$id_lang) $id_lang = (int)Context::getContext()->language->id; @@ -469,17 +436,9 @@ class LinkCore parse_str($request, $request); } - if ($id_shop === null) - $shop = Context::getContext()->shop; - else - $shop = new Shop($id_shop); - $uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request, false, '', $id_shop); - $url = ($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain; - $url .= $shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/'); - - return $url; + return $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/'); } public function getCatImageLink($name, $id_category, $type = null) @@ -643,5 +602,26 @@ class LinkCore return Language::getIsoById($id_lang).'/'; } + + protected function getBaseLink($id_shop = null, $ssl = null) + { + static $force_ssl = null; + + if ($ssl === null) + { + if ($force_ssl === null) + $force_ssl = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')); + $ssl = $force_ssl; + } + + if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null) + $shop = new Shop($id_shop); + else + $shop = Context::getContext()->shop; + + $base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain); + + return $base.$shop->getBaseURI(); + } } diff --git a/classes/Media.php b/classes/Media.php index 86b51e5ff..7ce172f56 100755 --- a/classes/Media.php +++ b/classes/Media.php @@ -39,7 +39,7 @@ class MediaCore 'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true), 'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), - 'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true), + 'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position','ui.button'), 'theme' => true), 'ui.slider' => array('fileName' => 'jquery.ui.slider.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true), 'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true), diff --git a/classes/Product.php b/classes/Product.php index 188ce4a05..19e5917af 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -3055,18 +3055,18 @@ class ProductCore extends ObjectModel if (!Combination::isFeatureActive()) return array(); $sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, - a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`, - IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, pa.`weight`, + a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, product_attribute_shop.`id_product_attribute`, + IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, product_attribute_shop.`weight`, product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`, - pa.`minimal_quantity`, pa.`available_date`, ag.`group_type` + product_attribute_shop.`minimal_quantity`, product_attribute_shop.`available_date`, ag.`group_type` FROM `'._DB_PREFIX_.'product_attribute` pa '.Shop::addSqlAssociation('product_attribute', 'pa').' '.Product::sqlStock('pa', 'pa').' - LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` - LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute` - LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group` - LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute` - LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group` + LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`) + LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute` = pac.`id_attribute`) + LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`) + LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute`) + LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`) '.Shop::addSqlAssociation('attribute', 'a').' WHERE pa.`id_product` = '.(int)$this->id.' AND al.`id_lang` = '.(int)$id_lang.' diff --git a/classes/Tools.php b/classes/Tools.php index 31adb3bbf..38aee11b6 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1260,6 +1260,13 @@ class ToolsCore return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1); } + public static function ucwords($str) + { + if (function_exists('mb_convert_case')) + return mb_convert_case($str, MB_CASE_TITLE); + return ucwords(strtolower($str)); + } + public static function orderbyPrice(&$array, $order_way) { foreach ($array as &$row) @@ -1401,26 +1408,9 @@ class ToolsCore public static function copy($source, $destination, $stream_context = null) { - if ($stream_context == null && preg_match('/^https?:\/\//', $source)) - $stream_context = @stream_context_create(array('http' => array('timeout' => 10))); - - if (in_array(@ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $source)) - return @copy($source, $destination, $stream_context); - elseif (function_exists('curl_init')) - { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl, CURLOPT_URL, $source); - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); - curl_setopt($curl, CURLOPT_TIMEOUT, 10); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); - $opts = stream_context_get_options($stream_context); - $content = curl_exec($curl); - curl_close($curl); - return file_put_contents($destination, $content); - } - else - return false; + if (is_null($stream_context) && !preg_match('/^https?:\/\//', $source)) + return @copy($source, $destination); + return @file_put_contents($destination, Tools::file_get_contents($source, false, $stream_context)); } /** diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 94bc96d7d..84feddee9 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -45,7 +45,7 @@ class AdminControllerCore extends Controller public $template = 'content.tpl'; /** @var string Associated table name */ - public $table; + public $table = 'configuration'; public $list_id; diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 9725e99f1..cdbbbc696 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -65,6 +65,9 @@ class FrontControllerCore extends Controller parent::__construct(); + if (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) + $this->ssl = true; + if (isset($useSSL)) $this->ssl = $useSSL; else @@ -144,8 +147,6 @@ class FrontControllerCore extends Controller // Init cookie language // @TODO This method must be moved into switchLanguage Tools::setCookieLanguage($this->context->cookie); - - $currency = Tools::setCurrency($this->context->cookie); $protocol_link = (Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode()) ? 'https://' : 'http://'; $useSSL = ((isset($this->ssl) && $this->ssl && Configuration::get('PS_SSL_ENABLED')) || Tools::usingSecureMode()) ? true : false; @@ -167,6 +168,8 @@ class FrontControllerCore extends Controller if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault)) $this->context->country = $newDefault; + $currency = Tools::setCurrency($this->context->cookie); + if (isset($_GET['logout']) || ($this->context->customer->logged && Customer::isBanned($this->context->customer->id))) { $this->context->customer->logout(); @@ -597,7 +600,7 @@ class FrontControllerCore extends Controller if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit')) return; - $match_url = (($this->ssl && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; + $match_url = (($this->ssl) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $match_url = rawurldecode($match_url); if (!preg_match('/^'.Tools::pRegexp(rawurldecode($canonical_url), '/').'([&?].*)?$/', $match_url)) { @@ -667,6 +670,7 @@ class FrontControllerCore extends Controller } } } + if (isset($this->context->cookie->iso_code_country) && $this->context->cookie->iso_code_country && !Validate::isLanguageIsoCode($this->context->cookie->iso_code_country)) $this->context->cookie->iso_code_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')); if (isset($this->context->cookie->iso_code_country) && ($id_country = Country::getByIso(strtoupper($this->context->cookie->iso_code_country)))) diff --git a/classes/helper/HelperForm.php b/classes/helper/HelperForm.php index ff9810baf..3aa90447f 100644 --- a/classes/helper/HelperForm.php +++ b/classes/helper/HelperForm.php @@ -35,10 +35,10 @@ class HelperFormCore extends Helper /** @var array of forms fields */ protected $fields_form = array(); - /** @var array values ​​of form fields */ + /** @var array values of form fields */ public $fields_value = array(); - public $table; + public $table = 'configuration'; public $name_controller = ''; /** @var string if not null, a title will be added on that list */ diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index 69a6127c2..eeb161535 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -136,6 +136,9 @@ class HelperListCore extends Helper $this->_list = $list; $this->fields_list = $fields_display; + $this->orderBy = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderBy); + $this->orderWay = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderWay); + // Display list header (filtering, pagination and column names) $tpl_vars['header'] = $this->displayListHeader(); @@ -456,7 +459,7 @@ class HelperListCore extends Helper ); if ($this->specificConfirmDelete !== false) - $data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : addcslashes(Tools::htmlentitiesDecodeUTF8(self::$cache_lang['DeleteItem'].$name), '\''); + $data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(addcslashes(self::$cache_lang['DeleteItem'].$name, '\'')); $tpl->assign(array_merge($this->tpl_delete_link_vars, $data)); @@ -522,9 +525,6 @@ class HelperListCore extends Helper isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null ); - // Cleaning links - if (Tools::getValue($this->table.'Orderby') && Tools::getValue($this->table.'Orderway')) - $this->currentIndex = preg_replace('/&'.$this->table.'Orderby=([a-z _]*)&'.$this->table.'Orderway=([a-z]*)/i', '', $this->currentIndex); if ($this->position_identifier && (int)Tools::getValue($this->position_identifier, 1)) $table_id = substr($this->identifier, 3, strlen($this->identifier)); diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index cc411b8eb..7d0e0c6be 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -77,7 +77,7 @@ class AdminAddressesControllerCore extends AdminController parent::initToolbar(); if (!$this->display) $this->toolbar_btn['import'] = array( - 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table, + 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=addresses', 'desc' => $this->l('Import') ); } diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php index 69db3dc17..e605472ff 100644 --- a/controllers/admin/AdminCategoriesController.php +++ b/controllers/admin/AdminCategoriesController.php @@ -246,7 +246,7 @@ class AdminCategoriesControllerCore extends AdminController 'desc' => $this->l('Add New') ); $this->toolbar_btn['import'] = array( - 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table, + 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=categories', 'desc' => $this->l('Import') ); } diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index d4edc5926..98194a0f5 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -190,7 +190,7 @@ class AdminCustomersControllerCore extends AdminController 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, + 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=customers', 'desc' => $this->l('Import') ); } diff --git a/controllers/admin/AdminGroupsController.php b/controllers/admin/AdminGroupsController.php index 3c8f26a79..007bd38b0 100644 --- a/controllers/admin/AdminGroupsController.php +++ b/controllers/admin/AdminGroupsController.php @@ -193,7 +193,7 @@ class AdminGroupsControllerCore extends AdminController 'active' => array('title' => $this->l('Enabled'),'align' => 'center','width' => 20, 'active' => 'status','type' => 'bool') )); - $customer_list = $group->getCustomers(false, 0, 0, true); + $customer_list = $group->getCustomers(false, 0, 100, true); $helper = new HelperList(); $helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false); diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index b0bef57b6..0a69a5bb4 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -465,11 +465,25 @@ class AdminImportControllerCore extends AdminController $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen'); $this->addJqueryPlugin(array('fancybox')); + $entity_selected = 0; + if (isset($this->entities[$this->l(Tools::ucfirst(Tools::getValue('import_type')))])) + { + $entity_selected = $this->entities[$this->l(Tools::ucfirst(Tools::getValue('import_type')))]; + $this->context->cookie->entity_selected = $entity_selected; + } + elseif (isset($this->context->cookie->entity_selected)) + $entity_selected = (int)$this->context->cookie->entity_selected; + + $csv_selected = ''; + if (isset($this->context->cookie->csv_selected)) + $csv_selected = pSQL($this->context->cookie->csv_selected); + $this->tpl_form_vars = array( 'module_confirmation' => (Tools::getValue('import')) && (isset($this->warnings) && !count($this->warnings)), 'path_import' => _PS_ADMIN_DIR_.'/import/', 'entities' => $this->entities, - 'entity' => Tools::getValue('entity'), + 'entity_selected' => $entity_selected, + 'csv_selected' => $csv_selected, 'files_to_import' => $files_to_import, 'languages' => Language::getLanguages(false), 'id_language' => $this->context->language->id, @@ -497,6 +511,11 @@ class AdminImportControllerCore extends AdminController for ($i = 0; $i < $nb_table; $i++) $data[$i] = $this->generateContentTable($i, $nb_column, $handle, $this->separator); + if ($entity_selected = (int)Tools::getValue('entity')) + $this->context->cookie->entity_selected = $entity_selected; + if ($csv_selected = Tools::getValue('csv')) + $this->context->cookie->csv_selected = $csv_selected; + $this->tpl_view_vars = array( 'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'), 'fields_value' => array( @@ -506,6 +525,7 @@ class AdminImportControllerCore extends AdminController 'iso_lang' => Tools::getValue('iso_lang'), 'truncate' => Tools::getValue('truncate'), 'forceIDs' => Tools::getValue('forceIDs'), + 'regenerate' => Tools::getValue('regenerate'), 'match_ref' => Tools::getValue('match_ref'), 'separator' => $this->separator, 'multiple_value_separator' => $this->multiple_value_separator @@ -795,7 +815,7 @@ class AdminImportControllerCore extends AdminController * @param string entity 'products' or 'categories' * @return void */ - protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products') + protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products', $regenerate = true) { $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import'); $watermark_types = explode(',', Configuration::get('WATERMARK_TYPES')); @@ -823,11 +843,14 @@ class AdminImportControllerCore extends AdminController { ImageManager::resize($tmpfile, $path.'.jpg'); $images_types = ImageType::getImagesTypes($entity); - foreach ($images_types as $image_type) - ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']); - if (in_array($image_type['id_image_type'], $watermark_types)) - Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity)); + if ($regenerate) + foreach ($images_types as $image_type) + { + ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']); + if (in_array($image_type['id_image_type'], $watermark_types)) + Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity)); + } } else { @@ -976,7 +999,7 @@ class AdminImportControllerCore extends AdminController } //copying images of categories if (isset($category->image) && !empty($category->image)) - if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories'))) + if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories', !Tools::getValue('regenerate')))) $this->warnings[] = $category->image.' '.Tools::displayError('cannot be copied.'); // If both failed, mysql error if (!$res) @@ -1438,7 +1461,7 @@ class AdminImportControllerCore extends AdminController { // associate image to selected shops $image->associateTo($shops); - if (!AdminImportController::copyImg($product->id, $image->id, $url)) + if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate'))) { $image->delete(); $this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url); @@ -1564,7 +1587,7 @@ class AdminImportControllerCore extends AdminController if ($field_error === true && $lang_field_error === true && $image->add()) { $image->associateTo($id_shop_list); - if (!AdminImportController::copyImg($product->id, $image->id, $url)) + if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate'))) { $this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url); $image->delete(); @@ -2720,7 +2743,6 @@ class AdminImportControllerCore extends AdminController $this->clearSmartyCache(); break; case $this->entities[$import_type = $this->l('Products')]: - $import_type = $this->l('Categories'); $this->productImport(); $this->clearSmartyCache(); break; diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index ebdb2ad1d..2ec73737a 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -140,7 +140,7 @@ class AdminManufacturersControllerCore extends AdminController 'lastname' => array( 'title' => $this->l('Last name'), 'width' => 100, - 'filter_key' => 'a!name' + 'filter_key' => 'a!lastname' ), 'postcode' => array( 'title' => $this->l('Zip Code/Postal Code'), @@ -570,7 +570,7 @@ class AdminManufacturersControllerCore extends AdminController default: parent::initToolbar(); $this->toolbar_btn['import'] = array( - 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table, + 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=manufacturers', 'desc' => $this->l('Import') ); } diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 23bd95520..d15fd1323 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -805,7 +805,7 @@ class AdminOrdersControllerCore extends AdminController if (!Validate::isLoadedObject($order)) $this->errors[] = Tools::displayError('The order cannot be found'); - elseif (!Validate::isNegativePrice($amount)) + elseif (!Validate::isNegativePrice($amount) || !(float)$amount) $this->errors[] = Tools::displayError('The amount is invalid.'); elseif (!Validate::isString(Tools::getValue('payment_method'))) $this->errors[] = Tools::displayError('The selected payment method is invalid.'); @@ -1342,11 +1342,14 @@ class AdminOrdersControllerCore extends AdminController $product['warehouse_name'] = '--'; } + $gender = new Gender((int)$customer->id_gender, $this->context->language->id); + // Smarty assign $this->tpl_view_vars = array( 'order' => $order, 'cart' => new Cart($order->id_cart), 'customer' => $customer, + 'gender' => $gender, 'customer_addresses' => $customer->getAddresses($this->context->language->id), 'addresses' => array( 'delivery' => $addressDelivery, diff --git a/controllers/admin/AdminPreferencesController.php b/controllers/admin/AdminPreferencesController.php index f878f69fc..34a7e48e2 100644 --- a/controllers/admin/AdminPreferencesController.php +++ b/controllers/admin/AdminPreferencesController.php @@ -86,6 +86,19 @@ class AdminPreferencesControllerCore extends AdminController 'type' => 'bool', 'default' => '0' ), + ); + + if (Configuration::get('PS_SSL_ENABLED')) + $fields['PS_SSL_ENABLED_EVERYWHERE'] = array( + 'title' => $this->l('Force the SSL on all the pages'), + 'desc' => $this->l('Force all your store to use SSL'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'type' => 'bool', + 'default' => '0' + ); + + $fields = array_merge($fields, array( 'PS_TOKEN_ENABLE' => array( 'title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token in the Front Office to improve PrestaShop\'s security.'), @@ -135,7 +148,7 @@ class AdminPreferencesControllerCore extends AdminController 'list' => $activities2, 'identifier' => 'value' ), - ); + )); // No HTTPS activation if you haven't already. if (!Tools::usingSecureMode() && !Configuration::get('PS_SSL_ENABLED')) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 187a8ce49..03764fe67 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2437,7 +2437,7 @@ class AdminProductsControllerCore extends AdminController } else $this->toolbar_btn['import'] = array( - 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table, + 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=products', 'desc' => $this->l('Import') ); diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index b046fe3ea..fe4e129e0 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -136,6 +136,7 @@ class AdminStatusesControllerCore extends AdminController { $this->table = 'order_return_state'; $this->_defaultOrderBy = $this->identifier = 'id_order_return_state'; + $this->list_id = 'order_return_state'; $this->deleted = false; $this->_orderBy = null; diff --git a/controllers/admin/AdminSuppliersController.php b/controllers/admin/AdminSuppliersController.php index bfe5618a3..d2eb52b8d 100644 --- a/controllers/admin/AdminSuppliersController.php +++ b/controllers/admin/AdminSuppliersController.php @@ -262,6 +262,24 @@ class AdminSuppliersControllerCore extends AdminController return parent::renderForm(); } + /** + * AdminController::initToolbar() override + * @see AdminController::initToolbar() + * + */ + public function initToolbar() + { + switch ($this->display) + { + default: + parent::initToolbar(); + $this->toolbar_btn['import'] = array( + 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=suppliers', + 'desc' => $this->l('Import') + ); + } + } + public function renderView() { $products = $this->object->getProductsLite($this->context->language->id); diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 79b09cce6..505630aaa 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -425,6 +425,7 @@ class AuthControllerCore extends FrontController if (Tools::isSubmit('newsletter')) $this->processCustomerNewsletter($customer); + $customer->firstname = Tools::ucwords($customer->firstname); $customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']); if (!Validate::isBirthDate($customer->birthday)) $this->errors[] = Tools::displayError('Invalid date of birth.'); diff --git a/controllers/front/IdentityController.php b/controllers/front/IdentityController.php index 7f0eb50b4..109cf3bc8 100644 --- a/controllers/front/IdentityController.php +++ b/controllers/front/IdentityController.php @@ -79,7 +79,7 @@ class IdentityControllerCore extends FrontController if (!count($this->errors)) { $this->customer->id_default_group = (int)$prev_id_default_group; - $this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname)); + $this->customer->firstname = Tools::ucwords($this->customer->firstname); if (!isset($_POST['newsletter'])) $this->customer->newsletter = 0; diff --git a/install-dev/upgrade/php/add_module_to_hook.php b/install-dev/upgrade/php/add_module_to_hook.php index c44e4eabd..fabd39cfa 100644 --- a/install-dev/upgrade/php/add_module_to_hook.php +++ b/install-dev/upgrade/php/add_module_to_hook.php @@ -35,9 +35,14 @@ function add_module_to_hook($module_name, $hook_name) if ((int)$id_module > 0) { - $id_hook = Db::getInstance()->getValue(' - SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = "'.$hook_name.'" - '); + $id_hook = Db::getInstance()->getValue('SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = "'.$hook_name.'"'); + if(!$id_hook) + { + $res &= Db::getInstance()->execute(' + INSERT IGNORE INTO `'._DB_PREFIX_.'hook` (`name`, `title`) + VALUES ("'.pSQL($hook_name).'", "'.pSQL($hook_name).'")'); + $id_hook = Db::getInstance()->Insert_ID(); + } if ((int)$id_hook > 0) { @@ -51,7 +56,5 @@ function add_module_to_hook($module_name, $hook_name) )'); } } - return $res; -} - +} \ No newline at end of file diff --git a/install-dev/upgrade/php/remove_tab.php b/install-dev/upgrade/php/remove_tab.php index 2a0c53902..9ade12ee5 100644 --- a/install-dev/upgrade/php/remove_tab.php +++ b/install-dev/upgrade/php/remove_tab.php @@ -29,6 +29,6 @@ function remove_tab($tabname) Db::getInstance()->execute(' DELETE t, l FROM `'._DB_PREFIX_.'tab` t LEFT JOIN `'._DB_PREFIX_.'tab_lang` l ON (t.id_tab = l.id_tab) - WHERE t.`class_name` = '.pSQL($tabname)); + WHERE t.`class_name` = "'.pSQL($tabname).'"'); } diff --git a/install-dev/upgrade/sql/1.5.6.0.sql b/install-dev/upgrade/sql/1.5.6.0.sql index 5f5521cff..3b03e96ed 100644 --- a/install-dev/upgrade/sql/1.5.6.0.sql +++ b/install-dev/upgrade/sql/1.5.6.0.sql @@ -1 +1,15 @@ -ALTER TABLE `PREFIX_manufacturer_lang` CHANGE `short_description` `short_description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; \ No newline at end of file +ALTER TABLE `PREFIX_manufacturer_lang` CHANGE `short_description` `short_description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; + +/* PHP:add_module_to_hook(blockcart, actionCartListOverride); */; +/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerDeleteAfter); */; +/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerAddAfter); */; +/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerUpdateAfter); */; +/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierDeleteAfter); */; +/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierAddAfter); */; +/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierUpdateAfter); */; +/* PHP:add_module_to_hook(blockmyaccount, actionModuleRegisterHookAfter); */; +/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleRegisterHookAfter); */; +/* PHP:add_module_to_hook(blockmyaccount, actionModuleUnRegisterHookAfter); */; +/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleUnRegisterHookAfter); */; +/* PHP:remove_tab(AdminRangePrice); */; +/* PHP:remove_tab(AdminRangeWeight); */; \ No newline at end of file diff --git a/js/admin.js b/js/admin.js index e4bee41e9..f0d210359 100644 --- a/js/admin.js +++ b/js/admin.js @@ -481,7 +481,7 @@ function askFeatureName(selected, selector) { var elem; - if (selected.value == 'feature') + if (selected.value == 'features') { $('#features_' + selector).show(); $('#feature_name_' + selector).attr('name', selected.name); @@ -751,6 +751,7 @@ function doAdminAjax(data, success_func, error_func) { url : 'index.php', data : data, + type : 'POST', success : function(data){ if (success_func) return success_func(data); diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index 1bb403720..d2bb9f401 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -153,12 +153,13 @@ function displaySummary() $('tr.range_inf td input').each( function() { - if (!isNaN(parseFloat($(this).val())) && (range_inf == summary_translation_undefined || range_inf > $(this).val())) + if (!isNaN(parseFloat($(this).val())) && (range_inf == summary_translation_undefined || parseFloat(range_inf) > parseFloat($(this).val()))) range_inf = $(this).val(); }); $('tr.range_sup td input').each( function(){ - if (!isNaN(parseFloat($(this).val())) && (range_sup == summary_translation_undefined || range_sup < $(this).val())) + + if (!isNaN(parseFloat($(this).val())) && (range_sup == summary_translation_undefined || parseFloat(range_sup) < parseFloat($(this).val()))) range_sup = $(this).val(); }); @@ -272,7 +273,6 @@ function bind_inputs() }); $('tr.fees td input:checkbox').off('change').on('change', function () { - if($(this).is(':checked')) { $(this).closest('tr').children('td').each( function () { @@ -389,7 +389,7 @@ function hideFees() function showFees() { $('tr.range_inf td, tr.range_sup td, tr.fees_all td, tr.fees td').each( function () { - if ($(this).index() >= 2) + if ($(this).index() > 2) { //enable only if zone is active tr = $(this).parent('tr'); diff --git a/modules/blocknewproducts/blocknewproducts.php b/modules/blocknewproducts/blocknewproducts.php index ae04a77ee..f6b23a22d 100644 --- a/modules/blocknewproducts/blocknewproducts.php +++ b/modules/blocknewproducts/blocknewproducts.php @@ -134,6 +134,11 @@ class BlockNewProducts extends Module { return $this->hookRightColumn($params); } + + public function hookHome($params) + { + return $this->hookRightColumn($params); + } public function hookHeader($params) { diff --git a/modules/editorial/editorial.php b/modules/editorial/editorial.php index 3df3fa570..c7ecf4414 100644 --- a/modules/editorial/editorial.php +++ b/modules/editorial/editorial.php @@ -218,9 +218,9 @@ class Editorial extends Module if ($input['name'] != 'body_homepage_logo') $helper->fields_value[$input['name']] = $editorial->{$input['name']}; - $helper->fields_value['image'] = (file_exists(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') ? '' : ''); - if ($helper->fields_value['image']) - $helper->fields_value['size'] = filesize(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') / 1000; + $helper->fields_value['body_homepage_logo']['image'] = (file_exists(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') ? '' : ''); + if ($helper->fields_value['body_homepage_logo']) + $helper->fields_value['body_homepage_logo']['size'] = filesize(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') / 1000; $this->_html .= $helper->generateForm($this->fields_form); return $this->_html; diff --git a/themes/default/product.tpl b/themes/default/product.tpl index 97f5bbb08..dfd32a4ae 100644 --- a/themes/default/product.tpl +++ b/themes/default/product.tpl @@ -433,17 +433,10 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving {/if} {*close if for show price*} {/if} - {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE} - - - {l s='Add to cart'} - - {else} -

- - -

- {/if} +

quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block"> + + +

{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}