diff --git a/modules/blocktopmenu/blocktopmenu.php b/modules/blocktopmenu/blocktopmenu.php
index 2986742a..bd089a22 100644
--- a/modules/blocktopmenu/blocktopmenu.php
+++ b/modules/blocktopmenu/blocktopmenu.php
@@ -807,7 +807,7 @@ class Blocktopmenu extends Module
}
- protected function getCMSPages($id_cms_category, $id_shop = false, $id_lang = false, $id_shop = false)
+ protected function getCMSPages($id_cms_category, $id_shop = false, $id_lang = false)
{
$id_shop = ($id_shop !== false) ? (int)$id_shop : (int)Context::getContext()->shop->id;
$id_lang = $id_lang ? (int)$id_lang : (int)Context::getContext()->language->id;
diff --git a/modules/flashsales/controllers/front/page.php b/modules/flashsales/controllers/front/page.php
index 8bdd6aa6..15b82e6e 100644
--- a/modules/flashsales/controllers/front/page.php
+++ b/modules/flashsales/controllers/front/page.php
@@ -1,96 +1,108 @@
-context->language->id;
- $id_flash_sale = Tools::getvalue('id_flash_sale') ? (int)Tools::getvalue('id_flash_sale') : null;
-
- $flash_sales = FlashSale::getFlashSales($id_lang, 'page');
- if (is_array($flash_sales) && count($flash_sales))
- {
- foreach ($flash_sales as $key => $flash_sale)
- {
- if (!FlashSale::getAllProducts($id_lang, $id_flash_sale, 'page'))
- {
- unset($flash_sales[$key]);
- continue;
- }
-
- $higher_reduction = FlashSale::getHigherReduction((int)$flash_sale['id_flash_sale']);
- if (isset($higher_reduction['reduction']) && !empty($higher_reduction['reduction']))
- {
- if ($higher_reduction['reduction_type'] == 'percentage')
- $higher_reduction = round($higher_reduction['reduction'], 2).' %';
- elseif ($higher_reduction['reduction_type'] == 'amount')
- $higher_reduction = Tools::displayPrice($higher_reduction['reduction'], Context::getContext()->currency->id);
- else
- $higher_reduction = false;
- }
- $flash_sales[$key]['higher_reduction'] = $higher_reduction;
- }
-
- if (!count($flash_sales))
- $flash_sales = false;
- }
-
- $this->productSort();
-
- $products = FlashSale::getAllProducts($id_lang, $id_flash_sale, 'page', false, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
- $nbProducts = (int)count($products);
-
- $this->pagination($nbProducts);
-
- if (version_compare(_PS_VERSION_, '1.6', '>'))
- $this->addColorsToProductList($products);
-
- $this->context->smarty->assign(array(
- 'request' => $this->context->link->getModuleLink('flashsales', 'page', array('id_flash_sale' => $id_flash_sale)),
- 'flash_sales' => $flash_sales,
- 'id_flash_sale' => $id_flash_sale,
- 'products' => $products,
- 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
- 'nbProducts' => $nbProducts,
- 'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
- 'name' => Configuration::get('FLASHSALE_PAGE_TITLE', $id_lang),
- 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')
- ));
-
- $this->setTemplate('page.tpl');
- // Tools::redirect('index.php?controller=404');
- }
-
- public function setMedia()
- {
- parent::setMedia();
- $this->addCSS(_THEME_CSS_DIR_.'product_list.css');
- $this->addCSS(_THEME_CSS_DIR_.'category.css');
-
- if (Configuration::get('PS_COMPARATOR_MAX_ITEM'))
- $this->addJS(_THEME_JS_DIR_.'products-comparison.js');
- }
-}
+context->language->id;
+ $id_flash_sale = Tools::getvalue('id_flash_sale') ? (int)Tools::getvalue('id_flash_sale') : null;
+
+ $flash_sales = FlashSale::getFlashSales($id_lang, 'page');
+ if (is_array($flash_sales) && count($flash_sales))
+ {
+ foreach ($flash_sales as $key => $flash_sale)
+ {
+ if (!FlashSale::getAllProducts($id_lang, $id_flash_sale, 'page'))
+ {
+ unset($flash_sales[$key]);
+ continue;
+ }
+
+ $higher_reduction = FlashSale::getHigherReduction((int)$flash_sale['id_flash_sale']);
+ if (isset($higher_reduction['reduction']) && !empty($higher_reduction['reduction']))
+ {
+ if ($higher_reduction['reduction_type'] == 'percentage')
+ $higher_reduction = round($higher_reduction['reduction'], 2).' %';
+ elseif ($higher_reduction['reduction_type'] == 'amount')
+ $higher_reduction = Tools::displayPrice($higher_reduction['reduction'], Context::getContext()->currency->id);
+ else
+ $higher_reduction = false;
+ }
+ $flash_sales[$key]['higher_reduction'] = $higher_reduction;
+ }
+
+ $imgFlashSale = false;
+ if ($id_flash_sale) {
+ $flash_sale = new FlashSale($id_flash_sale, $id_lang);
+ $name = $flash_sale->name;
+ $description = $flash_sale->description;
+
+ $imgFlashSale = file_exists(_PS_MODULE_DIR_.'flashsales/views/img/banner/'.$flash_sale->id.'.jpg') ? 'flashsales/views/img/banner/'.$flash_sale->id.'.jpg' : false ;
+ }
+
+ if (!count($flash_sales))
+ $flash_sales = false;
+ }
+
+ $this->productSort();
+
+ $products = FlashSale::getAllProducts($id_lang, $id_flash_sale, 'page', false, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
+ $nbProducts = (int)count($products);
+
+ $this->pagination($nbProducts);
+
+ if (version_compare(_PS_VERSION_, '1.6', '>'))
+ $this->addColorsToProductList($products);
+
+ $this->context->smarty->assign(array(
+ 'request' => $this->context->link->getModuleLink('flashsales', 'page', array('id_flash_sale' => $id_flash_sale)),
+ 'flash_sales' => $flash_sales,
+ 'id_flash_sale' => $id_flash_sale,
+ 'imgFlashSale' => $imgFlashSale,
+ 'products' => $products,
+ 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
+ 'nbProducts' => $nbProducts,
+ 'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
+ 'pageTitle' => Configuration::get('FLASHSALE_PAGE_TITLE', $id_lang),
+ 'name' => isset($name) ? $name : Configuration::get('FLASHSALE_PAGE_TITLE', $id_lang),
+ 'description' => isset($description) ? $description : false,
+ 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')
+ ));
+
+ $this->setTemplate('page.tpl');
+ // Tools::redirect('index.php?controller=404');
+ }
+
+ public function setMedia()
+ {
+ parent::setMedia();
+ $this->addCSS(_THEME_CSS_DIR_.'product_list.css');
+ $this->addCSS(_THEME_CSS_DIR_.'category.css');
+
+ if (Configuration::get('PS_COMPARATOR_MAX_ITEM'))
+ $this->addJS(_THEME_JS_DIR_.'products-comparison.js');
+ }
+}
diff --git a/modules/flashsales/flashsales.php b/modules/flashsales/flashsales.php
index 3394d92d..233da70b 100644
--- a/modules/flashsales/flashsales.php
+++ b/modules/flashsales/flashsales.php
@@ -1,657 +1,661 @@
- array('class' => '.flashsale-countdown-box', 'property' => 'width', 'field' => 'box_width'),
- 1 => array('class' => '.flashsale-countdown-box', 'property' => 'border-width', 'field' => 'box_border_width'),
- 2 => array('class' => '.flashsale-countdown-box', 'property' => 'border-style', 'field' => 'box_border_style'),
- 3 => array('class' => '.flashsale-countdown-box', 'property' => 'border-color', 'field' => 'box_border_color'),
- 4 => array('class' => '.flashsale-countdown-box', 'property' => 'background-color', 'field' => 'box_background_color'),
- 5 => array('class' => '.flashsale-countdown-box .content i.icon-clock-o', 'property' => 'color', 'field' => 'icon_color'),
- 6 => array('class' => '.flashsale-countdown-box .content i.icon-clock-o', 'property' => 'font-size', 'field' => 'icon_font_size'),
- 7 => array('class' => '.flashsale-countdown-box .content i.icon-clock-o', 'property' => 'display', 'field' => 'icon_display'),
- 8 => array('class' => '.flashsale-countdown-box .content span.title', 'property' => 'color', 'field' => 'title_color'),
- 9 => array('class' => '.flashsale-countdown-box .content span.title', 'property' => 'font-size', 'field' => 'title_font_size'),
- 10 => array('class' => '.flashsale-countdown-box .content span.countdown', 'property' => 'color', 'field' => 'countdown_color'),
- 11 => array('class' => '.flashsale-countdown-box .content span.countdown', 'property' => 'font-size', 'field' => 'countdown_font_size'),
- );
-
- protected static $cache_flash_sales = array();
-
- public function __construct()
- {
- $this->name = 'flashsales';
- $this->tab = 'front_office_features';
- $this->version = '2.0.0';
- $this->author = 'Agencya';
- $this->module_key = '36c6c0e545ecf7134526a92f293d06da';
- $this->bootstrap = true;
- parent::__construct();
-
- $this->displayName = $this->l('Flash Sales - Extended');
- $this->description = $this->l('Add, edit, customize your flash sales effectively and intuitively to boost your sales!');
- $this->ps_versions_compliancy = array('min' => '1.5.0', 'max' => '1.6.9');
- }
-
- public function install($delete_params = true)
- {
- if (!parent::install()
- || !$this->registerHook('actionAdminControllerSetMedia')
- || !$this->registerHook('header')
- || !$this->registerHook('displayHome')
- || !$this->registerHook('displayHomeTab')
- || !$this->registerHook('displayHomeTabContent')
- || !$this->registerHook('rightColumn')
- || !$this->registerHook('leftColumn')
- || !$this->registerHook('displayProductListReviews')
- || !$this->registerHook('actionObjectDeleteAfter')
- || !$this->registerHook('displayRightColumnProduct'))
- return false;
-
- // Install database
- if ($delete_params)
- if (!$this->installDb())
- return false;
-
- // Instal conf
- if (!$this->installConf())
- return false;
-
- $languages = Language::getLanguages();
-
- // Install Tab
- $tab = new Tab();
- foreach ($languages as $lang)
- $tab->name[$lang['id_lang']] = $this->l('Flash Sales');
- $tab->class_name = 'AdminFlashSales';
- $tab->id_parent = (int)Tab::getIdFromClassName('AdminPriceRule');
- $tab->module = $this->name;
- if (!$tab->add())
- return false;
-
- // Install Meta
- $meta = new Meta();
- $meta->page = 'module-'.$this->name.'-page';
- $meta->configurable = 1;
- foreach ($languages as $language)
- {
- if ($language['iso_code'] == 'fr')
- {
- $meta->title[(int)$language['id_lang']] = 'Ventes flash';
- $meta->description[(int)$language['id_lang']] = '';
- $meta->url_rewrite[(int)$language['id_lang']] = 'ventes-flash';
- }
- else
- {
- $meta->title[(int)$language['id_lang']] = 'Flash sales';
- $meta->description[(int)$language['id_lang']] = '';
- $meta->url_rewrite[(int)$language['id_lang']] = 'flash-sales';
- }
- }
- $meta->add();
-
- if (version_compare(_PS_VERSION_, '1.6', '>='))
- {
- $themes = Theme::getThemes();
- $theme_meta_value = array();
- foreach ($themes as $theme)
- {
- $theme_meta_value[] = array(
- 'id_theme' => $theme->id,
- 'id_meta' => (int)$meta->id,
- 'left_column' => (int)$theme->default_left_column,
- 'right_column' => (int)$theme->default_right_column
- );
-
- }
- if (count($theme_meta_value) > 0)
- Db::getInstance()->insert('theme_meta', (array)$theme_meta_value, false, true, DB::INSERT_IGNORE);
- }
-
- $this->_clearCache('*');
-
- return true;
- }
-
- public function installDb()
- {
- $sql = array();
- include(dirname(__FILE__).'/sql/install.php');
- foreach ($sql as $s)
- if (!Db::getInstance()->execute($s))
- return false;
-
- return true;
- }
-
- public function installConf()
- {
- if (!Configuration::updateValue('FLASHSALE_PRODUCTS_NB', '8')
- || !Configuration::updateValue('FLASHSALE_DEL_SPECIFICPRICE', '1')
- || !Configuration::updateValue('FLASHSALE_DISPLAY_TOPMENU', '0'))
- return false;
-
- $values = array();
- $languages = Language::getLanguages(false);
- foreach ($languages as $language)
- {
- $values['FLASHSALE_PAGE_TITLE'] = array($language['id_lang'] => $language['iso_code'] == 'fr' ? 'Ventes Flash' : 'Flash Sales');
- $values['FLASHSALE_COUNTDOWN_STRING'] = array($language['id_lang'] => $language['iso_code'] == 'fr' ? 'Vente flash' : 'Flash sale');
-
- foreach ($values as $key => $value)
- if (!Configuration::updateValue($key, $value))
- return false;
- }
-
- return true;
- }
-
- public function uninstall($delete_params = true)
- {
- // Uninstall Module
- if (!parent::uninstall())
- return false;
-
- // Delete specific prices & database
- if ($delete_params)
- if (!$this->deleteSpecificPrice() || !$this->uninstallDb())
- return false;
-
- // Delete conf
- if (!$this->uninstallConf())
- return false;
-
- // Delete Tabs
- $tabs = Tab::getCollectionFromModule($this->name);
- foreach ($tabs as $tab)
- $tab->delete();
-
- // Delete Meta
- $metas = Meta::getMetaByPage('module-'.$this->name.'-page', (int)$this->context->language->id);
- $meta = new Meta((int)$metas['id_meta']);
- if ($meta->delete() && version_compare(_PS_VERSION_, '1.6', '>='))
- Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'theme_meta` WHERE id_meta='.(int)$meta->id);
-
- // Delete top-menu link
- if (class_exists('MenuTopLinks'))
- {
- $shop_id = (int)Shop::getContextShopID();
- $shop_group_id = Shop::getGroupFromShop($shop_id);
- $conf = Configuration::get('MOD_BLOCKTOPMENU_ITEMS', null, $shop_group_id, $shop_id);
-
- $id_linksmenutop = $this->addTopMenuLink();
- MenuTopLinks::remove($id_linksmenutop, $shop_id);
- Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', (string)str_replace(array('LNK'.$id_linksmenutop.',', 'LNK'.$id_linksmenutop), '', $conf),
- false, $shop_group_id, $shop_id);
- }
-
- // Clear cache
- $this->_clearCache('*');
-
- return true;
- }
-
- public function deleteSpecificPrice()
- {
- $ids_flash_sale = FlashSale::getFlashSalesLite();
- foreach ($ids_flash_sale as $id_flash_sale)
- {
- $flash_sale = new FlashSale((int)$id_flash_sale);
- $flash_sale->deleteSpecificPrice();
- }
-
- return true;
- }
-
- public function uninstallDb()
- {
- $sql = array();
- include(dirname(__FILE__).'/sql/uninstall.php');
- foreach ($sql as $s)
- if (!Db::getInstance()->execute($s))
- return false;
-
- return true;
- }
-
- public function uninstallConf()
- {
- Configuration::deleteByName('FLASHSALE_PAGE_TITLE');
- Configuration::deleteByName('FLASHSALE_COUNTDOWN_STRING');
- Configuration::deleteByName('FLASHSALE_PRODUCTS_NB');
- Configuration::deleteByName('FLASHSALE_DEL_SPECIFICPRICE');
- Configuration::deleteByName('FLASHSALE_DISPLAY_TOPMENU');
-
- return true;
- }
-
- public function reset()
- {
- if (!$this->uninstall(false))
- return false;
- if (!$this->install(false))
- return false;
-
- return true;
- }
-
- public function getContent()
- {
- if (Tools::isSubmit('submitFlashSales'))
- {
- $this->updateConfigFieldsValues();
-
- $topmenu = Module::getInstanceByName('blocktopmenu');
- if ($topmenu && $topmenu->active)
- $this->updateTopMenuDisplay();
-
- $this->updateCssFile();
-
- if (!count($this->_post_errors))
- Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&conf=4&token='.Tools::getAdminTokenLite('AdminModules'));
- else
- foreach ($this->_post_errors as $err)
- $this->_html .= $this->displayError($err);
- }
-
- if (version_compare(_PS_VERSION_, '1.6', '<'))
- {
- $this->_html .= '
';
- $this->_html .= $this->renderFlashSalesForm();
- $this->_html .= '
';
- }
- else
- $this->_html .= $this->renderFlashSalesForm();
-
- return $this->_html;
- }
-
- public function renderFlashSalesForm()
- {
- $languages = Language::getLanguages();
- $topmenu = Module::getInstanceByName('blocktopmenu');
-
- $css_file = Tools::file_get_contents(_PS_MODULE_DIR_.$this->name.'/views/css/design.css');
- $css_fields = $this->loadCssFields($css_file);
-
- $this->context->smarty->assign(array(
- 'languages' => Language::getLanguages(true, Context::getContext()->shop->id),
- 'default_language' => (int)Configuration::get('PS_LANG_DEFAULT'),
- 'currentIndex' => $this->context->link->getAdminLink('AdminModules', true).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name,
- 'currentToken' => Tools::getAdminTokenLite('AdminModules'),
- 'css_file' => $css_file,
- 'css_fields' => $css_fields,
- 'topmenu' => (bool)($topmenu && $topmenu->active),
- 'tpl_general' => _PS_MODULE_DIR_.$this->name.'/views/templates/admin/settings/general.tpl',
- 'tpl_display' => _PS_MODULE_DIR_.$this->name.'/views/templates/admin/settings/display.tpl',
- 'tpl_css' => _PS_MODULE_DIR_.$this->name.'/views/templates/admin/settings/css.tpl',
- ));
-
- if (version_compare(_PS_VERSION_, '1.6', '<'))
- {
- $this->context->controller->addCss($this->_path.'views/css/admin-theme.css', 'all');
- $this->context->controller->addJS(array(
- _MODULE_DIR_.'flashsales/views/js/tools/bootstrap.js',
- _MODULE_DIR_.'flashsales/views/js/tools/jquery.autosize.js',
- _MODULE_DIR_.'flashsales/views/js/tools/functions.js'
- ));
- }
-
- $this->context->controller->addJqueryPlugin('colorpicker');
- $this->context->controller->addJS(_MODULE_DIR_.$this->name.'/views/js/settings.js');
-
- return $this->context->smarty->createTemplate(_PS_MODULE_DIR_.$this->name.'/views/templates/admin/settings/form.tpl', $this->context->smarty)->fetch();
- }
-
- protected function updateConfigFieldsValues()
- {
- $config = $this->getConfigFieldsValues();
- foreach ($config as $key => $val)
- {
- if (is_array($val) && count($val))
- foreach ($val as $v)
- if (!Validate::isCleanHTML($v))
- {
- $this->_post_errors[] = sprintf($this->l('Unvalid lang field : "%s"'), $key);
- return false;
- }
-
- Configuration::updateValue($key, $val);
- }
- }
-
- protected function loadCssFields($content)
- {
- if (empty($content))
- return array();
-
- $fields = array();
- foreach ($this->_css_fields as $css_field)
- {
- $pos = stripos($content, $css_field['class']);
- $pos = stripos($content, $css_field['property'], $pos);
- $pos = stripos($content, ':', $pos);
- $start = $pos + 1;
- $end = stripos($content, ';', $start);
- $output = Tools::substr($content, $start, $end - $start);
-
- // replace pattern
- $pattern = array('/px/', '/%/', '/inline-block/', '/solid/', '/none/');
- $replace = array('', '', 1, 1, 0);
- $output = preg_replace($pattern, $replace, $output);
- // delete spaces
- $output = trim($output);
-
- $fields[$css_field['field']] = $output;
- }
-
- return $fields;
- }
-
- protected function updateCssFile()
- {
- $content = strip_tags(Tools::getValue('css_file'));
- // replace correct end of line
- $content = str_replace("\r\n", PHP_EOL, $content);
- // Magic Quotes shall... not.. PASS!
- if (_PS_MAGIC_QUOTES_GPC_)
- $content = Tools::stripslashes($content);
-
- if (Validate::isCleanHTML($content))
- {
- $path = _PS_MODULE_DIR_.$this->name.'/views/css/design.css';
- if (!file_put_contents($path, $content))
- $this->_post_errors[] = sprintf($this->l('File "%s" cannot be created'), dirname($path));
- }
- else
- $this->_post_errors[] = $this->l('Your css cannot contain JavaScript code.');
- }
-
- protected function updateTopMenuDisplay()
- {
- $shop_id = (int)Shop::getContextShopID();
- $shop_group_id = Shop::getGroupFromShop($shop_id);
- $conf = Configuration::get('MOD_BLOCKTOPMENU_ITEMS', null, $shop_group_id, $shop_id);
-
- $display = Tools::getValue('flashsale_display_topmenu');
- Configuration::updateValue('FLASHSALE_DISPLAY_TOPMENU', (int)$display);
-
- $id_linksmenutop = $this->addTopMenuLink();
-
- if (!$display)
- {
- MenuTopLinks::remove($id_linksmenutop, $shop_id);
- Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', (string)str_replace(array('LNK'.$id_linksmenutop.',', 'LNK'.$id_linksmenutop), '', $conf), false, $shop_group_id, $shop_id);
- }
- else
- {
- $menu_items = Tools::strlen($conf) ? explode(',', $conf) : array();
- if (!in_array('LNK'.$id_linksmenutop, $menu_items))
- $menu_items[] = 'LNK'.$id_linksmenutop;
-
- Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', (string)implode(',', $menu_items), false, (int)$shop_group_id, (int)$shop_id);
- }
-
- return true;
- }
-
- protected function addTopMenuLink()
- {
- $id_linksmenutop = 0;
- $labels = array();
- $page_link = array();
- $languages = Language::getLanguages();
-
- foreach ($languages as $language)
- {
- $labels[(int)$language['id_lang']] = $language['iso_code'] == 'fr' ? 'Ventes Flash' : 'Flash Sales';
- $page_link[(int)$language['id_lang']] = $this->context->link->getModuleLink($this->name, 'page', array(), null, (int)$language['id_lang']);
-
- $links = MenuTopLinks::gets((int)$language['id_lang'], null, (int)Shop::getContextShopID());
-
- foreach ($links as $link)
- {
- if ($link['link'] == $page_link[(int)$language['id_lang']])
- {
- $id_linksmenutop = (int)$link['id_linksmenutop'];
- break 2;
- }
- }
- }
- if ($id_linksmenutop == 0)
- {
- MenuTopLinks::add($page_link, $labels, 0, (int)Shop::getContextShopID());
- $id_linksmenutop = $this->addTopMenuLink();
- }
-
- return $id_linksmenutop;
- }
-
- public function getConfigFieldsValues()
- {
- $fields = array();
- $languages = Language::getLanguages();
- foreach ($languages as $language)
- {
- $fields['FLASHSALE_PAGE_TITLE'][$language['id_lang']] = Tools::getValue('flashsale_page_title_'.$language['id_lang'], Configuration::get('FLASHSALE_PAGE_TITLE', (int)$language['id_lang']));
- $fields['FLASHSALE_COUNTDOWN_STRING'][$language['id_lang']] = Tools::getValue('flashsale_countdown_string_'.$language['id_lang'], Configuration::get('FLASHSALE_COUNTDOWN_STRING', (int)$language['id_lang']));
- }
- $fields['FLASHSALE_PRODUCTS_NB'] = (int)Tools::getValue('flashsale_products_nb', Configuration::get('FLASHSALE_PRODUCTS_NB'));
- $fields['FLASHSALE_DEL_SPECIFICPRICE'] = (bool)Tools::getValue('flashsale_del_specificprice', Configuration::get('FLASHSALE_DEL_SPECIFICPRICE'));
-
- return $fields;
- }
-
- public function hookActionAdminControllerSetMedia()
- {
- $this->context->controller->addCSS($this->_path.'views/css/admin-design.css', 'all');
- }
-
- public function hookHeader($params)
- {
- // TODO add to other hooks $this->_clearCache('*');
- $this->context->controller->addJS($this->_path.'views/js/countdown.js');
- $this->context->controller->addCSS($this->_path.'views/css/design.css', 'all');
- $this->context->controller->addCSS($this->_path.'views/css/global.css', 'all');
- }
-
- public function hookActionObjectDeleteAfter($params)
- {
- $object = $params['object'];
-
- if (get_class($object) === 'Product')
- Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'flash_sale_products` WHERE `id_product` = '.(int)$object->id);
- elseif (get_class($object) === 'Category')
- Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'flash_sale_products` WHERE `id_category` = '.(int)$object->id);
- elseif (get_class($object) === 'Manufacturer')
- Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'flash_sale_products` WHERE `id_manufacturer` = '.(int)$object->id);
- elseif (get_class($object) === 'SpecificPrice')
- Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'flash_sale_specific_prices` WHERE `id_specific_price` = '.(int)$object->id);
-
- $this->_clearCache('*');
- return true;
- }
-
- public function hookdisplayHome($params)
- {
- if (!$this->isCached('home.tpl', $this->getCacheId('home')))
- {
- if (!isset(flashsales::$cache_flash_sales['home']))
- {
- $flash_sales = FlashSale::getFlashSales((int)$this->context->language->id, 'home');
- if (is_array($flash_sales) && count($flash_sales))
- {
- foreach ($flash_sales as $key => $flash_sale)
- {
- if (!$this->getProducts('home', (int)$flash_sale['id_flash_sale']))
- {
- unset($flash_sales[$key]);
- continue;
- }
- $banner = _PS_MODULE_DIR_.$this->name.'/views/img/banner/'.(int)$flash_sale['id_flash_sale'].'.jpg';
- $flash_sales[$key]['banner'] = file_exists($banner) ? _MODULE_DIR_.$this->name.'/views/img/banner/'.(int)$flash_sale['id_flash_sale'].'.jpg' : false;
- }
-
- if (!count($flash_sales))
- $flash_sales = false;
- }
- flashsales::$cache_flash_sales['home'] = $flash_sales;
- }
-
- if (flashsales::$cache_flash_sales['home'] === false)
- return false;
-
- $this->smarty->assign(array(
- 'flash_sales' => flashsales::$cache_flash_sales['home'],
- 'txt' => Configuration::get('FLASHSALE_COUNTDOWN_STRING', (int)$this->context->language->id),
- 'tpl_countdown' => _PS_MODULE_DIR_.$this->name.'/views/templates/hook/countdown.tpl',
- ));
-
-
- }
-
- return $this->display(__FILE__, 'home.tpl', $this->getCacheId('home'));
- }
-
- public function hookDisplayHomeTab($params)
- {
- if (version_compare(_PS_VERSION_, '1.6', '<'))
- return false;
-
- if (!$this->isCached('home-tab.tpl', $this->getCacheId('home-tab')))
- {
- if (!isset(flashsales::$cache_flash_sales['home_tab']))
- flashsales::$cache_flash_sales['home_tab'] = $this->getProducts('home_tab');
-
- if (flashsales::$cache_flash_sales['home_tab'] === false)
- return false;
- }
-
- return $this->display(__FILE__, 'home-tab.tpl', $this->getCacheId('home-tab'));
- }
-
- public function hookdisplayHomeTabContent($params)
- {
- if (version_compare(_PS_VERSION_, '1.6', '<'))
- return false;
-
- if (!$this->isCached('home-tab-content.tpl', $this->getCacheId('home-tab-content')))
- {
- if (!isset(flashsales::$cache_flash_sales['home_tab']))
- flashsales::$cache_flash_sales['home_tab'] = $this->getProducts('home_tab');
-
- if (flashsales::$cache_flash_sales['home_tab'] === false)
- return false;
-
- $this->smarty->assign(array(
- 'flash_sales' => flashsales::$cache_flash_sales['home_tab'],
- 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
- ));
- }
-
- return $this->display(__FILE__, 'home-tab-content.tpl', $this->getCacheId('home-tab-content'));
- }
-
- public function hookRightColumn($params)
- {
- if (!$this->isCached('column.tpl', $this->getCacheId('column')))
- {
- if (!isset(flashsales::$cache_flash_sales['column']))
- flashsales::$cache_flash_sales['column'] = $this->getProducts('column');
-
- if (flashsales::$cache_flash_sales['column'] === false)
- return false;
-
- $this->smarty->assign(array(
- 'flash_sales' => flashsales::$cache_flash_sales['column'],
- 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
- 'smallSize' => Image::getSize(ImageType::getFormatedName('small')),
- 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
- ));
- }
- return $this->display(__FILE__, 'column.tpl', $this->getCacheId('column'));
- }
-
- public function hookLeftColumn($params)
- {
- return $this->hookRightColumn($params);
- }
-
- public function hookDisplayProductListReviews($params)
- {
- $id_product = (int)$params['product']['id_product'];
- if (!($specific_price = FlashSale::getProductSpecificPrice($id_product)))
- return;
-
- $this->smarty->assign(array(
- 'to' => (int)strtotime($specific_price['to']),
- 'txt' => Configuration::get('FLASHSALE_COUNTDOWN_STRING', (int)$this->context->language->id),
- 'id_product' => $id_product
- ));
-
- return $this->display(__FILE__, 'countdown.tpl');
- }
-
- public function hookDisplayRightColumnProduct($params)
- {
- if (!isset($params['product']['id_product']))
- $params['product']['id_product'] = (int)Tools::getValue('id_product');
-
- return $this->hookDisplayProductListReviews($params);
- }
-
- public function getProducts($filter = null, $id_flash_sale = null)
- {
- if (Configuration::get('PS_CATALOG_MODE'))
- return false;
-
- $nb = (int)Configuration::get('FLASHSALE_PRODUCTS_NB');
- return FlashSale::getAllProducts((int)$this->context->language->id, $id_flash_sale, $filter, false, 0, ($nb ? $nb : 8));
- }
-
- public function _clearCache($template, $cache_id = null, $compile_id = null)
- {
- Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('homefeatured.tpl'));
- parent::_clearCache('column.tpl', 'column');
- parent::_clearCache('home-tab-content.tpl', 'home-tab-content');
- parent::_clearCache('home-tab.tpl', 'home-tab');
- parent::_clearCache('home.tpl', 'home');
- }
-}
-?>
+ array('class' => '.flashsale-countdown-box', 'property' => 'width', 'field' => 'box_width'),
+ 1 => array('class' => '.flashsale-countdown-box', 'property' => 'border-width', 'field' => 'box_border_width'),
+ 2 => array('class' => '.flashsale-countdown-box', 'property' => 'border-style', 'field' => 'box_border_style'),
+ 3 => array('class' => '.flashsale-countdown-box', 'property' => 'border-color', 'field' => 'box_border_color'),
+ 4 => array('class' => '.flashsale-countdown-box', 'property' => 'background-color', 'field' => 'box_background_color'),
+ 5 => array('class' => '.flashsale-countdown-box .content i.icon-clock-o', 'property' => 'color', 'field' => 'icon_color'),
+ 6 => array('class' => '.flashsale-countdown-box .content i.icon-clock-o', 'property' => 'font-size', 'field' => 'icon_font_size'),
+ 7 => array('class' => '.flashsale-countdown-box .content i.icon-clock-o', 'property' => 'display', 'field' => 'icon_display'),
+ 8 => array('class' => '.flashsale-countdown-box .content span.title', 'property' => 'color', 'field' => 'title_color'),
+ 9 => array('class' => '.flashsale-countdown-box .content span.title', 'property' => 'font-size', 'field' => 'title_font_size'),
+ 10 => array('class' => '.flashsale-countdown-box .content span.countdown', 'property' => 'color', 'field' => 'countdown_color'),
+ 11 => array('class' => '.flashsale-countdown-box .content span.countdown', 'property' => 'font-size', 'field' => 'countdown_font_size'),
+ );
+
+ protected static $cache_flash_sales = array();
+
+ public function __construct()
+ {
+ $this->name = 'flashsales';
+ $this->tab = 'front_office_features';
+ $this->version = '2.0.0';
+ $this->author = 'Agencya';
+ $this->module_key = '36c6c0e545ecf7134526a92f293d06da';
+ $this->bootstrap = true;
+ parent::__construct();
+
+ $this->displayName = $this->l('Flash Sales - Extended');
+ $this->description = $this->l('Add, edit, customize your flash sales effectively and intuitively to boost your sales!');
+ $this->ps_versions_compliancy = array('min' => '1.5.0', 'max' => '1.6.9');
+ }
+
+ public function install($delete_params = true)
+ {
+ if (!parent::install()
+ || !$this->registerHook('actionAdminControllerSetMedia')
+ || !$this->registerHook('header')
+ || !$this->registerHook('displayHome')
+ || !$this->registerHook('displayHomeTab')
+ || !$this->registerHook('displayHomeTabContent')
+ || !$this->registerHook('rightColumn')
+ || !$this->registerHook('leftColumn')
+ || !$this->registerHook('displayProductListReviews')
+ || !$this->registerHook('actionObjectDeleteAfter')
+ || !$this->registerHook('displayRightColumnProduct'))
+ return false;
+
+ // Install database
+ if ($delete_params)
+ if (!$this->installDb())
+ return false;
+
+ // Instal conf
+ if (!$this->installConf())
+ return false;
+
+ $languages = Language::getLanguages();
+
+ // Install Tab
+ $tab = new Tab();
+ foreach ($languages as $lang)
+ $tab->name[$lang['id_lang']] = $this->l('Flash Sales');
+ $tab->class_name = 'AdminFlashSales';
+ $tab->id_parent = (int)Tab::getIdFromClassName('AdminPriceRule');
+ $tab->module = $this->name;
+ if (!$tab->add())
+ return false;
+
+ // Install Meta
+ $meta = new Meta();
+ $meta->page = 'module-'.$this->name.'-page';
+ $meta->configurable = 1;
+ foreach ($languages as $language)
+ {
+ if ($language['iso_code'] == 'fr')
+ {
+ $meta->title[(int)$language['id_lang']] = 'Ventes flash';
+ $meta->description[(int)$language['id_lang']] = '';
+ $meta->url_rewrite[(int)$language['id_lang']] = 'ventes-flash';
+ }
+ else
+ {
+ $meta->title[(int)$language['id_lang']] = 'Flash sales';
+ $meta->description[(int)$language['id_lang']] = '';
+ $meta->url_rewrite[(int)$language['id_lang']] = 'flash-sales';
+ }
+ }
+ $meta->add();
+
+ if (version_compare(_PS_VERSION_, '1.6', '>='))
+ {
+ $themes = Theme::getThemes();
+ $theme_meta_value = array();
+ foreach ($themes as $theme)
+ {
+ $theme_meta_value[] = array(
+ 'id_theme' => $theme->id,
+ 'id_meta' => (int)$meta->id,
+ 'left_column' => (int)$theme->default_left_column,
+ 'right_column' => (int)$theme->default_right_column
+ );
+
+ }
+ if (count($theme_meta_value) > 0)
+ Db::getInstance()->insert('theme_meta', (array)$theme_meta_value, false, true, DB::INSERT_IGNORE);
+ }
+
+ $this->_clearCache('*');
+
+ return true;
+ }
+
+ public function installDb()
+ {
+ $sql = array();
+ include(dirname(__FILE__).'/sql/install.php');
+ foreach ($sql as $s)
+ if (!Db::getInstance()->execute($s))
+ return false;
+
+ return true;
+ }
+
+ public function installConf()
+ {
+ if (!Configuration::updateValue('FLASHSALE_PRODUCTS_NB', '8')
+ || !Configuration::updateValue('FLASHSALE_DEL_SPECIFICPRICE', '1')
+ || !Configuration::updateValue('FLASHSALE_DISPLAY_TOPMENU', '0'))
+ return false;
+
+ $values = array();
+ $languages = Language::getLanguages(false);
+ foreach ($languages as $language)
+ {
+ $values['FLASHSALE_PAGE_TITLE'] = array($language['id_lang'] => $language['iso_code'] == 'fr' ? 'Ventes Flash' : 'Flash Sales');
+ $values['FLASHSALE_COUNTDOWN_STRING'] = array($language['id_lang'] => $language['iso_code'] == 'fr' ? 'Vente flash' : 'Flash sale');
+
+ foreach ($values as $key => $value)
+ if (!Configuration::updateValue($key, $value))
+ return false;
+ }
+
+ return true;
+ }
+
+ public function uninstall($delete_params = true)
+ {
+ // Uninstall Module
+ if (!parent::uninstall())
+ return false;
+
+ // Delete specific prices & database
+ if ($delete_params)
+ if (!$this->deleteSpecificPrice() || !$this->uninstallDb())
+ return false;
+
+ // Delete conf
+ if (!$this->uninstallConf())
+ return false;
+
+ // Delete Tabs
+ $tabs = Tab::getCollectionFromModule($this->name);
+ foreach ($tabs as $tab)
+ $tab->delete();
+
+ // Delete Meta
+ $metas = Meta::getMetaByPage('module-'.$this->name.'-page', (int)$this->context->language->id);
+ $meta = new Meta((int)$metas['id_meta']);
+ if ($meta->delete() && version_compare(_PS_VERSION_, '1.6', '>='))
+ Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'theme_meta` WHERE id_meta='.(int)$meta->id);
+
+ // Delete top-menu link
+ if (class_exists('MenuTopLinks'))
+ {
+ $shop_id = (int)Shop::getContextShopID();
+ $shop_group_id = Shop::getGroupFromShop($shop_id);
+ $conf = Configuration::get('MOD_BLOCKTOPMENU_ITEMS', null, $shop_group_id, $shop_id);
+
+ $id_linksmenutop = $this->addTopMenuLink();
+ MenuTopLinks::remove($id_linksmenutop, $shop_id);
+ Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', (string)str_replace(array('LNK'.$id_linksmenutop.',', 'LNK'.$id_linksmenutop), '', $conf),
+ false, $shop_group_id, $shop_id);
+ }
+
+ // Clear cache
+ $this->_clearCache('*');
+
+ return true;
+ }
+
+ public function deleteSpecificPrice()
+ {
+ $ids_flash_sale = FlashSale::getFlashSalesLite();
+ foreach ($ids_flash_sale as $id_flash_sale)
+ {
+ $flash_sale = new FlashSale((int)$id_flash_sale);
+ $flash_sale->deleteSpecificPrice();
+ }
+
+ return true;
+ }
+
+ public function uninstallDb()
+ {
+ $sql = array();
+ include(dirname(__FILE__).'/sql/uninstall.php');
+ foreach ($sql as $s)
+ if (!Db::getInstance()->execute($s))
+ return false;
+
+ return true;
+ }
+
+ public function uninstallConf()
+ {
+ Configuration::deleteByName('FLASHSALE_PAGE_TITLE');
+ Configuration::deleteByName('FLASHSALE_COUNTDOWN_STRING');
+ Configuration::deleteByName('FLASHSALE_PRODUCTS_NB');
+ Configuration::deleteByName('FLASHSALE_DEL_SPECIFICPRICE');
+ Configuration::deleteByName('FLASHSALE_DISPLAY_TOPMENU');
+
+ return true;
+ }
+
+ public function reset()
+ {
+ if (!$this->uninstall(false))
+ return false;
+ if (!$this->install(false))
+ return false;
+
+ return true;
+ }
+
+ public function getContent()
+ {
+ if (Tools::isSubmit('submitFlashSales'))
+ {
+ $this->updateConfigFieldsValues();
+
+ $topmenu = Module::getInstanceByName('blocktopmenu');
+ if ($topmenu && $topmenu->active)
+ $this->updateTopMenuDisplay();
+
+ $this->updateCssFile();
+
+ if (!count($this->_post_errors))
+ Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&conf=4&token='.Tools::getAdminTokenLite('AdminModules'));
+ else
+ foreach ($this->_post_errors as $err)
+ $this->_html .= $this->displayError($err);
+ }
+
+ if (version_compare(_PS_VERSION_, '1.6', '<'))
+ {
+ $this->_html .= '';
+ $this->_html .= $this->renderFlashSalesForm();
+ $this->_html .= '
';
+ }
+ else
+ $this->_html .= $this->renderFlashSalesForm();
+
+ return $this->_html;
+ }
+
+ public function renderFlashSalesForm()
+ {
+ $languages = Language::getLanguages();
+ $topmenu = Module::getInstanceByName('blocktopmenu');
+
+ $css_file = Tools::file_get_contents(_PS_MODULE_DIR_.$this->name.'/views/css/design.css');
+ $css_fields = $this->loadCssFields($css_file);
+
+ $this->context->smarty->assign(array(
+ 'languages' => Language::getLanguages(true, Context::getContext()->shop->id),
+ 'default_language' => (int)Configuration::get('PS_LANG_DEFAULT'),
+ 'currentIndex' => $this->context->link->getAdminLink('AdminModules', true).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name,
+ 'currentToken' => Tools::getAdminTokenLite('AdminModules'),
+ 'css_file' => $css_file,
+ 'css_fields' => $css_fields,
+ 'topmenu' => (bool)($topmenu && $topmenu->active),
+ 'tpl_general' => _PS_MODULE_DIR_.$this->name.'/views/templates/admin/settings/general.tpl',
+ 'tpl_display' => _PS_MODULE_DIR_.$this->name.'/views/templates/admin/settings/display.tpl',
+ 'tpl_css' => _PS_MODULE_DIR_.$this->name.'/views/templates/admin/settings/css.tpl',
+ ));
+
+ if (version_compare(_PS_VERSION_, '1.6', '<'))
+ {
+ $this->context->controller->addCss($this->_path.'views/css/admin-theme.css', 'all');
+ $this->context->controller->addJS(array(
+ _MODULE_DIR_.'flashsales/views/js/tools/bootstrap.js',
+ _MODULE_DIR_.'flashsales/views/js/tools/jquery.autosize.js',
+ _MODULE_DIR_.'flashsales/views/js/tools/functions.js'
+ ));
+ }
+
+ $this->context->controller->addJqueryPlugin('colorpicker');
+ $this->context->controller->addJS(_MODULE_DIR_.$this->name.'/views/js/settings.js');
+
+ return $this->context->smarty->createTemplate(_PS_MODULE_DIR_.$this->name.'/views/templates/admin/settings/form.tpl', $this->context->smarty)->fetch();
+ }
+
+ protected function updateConfigFieldsValues()
+ {
+ $config = $this->getConfigFieldsValues();
+ foreach ($config as $key => $val)
+ {
+ if (is_array($val) && count($val))
+ foreach ($val as $v)
+ if (!Validate::isCleanHTML($v))
+ {
+ $this->_post_errors[] = sprintf($this->l('Unvalid lang field : "%s"'), $key);
+ return false;
+ }
+
+ Configuration::updateValue($key, $val);
+ }
+ }
+
+ protected function loadCssFields($content)
+ {
+ if (empty($content))
+ return array();
+
+ $fields = array();
+ foreach ($this->_css_fields as $css_field)
+ {
+ $pos = stripos($content, $css_field['class']);
+ $pos = stripos($content, $css_field['property'], $pos);
+ $pos = stripos($content, ':', $pos);
+ $start = $pos + 1;
+ $end = stripos($content, ';', $start);
+ $output = Tools::substr($content, $start, $end - $start);
+
+ // replace pattern
+ $pattern = array('/px/', '/%/', '/inline-block/', '/solid/', '/none/');
+ $replace = array('', '', 1, 1, 0);
+ $output = preg_replace($pattern, $replace, $output);
+ // delete spaces
+ $output = trim($output);
+
+ $fields[$css_field['field']] = $output;
+ }
+
+ return $fields;
+ }
+
+ protected function updateCssFile()
+ {
+ $content = strip_tags(Tools::getValue('css_file'));
+ // replace correct end of line
+ $content = str_replace("\r\n", PHP_EOL, $content);
+ // Magic Quotes shall... not.. PASS!
+ if (_PS_MAGIC_QUOTES_GPC_)
+ $content = Tools::stripslashes($content);
+
+ if (Validate::isCleanHTML($content))
+ {
+ $path = _PS_MODULE_DIR_.$this->name.'/views/css/design.css';
+ if (!file_put_contents($path, $content))
+ $this->_post_errors[] = sprintf($this->l('File "%s" cannot be created'), dirname($path));
+ }
+ else
+ $this->_post_errors[] = $this->l('Your css cannot contain JavaScript code.');
+ }
+
+ protected function updateTopMenuDisplay()
+ {
+ $shop_id = (int)Shop::getContextShopID();
+ $shop_group_id = Shop::getGroupFromShop($shop_id);
+ $conf = Configuration::get('MOD_BLOCKTOPMENU_ITEMS', null, $shop_group_id, $shop_id);
+
+ $display = Tools::getValue('flashsale_display_topmenu');
+ Configuration::updateValue('FLASHSALE_DISPLAY_TOPMENU', (int)$display);
+
+ $id_linksmenutop = $this->addTopMenuLink();
+
+ if (!$display)
+ {
+ MenuTopLinks::remove($id_linksmenutop, $shop_id);
+ Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', (string)str_replace(array('LNK'.$id_linksmenutop.',', 'LNK'.$id_linksmenutop), '', $conf), false, $shop_group_id, $shop_id);
+ }
+ else
+ {
+ $menu_items = Tools::strlen($conf) ? explode(',', $conf) : array();
+ if (!in_array('LNK'.$id_linksmenutop, $menu_items))
+ $menu_items[] = 'LNK'.$id_linksmenutop;
+
+ Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', (string)implode(',', $menu_items), false, (int)$shop_group_id, (int)$shop_id);
+ }
+
+ return true;
+ }
+
+ protected function addTopMenuLink()
+ {
+ $id_linksmenutop = 0;
+ $labels = array();
+ $page_link = array();
+ $languages = Language::getLanguages();
+
+ foreach ($languages as $language)
+ {
+ $labels[(int)$language['id_lang']] = $language['iso_code'] == 'fr' ? 'Ventes Flash' : 'Flash Sales';
+ $page_link[(int)$language['id_lang']] = $this->context->link->getModuleLink($this->name, 'page', array(), null, (int)$language['id_lang']);
+
+ $links = MenuTopLinks::gets((int)$language['id_lang'], null, (int)Shop::getContextShopID());
+
+ foreach ($links as $link)
+ {
+ if ($link['link'] == $page_link[(int)$language['id_lang']])
+ {
+ $id_linksmenutop = (int)$link['id_linksmenutop'];
+ break 2;
+ }
+ }
+ }
+ if ($id_linksmenutop == 0)
+ {
+ MenuTopLinks::add($page_link, $labels, 0, (int)Shop::getContextShopID());
+ $id_linksmenutop = $this->addTopMenuLink();
+ }
+
+ return $id_linksmenutop;
+ }
+
+ public function getConfigFieldsValues()
+ {
+ $fields = array();
+ $languages = Language::getLanguages();
+ foreach ($languages as $language)
+ {
+ $fields['FLASHSALE_PAGE_TITLE'][$language['id_lang']] = Tools::getValue('flashsale_page_title_'.$language['id_lang'], Configuration::get('FLASHSALE_PAGE_TITLE', (int)$language['id_lang']));
+ $fields['FLASHSALE_COUNTDOWN_STRING'][$language['id_lang']] = Tools::getValue('flashsale_countdown_string_'.$language['id_lang'], Configuration::get('FLASHSALE_COUNTDOWN_STRING', (int)$language['id_lang']));
+ }
+ $fields['FLASHSALE_PRODUCTS_NB'] = (int)Tools::getValue('flashsale_products_nb', Configuration::get('FLASHSALE_PRODUCTS_NB'));
+ $fields['FLASHSALE_DEL_SPECIFICPRICE'] = (bool)Tools::getValue('flashsale_del_specificprice', Configuration::get('FLASHSALE_DEL_SPECIFICPRICE'));
+
+ return $fields;
+ }
+
+ public function hookActionAdminControllerSetMedia()
+ {
+ $this->context->controller->addCSS($this->_path.'views/css/admin-design.css', 'all');
+ }
+
+ public function hookHeader($params)
+ {
+ // TODO add to other hooks $this->_clearCache('*');
+ $this->context->controller->addJS($this->_path.'views/js/countdown.js');
+ $this->context->controller->addCSS($this->_path.'views/css/design.css', 'all');
+ $this->context->controller->addCSS($this->_path.'views/css/global.css', 'all');
+ }
+
+ public function hookActionObjectDeleteAfter($params)
+ {
+ $object = $params['object'];
+
+ if (get_class($object) === 'Product')
+ Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'flash_sale_products` WHERE `id_product` = '.(int)$object->id);
+ elseif (get_class($object) === 'Category')
+ Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'flash_sale_products` WHERE `id_category` = '.(int)$object->id);
+ elseif (get_class($object) === 'Manufacturer')
+ Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'flash_sale_products` WHERE `id_manufacturer` = '.(int)$object->id);
+ elseif (get_class($object) === 'SpecificPrice')
+ Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'flash_sale_specific_prices` WHERE `id_specific_price` = '.(int)$object->id);
+
+ $this->_clearCache('*');
+ return true;
+ }
+
+ public function hookdisplayHome($params)
+ {
+ if (!$this->isCached('home.tpl', $this->getCacheId('home')))
+ {
+ if (!isset(flashsales::$cache_flash_sales['home']))
+ {
+ $flash_sales = FlashSale::getFlashSales((int)$this->context->language->id, 'home');
+ if (is_array($flash_sales) && count($flash_sales))
+ {
+ foreach ($flash_sales as $key => $flash_sale)
+ {
+ if (!$this->getProducts('home', (int)$flash_sale['id_flash_sale']))
+ {
+ unset($flash_sales[$key]);
+ continue;
+ }
+ $banner = _PS_MODULE_DIR_.$this->name.'/views/img/banner/'.(int)$flash_sale['id_flash_sale'].'.jpg';
+ $flash_sales[$key]['banner'] = file_exists($banner) ? _MODULE_DIR_.$this->name.'/views/img/banner/'.(int)$flash_sale['id_flash_sale'].'.jpg' : false;
+ }
+
+ if (!count($flash_sales))
+ $flash_sales = false;
+ }
+ flashsales::$cache_flash_sales['home'] = $flash_sales;
+ }
+
+ if (flashsales::$cache_flash_sales['home'] === false)
+ return false;
+
+ $this->smarty->assign(array(
+ 'flash_sales' => flashsales::$cache_flash_sales['home'],
+ 'txt' => Configuration::get('FLASHSALE_COUNTDOWN_STRING', (int)$this->context->language->id),
+ 'tpl_countdown' => _PS_MODULE_DIR_.$this->name.'/views/templates/hook/countdown.tpl',
+ ));
+
+
+ }
+
+ return $this->display(__FILE__, 'home.tpl', $this->getCacheId('home'));
+ }
+
+ public function hookDisplayHomeTab($params)
+ {
+ if (version_compare(_PS_VERSION_, '1.6', '<'))
+ return false;
+
+ if (!$this->isCached('home-tab.tpl', $this->getCacheId('home-tab')))
+ {
+ if (!isset(flashsales::$cache_flash_sales['home_tab']))
+ flashsales::$cache_flash_sales['home_tab'] = $this->getProducts('home_tab');
+
+ if (flashsales::$cache_flash_sales['home_tab'] === false)
+ return false;
+ }
+
+ return $this->display(__FILE__, 'home-tab.tpl', $this->getCacheId('home-tab'));
+ }
+
+ public function hookdisplayHomeTabContent($params)
+ {
+ if (version_compare(_PS_VERSION_, '1.6', '<'))
+ return false;
+
+ if (!$this->isCached('home-tab-content.tpl', $this->getCacheId('home-tab-content')))
+ {
+ if (!isset(flashsales::$cache_flash_sales['home_tab']))
+ flashsales::$cache_flash_sales['home_tab'] = $this->getProducts('home_tab');
+
+ if (flashsales::$cache_flash_sales['home_tab'] === false)
+ return false;
+
+ $this->smarty->assign(array(
+ 'flash_sales' => flashsales::$cache_flash_sales['home_tab'],
+ 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
+ ));
+ }
+
+ return $this->display(__FILE__, 'home-tab-content.tpl', $this->getCacheId('home-tab-content'));
+ }
+
+ public function hookRightColumn($params)
+ {
+ if (!$this->isCached('column.tpl', $this->getCacheId('column')))
+ {
+ if (!isset(flashsales::$cache_flash_sales['column']))
+ flashsales::$cache_flash_sales['column'] = $this->getProducts('column');
+
+ if (flashsales::$cache_flash_sales['column'] === false)
+ return false;
+
+ $this->smarty->assign(array(
+ 'flash_sales' => flashsales::$cache_flash_sales['column'],
+ 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
+ 'smallSize' => Image::getSize(ImageType::getFormatedName('small')),
+ 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
+ ));
+ }
+ return $this->display(__FILE__, 'column.tpl', $this->getCacheId('column'));
+ }
+
+ public function hookLeftColumn($params)
+ {
+ return $this->hookRightColumn($params);
+ }
+
+ public function hookDisplayProductListReviews($params)
+ {
+ if(is_object($params['product'])) {
+ $params['product'] = (array) $params['product'];
+ }
+
+ $id_product = (int)$params['product']['id_product'];
+ if (!($specific_price = FlashSale::getProductSpecificPrice($id_product)))
+ return;
+
+ $this->smarty->assign(array(
+ 'to' => (int)strtotime($specific_price['to']),
+ 'txt' => Configuration::get('FLASHSALE_COUNTDOWN_STRING', (int)$this->context->language->id),
+ 'id_product' => $id_product
+ ));
+
+ return $this->display(__FILE__, 'countdown.tpl');
+ }
+
+ public function hookDisplayRightColumnProduct($params)
+ {
+ if (!isset($params['product']['id_product']))
+ $params['product']['id_product'] = (int)Tools::getValue('id_product');
+
+ return $this->hookDisplayProductListReviews($params);
+ }
+
+ public function getProducts($filter = null, $id_flash_sale = null)
+ {
+ if (Configuration::get('PS_CATALOG_MODE'))
+ return false;
+
+ $nb = (int)Configuration::get('FLASHSALE_PRODUCTS_NB');
+ return FlashSale::getAllProducts((int)$this->context->language->id, $id_flash_sale, $filter, false, 0, ($nb ? $nb : 8));
+ }
+
+ public function _clearCache($template, $cache_id = null, $compile_id = null)
+ {
+ Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('homefeatured.tpl'));
+ parent::_clearCache('column.tpl', 'column');
+ parent::_clearCache('home-tab-content.tpl', 'home-tab-content');
+ parent::_clearCache('home-tab.tpl', 'home-tab');
+ parent::_clearCache('home.tpl', 'home');
+ }
+}
+?>
diff --git a/modules/flashsales/views/img/banner/1.jpg b/modules/flashsales/views/img/banner/1.jpg
index 582ec0a5..167164d8 100644
Binary files a/modules/flashsales/views/img/banner/1.jpg and b/modules/flashsales/views/img/banner/1.jpg differ
diff --git a/modules/flashsales/views/img/banner/default.jpg b/modules/flashsales/views/img/banner/default.jpg
new file mode 100644
index 00000000..4ce7a8a7
Binary files /dev/null and b/modules/flashsales/views/img/banner/default.jpg differ
diff --git a/modules/flashsales/views/templates/front/page.tpl b/modules/flashsales/views/templates/front/page.tpl
index 135cd722..3fbbde9d 100644
--- a/modules/flashsales/views/templates/front/page.tpl
+++ b/modules/flashsales/views/templates/front/page.tpl
@@ -1,92 +1,92 @@
-{*
-* 2014 Agencya
-*
-* NOTICE OF LICENSE
-*
-* The source code of this module is under a commercial license.
-* Each license is unique and can be installed and used on only one shop.
-* Any reproduction or representation total or partial of the module, one or more of its components,
-* by any means whatsoever, without express permission from us is prohibited.
-* If you have not received this module from us, thank you for contacting us.
-*
-* DISCLAIMER
-*
-* Do not edit or add to this file if you wish to upgrade this module to newer
-* versions in the future.
-*
-* @author Agencya
-* @copyright 2014 - Agencya SARL
-* @license commercial
-* International Registered Trademark & Property of Agencya SARL
-*}
-
-{capture name=path}{l s='Flash sales' mod='flashsales'}{/capture}
-{if version_compare($smarty.const._PS_VERSION_,'1.6','<')}
- {include file="$tpl_dir./breadcrumb.tpl"}
-{/if}
-
-
-
{$name|escape:'html':'UTF-8'}
- {if $flash_sales && count($flash_sales)}
-
- {foreach from=$flash_sales item=flash_sale}
-
-
-
- {/foreach}
-
- {/if}
-
- {if $products && count($products)}
-
- {if version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
- {include file="$tpl_dir./pagination.tpl"}
-
- {include file="$tpl_dir./product-sort.tpl"}
- {include file="$tpl_dir./product-compare.tpl"}
- {include file="$tpl_dir./nbr-product-page.tpl"}
-
- {else}
-
- {include file="$tpl_dir./product-sort.tpl"}
- {include file="$tpl_dir./nbr-product-page.tpl"}
-
-
- {/if}
-
-
- {include file="$tpl_dir./product-list.tpl" products=$products}
-
-
- {if version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
-
- {include file="$tpl_dir./product-sort.tpl" paginationId='bottom'}
- {include file="$tpl_dir./product-compare.tpl" paginationId='bottom'}
- {include file="$tpl_dir./nbr-product-page.tpl" paginationId='bottom'}
-
- {include file="$tpl_dir./pagination.tpl" paginationId='bottom'}
- {else}
-
- {/if}
-
- {else}
-
{l s='No flash sales at this time.' mod='flashsales'}
- {/if}
-
+{*
+* 2014 Agencya
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+
+{capture name=path}{l s='Flash sales' mod='flashsales'}{/capture}
+{if version_compare($smarty.const._PS_VERSION_,'1.6','<')}
+ {include file="$tpl_dir./breadcrumb.tpl"}
+{/if}
+
+
+
{$name|escape:'html':'UTF-8'}
+ {if $flash_sales && count($flash_sales)}
+
+ {foreach from=$flash_sales item=flash_sale}
+
+
+
+ {/foreach}
+
+ {/if}
+
+ {if $products && count($products)}
+
+ {if version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
+ {include file="$tpl_dir./pagination.tpl"}
+
+ {include file="$tpl_dir./product-sort.tpl"}
+ {include file="$tpl_dir./product-compare.tpl"}
+ {include file="$tpl_dir./nbr-product-page.tpl"}
+
+ {else}
+
+ {include file="$tpl_dir./product-sort.tpl"}
+ {include file="$tpl_dir./nbr-product-page.tpl"}
+
+
+ {/if}
+
+
+ {include file="$tpl_dir./product-list.tpl" products=$products}
+
+
+ {if version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
+
+ {include file="$tpl_dir./product-sort.tpl" paginationId='bottom'}
+ {include file="$tpl_dir./product-compare.tpl" paginationId='bottom'}
+ {include file="$tpl_dir./nbr-product-page.tpl" paginationId='bottom'}
+
+ {include file="$tpl_dir./pagination.tpl" paginationId='bottom'}
+ {else}
+
+ {/if}
+
+ {else}
+
{l s='No flash sales at this time.' mod='flashsales'}
+ {/if}
+
diff --git a/themes/toutpratique/category.tpl b/themes/toutpratique/category.tpl
index 3fca1bc7..9fb2a200 100644
--- a/themes/toutpratique/category.tpl
+++ b/themes/toutpratique/category.tpl
@@ -11,17 +11,14 @@
diff --git a/themes/toutpratique/css/global.css b/themes/toutpratique/css/global.css
index de38c48f..16e3be7a 100644
--- a/themes/toutpratique/css/global.css
+++ b/themes/toutpratique/css/global.css
@@ -355,7 +355,7 @@ body.content_only { margin: 0 }
background-color: #f5f0f1;
padding: 45px 30px 45px 0;
overflow: hidden;
- height: 265px;
+ height: 290px;
}
#constructorLink div .inner.small-title { padding: 30px }
#constructorLink div .inner .img { width: 168px; height: 100%;position: relative; float: left;}
@@ -393,20 +393,16 @@ body.content_only { margin: 0 }
padding: 5px 15%;
margin: 0 0 30px 0;
}
- #index #best_sales .product-container .border { height: 292px }
- #index #best_sales .product-container .short_desc { height: 60px }
@media(max-width: 1199px) {
#constructorLink div .inner { height: 325px; }
#constructorLink div .inner p { height: 95px }
#constructorLink .btn { margin-top: 15px; }
- #index #best_sales .product-container .border { height: 325px }
}
@media(max-width: 990px) {
#constructorLink div .inner .img { width: 120px; }
#constructorLink div .inner .img img { left: -30px; }
#constructorLink div .inner { height: 350px; }
- #index #best_sales .product-container .border { height: 350px }
}
@media(max-width: 767px) {
#constructorLink .title { font-size: 30px; }
@@ -2529,21 +2525,36 @@ main#categorycms { margin-bottom: 30px }
max-width: 90px;
}
#postedito .pack_content .content_product .link_name {
+ color: #666666;
+ display: block;
font-family: 'pt_sansbold';
font-weight: normal;
- color: #666666;
font-size: 16px;
+ line-height: 18px;
+ margin-bottom: 15px;
}
#postedito .pack_content .content_product {
border-left: 1px solid #dfdfdf;
- padding: 25px;
+ padding: 15px;
}
#postedito .pack_content .content_product .price {
color: #e4535d;
font-family: 'vidaloka';
font-size: 24px;
letter-spacing: -1px;
+ line-height: 18px;
}
+ #postedito .pack_content .content_product .product-flashsale .flashsale-countdown-box {
+ background: #6ac5bb;
+ color: #fff;
+ font-family: 'pompiere_regular';
+ font-size: 18px;
+ margin-bottom: 15px;
+ padding: 7px 10px 5px 10px;
+ }
+ #postedito .pack_content .content_product .product-flashsale .flashsale-countdown-box i {
+ margin-right: 5px;
+ }
#postcms .pack_content .image img {
margin: 0 auto;
}
@@ -2568,14 +2579,15 @@ main#categorycms { margin-bottom: 30px }
}
#postedito .price-percent-reduction {
background: url(../img/reduction.png) no-repeat top left;
+ color: #000;
font-size: 16px;
font-weight: bold;
line-height: 57px;
padding-left: 9px;
position: absolute;
text-align: left;
- left: 15px;
- top: 0;
+ left: -1px;
+ top: -1px;
height: 120px;
width: 106px;
z-index: 1;
@@ -4121,6 +4133,19 @@ main#categorycms { margin-bottom: 30px }
}
#send_friend_form .submit #sendEmail{ margin-left: 5px;}
+/* Flashsales */
+#product .netReViewsWrap .flashsale-countdown-box {
+ background: #6ac5bb;
+ color: #fff;
+ font-family: 'pompiere_regular';
+ font-size: 20px;
+ margin-top: 30px;
+ padding: 7px 15px 5px 15px;
+}
+ #product .netReViewsWrap .flashsale-countdown-box i {
+ margin-right: 5px;
+ }
+
@media (max-width: 1199px) {
/*#product .pictos .picto { text-align: center;}*/
@@ -7645,3 +7670,37 @@ div.languages>span{
#gototop.active { left: 50px }
#gototop:hover { opacity: 1 }
+
+
+/*************************************************************************************************************
+************************************** FLASHSALES ***************************************
+**************************************************************************************************************/
+#module-flashsales-page {
+}
+ #module-flashsales-page .page-heading .header {
+ background-size: cover;
+ background-position: center top;
+ margin-bottom: 30px;
+ padding: 30px;
+ }
+ #module-flashsales-page .page-heading .header .content {
+ background-color: #fff;
+ color: #666;
+ padding: 20px;
+ border: 0;
+ width: 50%;
+
+ }
+ #module-flashsales-page .page-heading .header .content h1 {
+ color: #4d4d4d;
+ margin-top: 0;
+ }
+ #module-flashsales-page .page-heading .header .content .description {
+ margin-bottom: 10px;
+ }
+@media (max-width: 991px) {
+ #module-flashsales-page .page-heading .header .content { width: 75% }
+}
+@media (max-width: 768px) {
+ #module-flashsales-page .page-heading .header .content { width: 100% }
+}
\ No newline at end of file
diff --git a/themes/toutpratique/css/k2000.css b/themes/toutpratique/css/k2000.css
index d0f5b8bc..6207580d 100644
--- a/themes/toutpratique/css/k2000.css
+++ b/themes/toutpratique/css/k2000.css
@@ -255,7 +255,9 @@ span.title {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
-
+.icon-flashsale:before {
+ content: "\e90f";
+}
.icon-youtube:before {
content: "\e900";
}
@@ -495,16 +497,15 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
#breadcrumbs .breadcrumb_item a {
font-weight: bold;
}
- #breadcrumbs .breadcrumb_item:after {
+ #breadcrumbs .breadcrumb_item a:after {
content:'.';
+ display: inline-block;
+ font-weight: normal;
font-size: 22px;
- margin-left: 0px;
+ margin-left: 5px;
position: relative;
top: -3px;
}
- #breadcrumbs span{ margin-left: 10px;}
- #breadcrumbs .breadcrumb_item{ margin-left: 0; }
- #breadcrumbs a:last-child:after{ content:'';}
/* BLOCK PRODUIT */
@@ -740,7 +741,7 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
background-color: #efefef;
border: 1px solid #efefef;
padding: 5px 15px 10px 15px;
- margin-bottom: 15px;
+ margin-bottom: 10px;
}
.column.bloc.product-container .avail .inner { padding: 0; margin: 0;}
.bloc.product-container .avail i {
@@ -787,7 +788,7 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
}
.bloc.product-container .product-actions > div:first-child {
- margin-top: 15px;
+ margin-top: 10px;
}
.column.bloc.product-container .product-actions > div:first-child {
@@ -795,11 +796,11 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
}
.bloc.product-container .short_desc {
margin-top: 5px;
- height: 40px;
+ height: 38px;
font-size: 14px;
line-height: 16px;
}
- .column.bloc.product-container .short_desc { height: 85px; }
+ .column.bloc.product-container .short_desc { height: 74px; }
.bloc.product-container .short_desc * {
font-weight: normal;
@@ -822,6 +823,7 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
font-size: 16px;
height: auto;
margin-bottom: 2px;
+ margin-top: 0;
height: 18px;
overflow: hidden;
}
@@ -881,32 +883,46 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
}
.column.bloc.product-container .border {
- height: 412px;
+ height: 370px;
}
/* height if column or not */
.bloc.product-container .wrapImg {
height: 227px;
}
.bloc.product-container .border {
- height: 265px;
+ height: 290px;
}
.column.bloc.product-container .pictos { bottom: 0px; }
.column.bloc.product-container .wrapImg { min-height: 215px; height: auto;}
- .column.bloc.product-container .border { height: 363px; }
.column.bloc.product-container .featureConditioning .value { display: block;}
+
+ /* Flashsales */
+ .product-container .product-flashsale {
+ height: 40px;
+ }
+ .product-container .product-flashsale .flashsale-countdown-box {
+ background: #6ac5bb;
+ color: #fff;
+ font-family: 'pompiere_regular';
+ font-size: 20px;
+ padding: 7px 15px 5px 15px;
+ }
+ .product-container .product-flashsale .flashsale-countdown-box i {
+ margin-right: 5px;
+ }
/* /height */
@media (max-width: 1199px) {
- .bloc.product-container .featureConditioning { height: 32px; }
+ .bloc.product-container .featureConditioning { height: 45px; }
.bloc.product-container .featureConditioning .value { display: block;}
.bloc.product-container .product-infos h5.product-name { height: 37px; }
- .bloc.product-container .short_desc { height: 35px; }
+ .bloc.product-container .short_desc { height: 50px; }
.bloc.product-container .product-price.old-price, .bloc.product-container .product-price .price { float: none; width: 100%; max-width: none; padding: 0; }
.bloc.product-container .product-price.old-price { font-size: 13px; }
- .bloc.product-container .border { height: 300px; }
+ .bloc.product-container .border { height: 340px; }
.bloc.product-container .wrapImg { height: 242px; }
- .column.bloc.product-container .border { height: 375px; }
+ .column.bloc.product-container .border { height: 395px; }
.column.bloc.product-container .wrapImg { }
.column.bloc.product-container .avail .shipping { font-size: 13px; }
.column.bloc.product-container .product-price.old-price { padding-top: 0; }
@@ -918,10 +934,10 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
.bloc.product-container .product-infos h5.product-name { height: 52px; }
.bloc.product-container .product-img { max-height: 140px;}
.column.bloc.product-container .product-img { height: 140px;}
- .bloc.product-container .short_desc { height: 60px; }
+ .bloc.product-container .short_desc { height: 70px; }
.bloc.product-container .wrapImg { height: auto; }
- .bloc.product-container .border { height: 350px; }
- .column.bloc.product-container .border { height: 372px; }
+ .bloc.product-container .border { height: 380px; }
+ .column.bloc.product-container .border { height: 395px; }
.bloc.product-container .pictos { position: static; }
.column.bloc.product-container .pictos { position: absolute; }
@@ -932,23 +948,24 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
.bloc.product-container .product-img { }
.bloc.product-container .wrapImg { height: auto; }
.bloc.product-container .pictos { position: static;}
- .bloc.product-container .short_desc { height: 48px; }
+ .bloc.product-container .short_desc { height: 70px; }
.bloc.product-container .border { height: auto; }
.bloc.product-container .product-price { text-align: left; }
.column.bloc.product-container .border { height: 525px; }
.column.bloc.product-container .product-img { min-height: 200px; }
.column.bloc.product-container .short_desc { height: 60px; }
- .column.bloc.product-container .border {height: 370px; }
+ .column.bloc.product-container .border {height: 380px; }
.column.bloc.product-container .product-infos { height: auto; }
.column.bloc.product-container .avail { padding: 10px;}
.bloc.product-container .btnWrap { padding-left: 0; }
#category main .category_content { padding-right: 15px; padding-left: 15px; }
-
+ .column.bloc.product-container .product-flashsale .flashsale-countdown-box { font-size: 16px; }
}
@media (max-width: 620px) {
.column.bloc.product-container .avail .label-warning > span { font-size: 13px; }
.bloc.product-container .product-price.old-price .barre { display: block; }
+ .column.bloc.product-container .product-price.old-price .barre { display: inline; }
.bloc.product-container .wrapreviews, .bloc.product-container .featureConditioning,
.column.bloc.product-container .product-infos h5.product-name {
height: auto;
@@ -957,7 +974,7 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
.bloc.product-container .product-img, .column.bloc.product-container .product-img { min-height: 0;}
.bloc.product-container .btnWrap .btn { padding-left: 5px; }
- .column.bloc.product-container .wrapImg { min-height: 190px; }
+ .column.bloc.product-container .wrapImg { min-height: unset; }
.bloc.product-container .avail i { font-size: 21px; }
.bloc.product-container { width: 100%; }
.bloc.product-container .product-img img { height: auto; min-height: 0; max-height: 100px;}
@@ -968,7 +985,7 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
.bloc.product-container .product-img { width: 100%; }
.bloc.product-container .product-infos { position: static; height: auto; }
.bloc.product-container .product-infos h5.product-name, .bloc.product-container .short_desc, .bloc.product-container .border { height: auto;}
- .bloc.product-container .short_desc { margin-top: 10px;}
+ .bloc.product-container .short_desc { margin: 10px 0 15px 0;}
.bloc.product-container .product-price { height: auto; margin-bottom: 10px; }
.column.bloc.product-container .border, .column.bloc.product-container .short_desc, .column.bloc.product-container .product-infos, .column.bloc.product-container .wrapreviews { height: auto; }
.column.bloc.product-container .product-img { margin-bottom: 10px; }
@@ -982,6 +999,7 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
.crossseling {
display: none;
}
+ .column.bloc.product-container .product-flashsale .flashsale-countdown-box { font-size: 16px; }
}
diff --git a/themes/toutpratique/fonts/icomoon.eot b/themes/toutpratique/fonts/icomoon.eot
index cd621626..e7f3ca5b 100644
Binary files a/themes/toutpratique/fonts/icomoon.eot and b/themes/toutpratique/fonts/icomoon.eot differ
diff --git a/themes/toutpratique/fonts/icomoon.svg b/themes/toutpratique/fonts/icomoon.svg
index 9192fefc..e65f27ba 100644
--- a/themes/toutpratique/fonts/icomoon.svg
+++ b/themes/toutpratique/fonts/icomoon.svg
@@ -33,4 +33,5 @@
+
\ No newline at end of file
diff --git a/themes/toutpratique/fonts/icomoon.ttf b/themes/toutpratique/fonts/icomoon.ttf
index f51904e4..7eeaad3b 100644
Binary files a/themes/toutpratique/fonts/icomoon.ttf and b/themes/toutpratique/fonts/icomoon.ttf differ
diff --git a/themes/toutpratique/fonts/icomoon.woff b/themes/toutpratique/fonts/icomoon.woff
index 9d36bea0..c2bd3767 100644
Binary files a/themes/toutpratique/fonts/icomoon.woff and b/themes/toutpratique/fonts/icomoon.woff differ
diff --git a/themes/toutpratique/fonts/icomoon.woff2 b/themes/toutpratique/fonts/icomoon.woff2
index 747a173d..1431682b 100644
Binary files a/themes/toutpratique/fonts/icomoon.woff2 and b/themes/toutpratique/fonts/icomoon.woff2 differ
diff --git a/themes/toutpratique/modules/flashsales/views/index.php b/themes/toutpratique/modules/flashsales/views/index.php
new file mode 100644
index 00000000..077b8f20
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/index.php
@@ -0,0 +1,32 @@
+
+
+
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/form/form.tpl b/themes/toutpratique/modules/flashsales/views/templates/admin/form/form.tpl
new file mode 100644
index 00000000..40a88e31
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/form/form.tpl
@@ -0,0 +1,484 @@
+{*
+* 2014 - Agencya SARL
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+
+
+
+{if version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
+{include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
+
+{/if}
+
+{if version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
+
+{/if}
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/form/index.php b/themes/toutpratique/modules/flashsales/views/templates/admin/form/index.php
new file mode 100644
index 00000000..077b8f20
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/form/index.php
@@ -0,0 +1,32 @@
+
+
+
+
{$item.name|truncate:40:'...'|escape:'html':'UTF-8'}
+
+
+ {l s='Custom price' mod='flashsales'}
+
+
+
+
+
+
+
+
+
{l s='Products' mod='flashsales'} : {$item.nb_products|intval}
+
+
+ {l s='Reduction' mod='flashsales'} :
+
+
+
+
+
+ {$item.products}{* HTML, cannot escape *}
+
+
+
+
+ {/if}
+{/foreach}
+{/if}
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/form/product-card.tpl b/themes/toutpratique/modules/flashsales/views/templates/admin/form/product-card.tpl
new file mode 100644
index 00000000..ef776cef
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/form/product-card.tpl
@@ -0,0 +1,63 @@
+{*
+* 2014 - Agencya SARL
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+
+{if isset($products) && $products}
+{foreach from=$products item=prod}
+
+
+
+
{$prod.name|truncate:40:'...'|escape:'html':'UTF-8'}
+
+
+ {l s='Custom price' mod='flashsales'}
+
+
+
+
+
+
+
+
+
{l s='Reference' mod='flashsales'} : {$prod.reference|escape:'html':'UTF-8'}
+
{l s='Stock' mod='flashsales'} : {$prod.stock[0]|intval}
+
{l s='Price' mod='flashsales'} : {$prod.formatted_price|escape:'html':'UTF-8'}
+
+
+ {l s='Reduction' mod='flashsales'} :
+
+
+
+
+
+
+
+{/foreach}
+{/if}
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/index.php b/themes/toutpratique/modules/flashsales/views/templates/admin/index.php
new file mode 100644
index 00000000..077b8f20
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/index.php
@@ -0,0 +1,32 @@
+
+
+ {l s='Countdown box' mod='flashsales'}
+
+
+
+
+
+ {l s='Width' mod='flashsales'}
+
+ {l s='%' mod='flashsales'}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/settings/display.tpl b/themes/toutpratique/modules/flashsales/views/templates/admin/settings/display.tpl
new file mode 100644
index 00000000..98c82556
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/settings/display.tpl
@@ -0,0 +1,124 @@
+{*
+* 2014 - Agencya SARL
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+
+
+{if $topmenu}
+
+{/if}
+
+
+
+
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/settings/form.tpl b/themes/toutpratique/modules/flashsales/views/templates/admin/settings/form.tpl
new file mode 100644
index 00000000..da43b9b5
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/settings/form.tpl
@@ -0,0 +1,55 @@
+{*
+* 2014 - Agencya SARL
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+
+
+
+
+
+
+ {l s='General' mod='flashsales'}
+
+ {include file="$tpl_general"}
+
+
+
+
+ {l s='Display' mod='flashsales'}
+
+ {include file="$tpl_display"}
+
+
+
+
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/settings/general.tpl b/themes/toutpratique/modules/flashsales/views/templates/admin/settings/general.tpl
new file mode 100644
index 00000000..74ee78ac
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/settings/general.tpl
@@ -0,0 +1,38 @@
+{*
+* 2014 - Agencya SARL
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+
+
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/settings/index.php b/themes/toutpratique/modules/flashsales/views/templates/admin/settings/index.php
new file mode 100644
index 00000000..077b8f20
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/settings/index.php
@@ -0,0 +1,32 @@
+
+
+
+
+ {if isset($multiple) && $multiple}{l s='Add files...' mod='flashsales'}{else}{l s='Add file...' mod='flashsales'}{/if}
+
+
+
+
+
+
+ {if isset($multiple) && $multiple}{l s='Upload files' mod='flashsales'}{else}{l s='Upload file' mod='flashsales'}{/if}
+
+
+
+
+
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/uploader/index.php b/themes/toutpratique/modules/flashsales/views/templates/admin/uploader/index.php
new file mode 100644
index 00000000..51f6473c
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/uploader/index.php
@@ -0,0 +1,32 @@
+ 0}
+ {assign var='show_thumbnail' value=false}
+ {foreach $files as $file}
+ {if isset($file.image) && $file.type == 'image'}
+ {assign var='show_thumbnail' value=true}
+ {/if}
+ {/foreach}
+{if $show_thumbnail}
+
+{/if}
+{/if}
+{if isset($max_files) && $files|count >= $max_files}
+
+
{l s='You have reached the limit (%s) of files to upload, please remove files to continue uploading' sprintf=$max_files mod='flashsales'}
+
+{else}
+
+
+{/if}
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/view/dashboard.tpl b/themes/toutpratique/modules/flashsales/views/templates/admin/view/dashboard.tpl
new file mode 100644
index 00000000..17255c85
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/view/dashboard.tpl
@@ -0,0 +1,53 @@
+{*
+* 2014 - Agencya SARL
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+{if version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
+ {include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
+
+{/if}
+
+
+
+
+
+ {l s='Dashboard' mod='flashsales'}
+
+
+
+ {if isset($flash_sales) && count($flash_sales)}
+ {foreach from=$flash_sales key=id item=flash_sale}
+ {include file="$tpl_list" id=$id flash_sale=$flash_sale}
+ {/foreach}
+ {/if}
+
+
+
+
+
+{if version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
+
+{/if}
diff --git a/themes/toutpratique/modules/flashsales/views/templates/admin/view/index.php b/themes/toutpratique/modules/flashsales/views/templates/admin/view/index.php
new file mode 100644
index 00000000..077b8f20
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/admin/view/index.php
@@ -0,0 +1,32 @@
+
+
+
+ {if isset($flash_sale.content) && count($flash_sale.content)}
+ {$flash_sale.content}{* HTML, cannot escape *}
+ {/if}
+
+
+
diff --git a/themes/toutpratique/modules/flashsales/views/templates/front/index.php b/themes/toutpratique/modules/flashsales/views/templates/front/index.php
new file mode 100644
index 00000000..077b8f20
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/front/index.php
@@ -0,0 +1,32 @@
+getModuleLink('flashsales', 'page')|escape:'quotes':'UTF-8'}">{$pageTitle}
+ {$name|escape:'html':'UTF-8'}
+ {else}
+ {$name|escape:'html':'UTF-8'}
+ {/if}
+{/capture}
+
+
+
+
+
+
+ {include file="$tpl_dir./breadcrumb.tpl"}
+
+
+
+
+
+ {if $products && count($products)}
+
+
+ {include file="$tpl_dir./product-list-blocs.tpl" products=$products}
+
+
+ {include file="$tpl_dir./pagination.tpl"}
+ {else}
+ {l s='No flash sales at this time.' mod='flashsales'}
+ {/if}
+
+
+
+
+
\ No newline at end of file
diff --git a/themes/toutpratique/modules/flashsales/views/templates/hook/column.tpl b/themes/toutpratique/modules/flashsales/views/templates/hook/column.tpl
new file mode 100644
index 00000000..2804f3a1
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/hook/column.tpl
@@ -0,0 +1,67 @@
+{*
+* 2014 Agencya
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+
+
+
+
+
+ {if $flash_sales && $flash_sales|@count > 0}
+
+ {foreach from=$flash_sales item=product name=myLoop}
+
+
+
+
+
+
+
{$product.description_short|strip_tags:'UTF-8'|truncate:40:'...'|escape:'html':'UTF-8'}
+ {if !$PS_CATALOG_MODE}
+
+ {if !$priceDisplay}{displayWtPrice p=$product.price|floatval}{else}{displayWtPrice p=$product.price_tax_exc|floatval}{/if}
+ {if $product.specific_prices}
+ {assign var='specific_price' value=$product.specific_prices}
+ {if $specific_price.reduction_type == 'percentage' && ($specific_price.from == $specific_price.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_price.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_price.from))}
+ -{$specific_price.reduction*100|floatval}%
+ {/if}
+ {/if}
+ {displayWtPrice p=$product.price_without_reduction}
+
+ {/if}
+
+
+ {/foreach}
+
+
+ {else}
+
{l s='No flash sales at this time.' mod='flashsales'}
+ {/if}
+
+
+
diff --git a/themes/toutpratique/modules/flashsales/views/templates/hook/countdown.tpl b/themes/toutpratique/modules/flashsales/views/templates/hook/countdown.tpl
new file mode 100644
index 00000000..b2887966
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/hook/countdown.tpl
@@ -0,0 +1,11 @@
+
+
+
+
+ j
+ h
+ m
+ s
+
+
+
diff --git a/themes/toutpratique/modules/flashsales/views/templates/hook/home-tab-content.tpl b/themes/toutpratique/modules/flashsales/views/templates/hook/home-tab-content.tpl
new file mode 100644
index 00000000..e628854f
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/hook/home-tab-content.tpl
@@ -0,0 +1,28 @@
+{*
+* 2014 Agencya
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2015 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+{if isset($flash_sales) && $flash_sales}
+{include file="$tpl_dir./product-list.tpl" products=$flash_sales class='flashsales tab-pane' id='flashsales'}
+{else}
+
+ {l s='No flash sales at this time.' mod='flashsales'}
+
+{/if}
diff --git a/themes/toutpratique/modules/flashsales/views/templates/hook/home-tab.tpl b/themes/toutpratique/modules/flashsales/views/templates/hook/home-tab.tpl
new file mode 100644
index 00000000..1cf7550c
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/hook/home-tab.tpl
@@ -0,0 +1,22 @@
+{*
+* 2014 Agencya
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+{l s='Flash Sales' mod='flashsales'}
diff --git a/themes/toutpratique/modules/flashsales/views/templates/hook/home.tpl b/themes/toutpratique/modules/flashsales/views/templates/hook/home.tpl
new file mode 100644
index 00000000..d47cd8d3
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/hook/home.tpl
@@ -0,0 +1,68 @@
+{*
+* 2014 Agencya
+*
+* NOTICE OF LICENSE
+*
+* The source code of this module is under a commercial license.
+* Each license is unique and can be installed and used on only one shop.
+* Any reproduction or representation total or partial of the module, one or more of its components,
+* by any means whatsoever, without express permission from us is prohibited.
+* If you have not received this module from us, thank you for contacting us.
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future.
+*
+* @author Agencya
+* @copyright 2014 - Agencya SARL
+* @license commercial
+* International Registered Trademark & Property of Agencya SARL
+*}
+
+{if isset($flash_sales) && count($flash_sales)}
+
+ {foreach from=$flash_sales item=flash_sale}
+
+
+
+
+
+
+
+
+
+ {include file="{$tpl_countdown}" to=$flash_sale.to|strtotime|intval}
+
+
+
+
+
+
+
+
+
+ {/foreach}
+
+{/if}
diff --git a/themes/toutpratique/modules/flashsales/views/templates/hook/index.php b/themes/toutpratique/modules/flashsales/views/templates/hook/index.php
new file mode 100644
index 00000000..077b8f20
--- /dev/null
+++ b/themes/toutpratique/modules/flashsales/views/templates/hook/index.php
@@ -0,0 +1,32 @@
+
{if $product_relation}
-
@@ -51,11 +50,17 @@
{assign var='product' value=$product_relation.0}
{assign var='id_image' value=Product::getCover($product->id)}
+ {assign var=percentReduction value=0}
+ {if isset($product->price_without_reduction) && isset($product->price) && $product->price != round($product->price_without_reduction, 2)}
+ {math equation="round(100 - (price * 100 / price_without_reduction))" price=$product->price price_without_reduction=$product->price_without_reduction assign=percentReduction}
+ {/if}
- {if $product->specific_prices.reduction_type == 'percentage'}
-
-{$product->specific_prices.reduction * 100}%
+ {if $percentReduction}
+
+ -{$percentReduction}%
+
{/if}
@@ -63,15 +68,20 @@
{$product->name}
+
+
+ {hook h="displayProductListReviews" product=$product}
+
+
{displayPrice price=$product->price}
+
{if isset($product->specific_prices) && $product->specific_prices && isset($product->specific_prices.reduction) && $product->specific_prices.reduction > 0}
{l s='au lieu de'} {displayWtPrice p=$product->price_without_reduction}
{/if}
-
{l s='J\'achete'}
@@ -84,7 +94,6 @@
{l s='Livraison express'}
-
diff --git a/themes/toutpratique/product-list-blocs.tpl b/themes/toutpratique/product-list-blocs.tpl
index d6a5eb46..2f7862b0 100644
--- a/themes/toutpratique/product-list-blocs.tpl
+++ b/themes/toutpratique/product-list-blocs.tpl
@@ -17,9 +17,9 @@
- {if $product.specific_prices.reduction_type == 'percentage'}
+ {if $percentReduction}
- -{$product.specific_prices.reduction * 100}%
+ -{$percentReduction}%
{/if}
@@ -56,7 +56,11 @@
- {$product.description_short|strip_tags|truncate:90}
+ {$product.description_short|strip_tags|truncate:70}
+
+
+
+ {hook h="displayProductListReviews" product=$product}
diff --git a/themes/toutpratique/product-list.tpl b/themes/toutpratique/product-list.tpl
index 43806f11..054a8649 100644
--- a/themes/toutpratique/product-list.tpl
+++ b/themes/toutpratique/product-list.tpl
@@ -17,9 +17,9 @@
- {if $product.specific_prices.reduction_type == 'percentage'}
+ {if $percentReduction}
- -{$product.specific_prices.reduction * 100}%
+ -{$percentReduction}%
{/if}
@@ -54,101 +54,99 @@
{$product.description_short|strip_tags|truncate:120}
-
+
+ {hook h="displayProductListReviews" product=$product}
+
+
+
-
-
- {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
-
- {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
-
-
-
- {if (isset($product.allow_oosp) && $product.allow_oosp || $product.quantity > 0)}
-
-
-
- {if $product.quantity <= 0}
- {if $product.allow_oosp}
- {if isset($product.available_later) && $product.available_later}
- {l s='En réassort'}
- {$product.available_later}
- {else}
- {l s='En réassort'}
- Expédition sous 15 jours
- {/if}
- {/if}
- {else}
-
- {l s='En stock'}
- Expédition sous 48h
-
- {/if}
- {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
-
- {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
-
- {l s='Product available with different options'}
+
+
+ {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
+
+ {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
+
+
+
+ {if (isset($product.allow_oosp) && $product.allow_oosp || $product.quantity > 0)}
+
+
+ {if $product.quantity <= 0}
+ {if $product.allow_oosp}
+ {if isset($product.available_later) && $product.available_later}
+ {l s='En réassort'}
+ {$product.available_later}
{else}
-
- {l s='Out of stock'}
+ {l s='En réassort'}
+ Expédition sous 15 jours
{/if}
-
-
- {/if}
-
- {/if}
-
-
-
-
- {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
-
- {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
-
- {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
-
- {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
- {hook h="displayProductPriceBlock" product=$product type="old_price"}
-
- {l s='au lieu de'} {displayWtPrice p=$product.price_without_reduction}
-
{/if}
-
+ {else}
+ {l s='En stock'}
+ Expédition sous 48h
{/if}
-
+ {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
+
+ {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
+
+ {l s='Product available with different options'}
+ {else}
+
+
{l s='Out of stock'}
{/if}
-
-
-
-
-
+
+ {/if}
+
+ {/if}
+
+
+
+
+ {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
+
+ {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
+
+ {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
+
+ {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
+ {hook h="displayProductPriceBlock" product=$product type="old_price"}
+
+ {l s='au lieu de'} {displayWtPrice p=$product.price_without_reduction}
+
+ {/if}
+
+ {/if}
+
+ {/if}
+
-
-
+
+
+
+
+
+
{/if}
{/foreach}
diff --git a/themes/toutpratique/product.tpl b/themes/toutpratique/product.tpl
index 272bc934..7a191db2 100644
--- a/themes/toutpratique/product.tpl
+++ b/themes/toutpratique/product.tpl
@@ -158,14 +158,12 @@
{l s='Lire la suite'}
{/if}
-
-
{/if}
{/if}
{hook h='displayPictogrammesProduct' id_product=$product->id}
- {$HOOK_EXTRA_RIGHT}
+ {$HOOK_EXTRA_RIGHT}