Merge branch 'ticket-8048' into develop

This commit is contained in:
Marion Muszynski 2016-09-19 12:42:21 +02:00
commit 5aac7f617b
14 changed files with 1875 additions and 43 deletions

View File

@ -1,4 +1,5 @@
<script type="text/javascript">
{literal}
function hideExpressCart(event){
@ -15,18 +16,21 @@ function hideExpressCart(event){
function showExpressCart(event) {
var m = $(event.target);
var expresscart_frame_visible = m.parents('.slider_sales_product_footer').next('.expresscart_frame:visible');
var expresscart_frame = m.parents('.slider_sales_product_footer').next('.expresscart_frame');
m.toggleClass('active');
if($(".expresscart_frame:visible").length > 0) {
if(expresscart_frame_visible.length > 0) {
m.removeClass('active');
hideFooterExpressCart();
} else {
$(".expresscart_frame").slideDown(function() {
if($(".expresscart_frame").children("p.loading").length > 0) {
expresscart_frame.slideDown(function() {
if(expresscart_frame.children("p.loading").length > 0) {
var id_product = m.parent().children(".ajax_add_to_cart_product_footer_button").attr("rel");
$(".expresscart_frame").append("<iframe src=\"{/literal}{$base_dir_ssl}{literal}modules/expresscart/ajax.php?page=1&id_product=" + id_product + "\" style=\"display: none;\" border=\"0\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" onload=\"$(this).show(); $(this).parent().children('p.loading').remove();\"></iframe>");
expresscart_frame.append("<iframe src=\"{/literal}{$base_dir_ssl}{literal}modules/expresscart/ajax.php?page=1&id_product=" + id_product + "\" style=\"display: none;\" border=\"0\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" onload=\"$(this).show(); $(this).parent().children('p.loading').remove();\"></iframe>");
}
$(".expresscart_frame").append('<a href="#" class="close_popup_footer"></a>');
expresscart_frame.append('<a href="#" class="close_popup_footer"></a>');
$('a.close_popup_footer').click(function() {
$(this).remove();
@ -38,6 +42,7 @@ function showExpressCart(event) {
$("html").bind("click", {m: m}, hideExpressCart);
});
}
return false;
}

View File

@ -388,6 +388,9 @@
var uploading_in_progress = '{l s='Uploading in progress, please wait...' mod='expresscart' js=1}';
var fieldRequired = '{l s='Please fill in all required fields, then save the customization.' mod='expresscart' js=1}';
var quantityAvailableSentence = '{l s='Warning: X items in stock!' mod='expresscart' js=1}';
var oneQuantityAvailableSentence = '{l s='Warning: 1 item in stock!' mod='expresscart' js=1}';
{if isset($groups)}
// Combinations
{foreach from=$combinations key=idCombination item=combination}

View File

@ -441,6 +441,9 @@
var uploading_in_progress = '{l s='Uploading in progress, please wait...' mod='expresscart' js=1}';
var fieldRequired = '{l s='Please fill in all required fields, then save the customization.' mod='expresscart' js=1}';
var quantityAvailableSentence = '{l s='Warning: X items in stock!' mod='expresscart' js=1}';
var oneQuantityAvailableSentence = '{l s='Warning: 1 item in stock!' mod='expresscart' js=1}';
{if isset($groups)}
// Combinations
{foreach from=$combinations key=idCombination item=combination}

View File

@ -0,0 +1,96 @@
/*
* jQuery FlexSlider v2.2.0
* http://www.woothemes.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (@mbmufffin)
*/
/* Browser Resets
*********************************/
.flex-container a:active,
.flexslider a:active,
.flex-container a:focus,
.flexslider a:focus {outline: none;}
.slides,
.flex-control-nav,
.flex-direction-nav {margin: 0; padding: 0; list-style: none;}
/* Icon Fonts
*********************************/
/* Font-face Icons */
@font-face {
font-family: 'flexslider-icon';
src:url('fonts/flexslider-icon.eot');
src:url('fonts/flexslider-icon.eot?#iefix') format('embedded-opentype'),
url('fonts/flexslider-icon.woff') format('woff'),
url('fonts/flexslider-icon.ttf') format('truetype'),
url('fonts/flexslider-icon.svg#flexslider-icon') format('svg');
font-weight: normal;
font-style: normal;
}
/* FlexSlider Necessary Styles
*********************************/
.flexslider {margin: 0; padding: 0;}
.flexslider .slides > li {display: none; -webkit-backface-visibility: hidden;} /* Hide the slides before the JS is loaded. Avoids image jumping */
.flexslider .slides img {width: 100%; display: block;}
.flex-pauseplay span {text-transform: capitalize;}
/* Clearfix for the .slides element */
.slides:after {content: "\0020"; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
html[xmlns] .slides {display: block;}
* html .slides {height: 1%;}
/* No JavaScript Fallback */
/* If you are not using another script, such as Modernizr, make sure you
* include js that eliminates this class on page load */
.no-js .slides > li:first-child {display: block;}
/* FlexSlider Default Theme
*********************************/
.flexslider { margin: 0 0 60px; background: #fff; border: 4px solid #fff; position: relative; -webkit-border-radius: 4px; -moz-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.2); -moz-box-shadow: 0 1px 4px rgba(0,0,0,.2); -o-box-shadow: 0 1px 4px rgba(0,0,0,.2); box-shadow: 0 1px 4px rgba(0,0,0,.2); zoom: 1; }
.flex-viewport { max-height: 2000px; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; transition: all 1s ease; }
.loading .flex-viewport { max-height: 300px; }
.flexslider .slides { zoom: 1; }
.carousel li { margin-right: 5px; }
/* Direction Nav */
.flex-direction-nav {*height: 0;}
.flex-direction-nav a { display: block; width: 40px; height: 40px; margin: -20px 0 0; position: absolute; top: 50%; z-index: 10; overflow: hidden; opacity: 0; cursor: pointer; color: rgba(0,0,0,0.8); text-shadow: 1px 1px 0 rgba(255,255,255,0.3); -webkit-transition: all .3s ease; -moz-transition: all .3s ease; transition: all .3s ease; }
.flex-direction-nav .flex-prev { left: -50px; }
.flex-direction-nav .flex-next { right: -50px; text-align: right; }
.flexslider:hover .flex-prev { opacity: 0.7; left: 10px; }
.flexslider:hover .flex-next { opacity: 0.7; right: 10px; }
.flexslider:hover .flex-next:hover, .flexslider:hover .flex-prev:hover { opacity: 1; }
.flex-direction-nav .flex-disabled { opacity: 0!important; filter:alpha(opacity=0); cursor: default; }
.flex-direction-nav a:before { font-family: "flexslider-icon"; font-size: 40px; display: inline-block; content: '\f001'; }
.flex-direction-nav a.flex-next:before { content: '\f002'; }
/* Pause/Play */
.flex-pauseplay a { display: block; width: 20px; height: 20px; position: absolute; bottom: 5px; left: 10px; opacity: 0.8; z-index: 10; overflow: hidden; cursor: pointer; color: #000; }
.flex-pauseplay a:before { font-family: "flexslider-icon"; font-size: 20px; display: inline-block; content: '\f004'; }
.flex-pauseplay a:hover { opacity: 1; }
.flex-pauseplay a.flex-play:before { content: '\f003'; }
/* Control Nav */
.flex-control-nav {width: 100%; position: absolute; bottom: -40px; text-align: center;}
.flex-control-nav li {margin: 0 6px; display: inline-block; zoom: 1; *display: inline;}
.flex-control-paging li a {width: 11px; height: 11px; display: block; background: #666; background: rgba(0,0,0,0.5); cursor: pointer; text-indent: -9999px; -webkit-border-radius: 20px; -moz-border-radius: 20px; -o-border-radius: 20px; border-radius: 20px; -webkit-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); -moz-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); -o-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); box-shadow: inset 0 0 3px rgba(0,0,0,0.3); }
.flex-control-paging li a:hover { background: #333; background: rgba(0,0,0,0.7); }
.flex-control-paging li a.flex-active { background: #000; background: rgba(0,0,0,0.9); cursor: default; }
.flex-control-thumbs {margin: 5px 0 0; position: static; overflow: hidden;}
.flex-control-thumbs li {width: 25%; float: left; margin: 0;}
.flex-control-thumbs img {width: 100%; display: block; opacity: .7; cursor: pointer;}
.flex-control-thumbs img:hover {opacity: 1;}
.flex-control-thumbs .flex-active {opacity: 1; cursor: default;}
@media screen and (max-width: 860px) {
.flex-direction-nav .flex-prev { opacity: 1; left: 10px;}
.flex-direction-nav .flex-next { opacity: 1; right: 10px;}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
<div id="privatesales_similarproduct" class="block products_block">
{if $is_accessories}
<h1 class="">{l s='Autres produits associés' mod='privatesales_similarproducts'}</h1>
{else}
<h1 class="">{l s='Les meilleures ventes dans' mod='privatesales_similarproducts'} {$family_name}</h1>
{/if}
{if $ps_other_products|@count > 0}
<div class="slider_sales_product_footer">
<ul class="slides">
{foreach from=$ps_other_products item=product name=myLoop}
<li class='slide-item'>
<div class="hover-slide">
<a onclick="showExpressCart(event); return false;" class="add-to-cart ajax_add_to_cart_product_footer_button" rel="{$product.id_product}" href="" title="{l s='Add to cart' mod='privatesales_similarproducts'}"></a>
<a class="see-product" href="{$product.link}" title="{l s='See this product' mod='privatesales_similarproducts'}"></a>
</div>
<div class="product_added product_added_{$product.id_product}">
<p>{l s='Product added to your cart' mod='privatesales_similarproducts'}</p>
</div>
<div class="img_sellers">
<a href="{$product.link}" title="{$product.name|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'medium')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" /></a>
</div>
<div class="info_sellers">
<a href="{$product.link}" title="{$product.name|escape:'htmlall':'UTF-8'}" class="product_link_sellers">{$product.name}</a>
<p class="price">{$product.price}</p>
<p class="price_info">
<span class="old_price">{convertPrice price=$product.price_without_reduction}</span>
{if $product.specific_prices.reduction_type =='percentage'}
{assign var="reduc_value" value=$product.specific_prices.reduction * 100}
<span class="percentage">(-{$reduc_value|intval}%)</span>
{elseif $product.specific_prices.reduction_type == 'amount'}
<span class="amount">(-{$product.specific_prices.reduction|number_format:2:",":"."}€)</span>
{/if}
</p>
</div>
</li>
{/foreach}
</ul>
</div>
{/if}
</div>
<link rel="stylesheet" href="/modules/privatesales_similarproducts/assets/css/flexslider.css">
<script type="text/javascript" src="/modules/privatesales_similarproducts/assets/js/jquery.flexslider.js"></script>
<script>
{literal}
$( document ).ready(function() {
$('.slider_sales_product_footer').flexslider({
animation: "slide",
directionNav: true,
itemWidth: (860/3),
useCSS : false,
pauseOnHover: true,
});
$('.slider_sales_product_footer .flex-direction-nav .flex-next').text('');
$('.slider_sales_product_footer .flex-direction-nav .flex-prev').text('');
});
{/literal}
</script>

View File

@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* http://opensource.org/licenses/osl-3.0.php
* 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7233 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

View File

@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* http://opensource.org/licenses/osl-3.0.php
* 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7233 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,205 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
class Privatesales_similarproducts extends Module
{
private $_html = '';
private $_postErrors = array();
private $hooks = array(
'similarProduct' => array('Accessories or similar products', 'Called on displaying similar product in product details'),
);
public function __construct()
{
$this->name = 'privatesales_similarproducts';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'Antadis';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('Produits complémentaires ou similaires');
$this->description = $this->l('Ajoute un bloc affichant les produits complémentaires (accessoires) ou les meilleures ventes de la famille d\'un produit.');
}
/**
* @see ModuleCore::install()
*/
public function install()
{
// Add custom hooks
foreach($this->hooks as $k => $v) {
if(count(Db::getInstance()->ExecuteS('
SELECT `id_hook`
FROM `'._DB_PREFIX_.'hook`
WHERE `name` = "'.$k.'"
LIMIT 1
')) == 0) {
Db::getInstance()->ExecuteS('
INSERT INTO `'._DB_PREFIX_.'hook`
VALUES (DEFAULT, "'.$k.'", "'.$v[0].'", "'.$v[1].'", 0, 0)
');
}
}
if (!parent::install() ||
!$this->registerHook('similarProduct')) {
$this->uninstall();
return false;
}
return true;
}
public function uninstall()
{
// Remove custom hooks
foreach($this->hooks as $k => $v) {
Db::getInstance()->Execute('
DELETE FROM `'._DB_PREFIX_.'hook`
WHERE `name` = "'.$k.'"
');
}
parent::uninstall();
}
public function hookSimilarProduct($params)
{
if(_PS_MOBILE_) {
return false;
}
$result = $this->displayAccessories($params);
if ($result=='') {
return $this->displayBestVPSalesSameFamily($params);
}
return $result;
}
private function displayAccessories($params)
{
global $smarty;
$cache_params = [
'prefix_cache' => '1_'.$params['product']->id
];
if (!$this->isTemplateCached($cache_params)) {
$currency = new Currency((int)($params['cookie']->id_currency));
// get all accessories of this product
$other_products = array();
$accessories = $params['product']->getAccessories($params['cookie']->id_lang);
if(is_array($accessories)) {
foreach ($accessories AS $accessory)
{
$accessory['price'] = Tools::displayPrice(Product::getPriceStatic((int)($accessory['id_product'])), $currency);
$other_products[] = $accessory;
}
}
if (empty($other_products)) {
return '';
}
$smarty->assign(
array(
'is_accessories' => TRUE,
'ps_other_products' => $other_products,
)
);
}
return $this->flushTemplateCache($cache_params);
}
private function displayBestVPSalesSameFamily($params)
{
global $smarty;
$cache_params = [
'prefix_cache' => '2_'.$params['sale']->id,
];
if (!$this->isTemplateCached($cache_params)) {
$currency = new Currency((int)($params['cookie']->id_currency));
// get all best sales of the product family
$other_products = array();
$family = ProductSale::getSaleFamily(
$params['sale']->id,
$params['cookie']->id_lang
);
$bestsellers = ProductSale::getFamilyBestSales(
$family['id_category_family'],
$params['cookie']->id_lang,
0, 3, NULL, NULL, 10
);
$family_name = '';
if(is_array($bestsellers)) {
foreach ($bestsellers AS $bestseller) {
$bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency);
$other_products[] = $bestseller;
$family_name = $bestseller['category'];
}
}
if (empty($other_products)) {
return '';
}
$smarty->assign(
array(
'is_accessories' => FALSE,
'ps_other_products' => $other_products,
'family_name' => $family['name']
)
);
}
return $this->flushTemplateCache($cache_params);
}
private function isTemplateCached(&$cache_params)
{
global $smarty;
global $cookie;
Tools::enableCache();
$smarty->cache_lifetime = 3600;
$cache_params['compile_id'] = $cache_params['prefix_cache'].'_'.(int)$cookie->id_lang;
$cache_params['cache_id'] = $cache_params['compile_id'].'_front_similarproducts';
return $this->isCached(
'front_similarproducts.tpl',
$cache_params['cache_id'],
$cache_params['compile_id']
);
}
private function flushTemplateCache($cache_params)
{
global $smarty;
$display = $this->display(
__FILE__,
'front_similarproducts.tpl' ,
$cache_params['cache_id'],
$cache_params['compile_id']
);
Tools::restoreCacheSettings();
$smarty->cache_lifetime = -1;
return $display;
}
}

View File

@ -1,9 +1,59 @@
<?php
class ProductSale extends ProductSaleCore
{
public static function getSaleFamily($id_sale, $id_lang)
{
$query = '
SELECT DISTINCT a.`id_category_family`, c.`name`
FROM `'._DB_PREFIX_.'category_family_association` a
JOIN `'._DB_PREFIX_.'category_family_lang` c ON c.`id_category_family` = a.`id_category_family`
JOIN `'._DB_PREFIX_.'privatesale_category` b ON b.`id_category` = a.`id_category`
WHERE b.`id_sale` = '.pSql($id_sale).'
AND c.`id_lang` = '.pSql($id_lang);
return Db::getInstance()->getRow($query);
}
public static function getFamilyBestSales($id_category_family, $id_lang, $pageNumber = 0, $nbProducts = 3, $orderBy=NULL, $orderWay=NULL, $filterPrice=NULL)
{
return self::getBestSalesForCategories(
array(
'categories' => self::_getPrivateSalesCategoriesOfFamily($id_category_family),
'id_lang' => (int)$id_lang,
'page_number' => $pageNumber,
'nb_products' => $nbProducts,
'order_by' => $orderBy,
'order_way' => $orderWay,
'filter_price' => $filterPrice,
'include_category_children' => FALSE
)
);
}
public static function getBestSalesVp($id_lang, $pageNumber = 0, $nbProducts = 10, $orderBy=NULL, $orderWay=NULL, $filterPrice=NULL)
{
$id_category_vp = self::_getIdCategoryPrivateSales();
return self::getBestSalesForCategories(
array(
'categories' => self::_getIdCategoryPrivateSales(),
'id_lang' => $id_lang,
'page_number' => $pageNumber,
'nb_products' => $nbProducts,
'order_by' => $orderBy,
'order_way' => $orderWay,
'filter_price' => $filterPrice,
'include_category_children' => TRUE
)
);
}
private static function getBestSalesForCategories($params)
{
$id_category_vp = $params['categories'];
$id_lang = $params['id_lang'];
$pageNumber = $params['page_number'];
$nbProducts = $params['nb_products'];
$orderBy = $params['order_by'];
$orderWay = $params['order_way'];
$filterPrice = $params['filter_price'];
// $id_category_vp = array_unique($id_category_vp);
if ($pageNumber < 0) $pageNumber = 0;
@ -11,6 +61,10 @@ class ProductSale extends ProductSaleCore
if (empty($orderBy) || $orderBy == 'position') $orderBy = 'sales';
if (empty($orderWay)) $orderWay = 'DESC';
if (empty($id_category_vp)) {
return [];
}
$groups = FrontController::getCurrentCustomerGroups();
$sqlGroups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
@ -18,16 +72,18 @@ class ProductSale extends ProductSaleCore
foreach ($id_category_vp as $key => $sale) {
$categories = array($sale['id_category']);
$children = Category::getChildren($sale['id_category'] , 1);
if(count($children) > 0){
foreach ($children as $key => $child) {
$categories[] = $child['id_category'];
if ($params['include_category_children']) {
$children = Category::getChildren($sale['id_category'] , 1);
if(count($children) > 0){
foreach ($children as $key => $child) {
$categories[] = $child['id_category'];
}
}
}
$sale_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT
DISTINCT(p.id_product),
DISTINCT(p.id_product), p.out_of_stock, p.id_category_default, p.ean13,
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
i.`id_image`, il.`legend`,
ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
@ -54,11 +110,13 @@ class ProductSale extends ProductSaleCore
LIMIT 1
)
');
if (!$sale_product)
continue;
if (self::alreadyInArray($sale_product[0]['id_product'], $result)) {
continue;
}
$data = Product::getProductsProperties($id_lang, $sale_product, false);
if (isset($filterPrice) && is_int($filterPrice) && $data[0]['price']<$filterPrice) {
continue;
@ -72,6 +130,16 @@ class ProductSale extends ProductSaleCore
return array_slice($final_array,0,$nbProducts);
}
public static function alreadyInArray($id_product, $result)
{
foreach ($result as $row) {
if ($row['id_product'] == $id_product) {
return TRUE;
}
}
return FALSE;
}
public static function bubble_sort($array)
{
$i = count($array);
@ -108,4 +176,22 @@ class ProductSale extends ProductSaleCore
';
return $sales = Db::getInstance()->ExecuteS($query);
}
private static function _getPrivateSalesCategoriesOfFamily($id_category_family)
{
global $site_version_front;
$query = '
SELECT pc.`id_category`
FROM `'._DB_PREFIX_.'privatesale_category` pc
JOIN `'._DB_PREFIX_.'category_family_association` cfa ON cfa.id_category = pc.id_category
JOIN `'._DB_PREFIX_.'privatesale` p ON p.`id_sale` = pc.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'privatesale_site_version` v ON v.`id_sale` = p.`id_sale`
WHERE cfa.`id_category_family` = '.$id_category_family.'
AND p.`date_start` <= NOW()
AND p.`date_end` >= NOW()
AND v.`version` = "'.pSql($site_version_front).'"
';
return Db::getInstance()->ExecuteS($query);
}
}

View File

@ -44,6 +44,7 @@ class ProductController extends ProductControllerCore {
self::$smarty->assign(array(
'sale' => $sale,
'HOOK_SIMILAR_PRODUCT' => Module::hookExec('similarProduct', array('product' => $this->product, 'sale' => $sale)),
'HOOK_PRIVATESALES_PRODUCT' => Module::hookExec('privatesales_product', array('sale' => $sale)),
'is_sale_home' => ($sale? $sale->id_category == $id_category: FALSE),
'is_thumb_vp' => (file_exists(_PS_ROOT_DIR_.'/img/c/'.$id_category_thumb.'_thumb_vp.jpg')),

View File

@ -6908,3 +6908,170 @@ table#carrierTable tbody td {
font-weight: bold;
}
/* ticket 8048 - Product details - Other similar products / best sales for product family */
/* Slider product footer (blockbestsellers)*/
#product #privatesales_similarproduct {
position: relative;
}
#product #privatesales_similarproduct h1 {
background-size: 100% 100%;
color: #4F4E9A;
margin-right: 0px;
}
#product #privatesales_similarproduct .slider_sales_product_footer {
padding: 20px 60px;
position: relative;
-moz-box-shadow: 0px 0px 5px 1px #cccccc;
-webkit-box-shadow: 0px 0px 5px 1px #CCC;
-ms-box-shadow:: 0px 0px 5px 1px #cccccc;
-o-box-shadow: 0px 0px 5px 1px #cccccc;
box-shadow: 0px 0px 5px 1px #CCC;
margin-bottom:20px;
}
#product #privatesales_similarproduct .flex-direction-nav {
position: inherit;
}
#product #privatesales_similarproduct .flex-control-nav{
display: none;
}
#product #privatesales_similarproduct .flex-direction-nav .flex-prev,
#product #privatesales_similarproduct .flex-direction-nav .flex-next {
top: -80px;
border-radius: 50%;
width: 50px;
height: 50px;
content: '';
background: #fff;
color: transparent;
opacity: 1;
-moz-box-shadow: 0px 0px 5px 1px #cccccc;
-webkit-box-shadow: 0px 0px 5px 1px #CCC;
-ms-box-shadow:: 0px 0px 5px 1px #cccccc;
-o-box-shadow: 0px 0px 5px 1px #cccccc;
box-shadow: 0px 0px 5px 1px #CCC;
}
#product #privatesales_similarproduct .flex-direction-nav .flex-prev{
background: url("../img/arrow_blue_left.png") no-repeat center center #fff;
}
#product #privatesales_similarproduct .flex-direction-nav .flex-next{
background: url("../img/arrow_blue_right.png") no-repeat center center #fff;
}
#product #privatesales_similarproduct .flex-direction-nav .flex-prev:before,
#product #privatesales_similarproduct .flex-direction-nav .flex-next:before{
display: none;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides {
padding: 10px 0;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li{
margin-right: 10px;
margin-left: 10px;
background: #fff;
padding: 10px;
box-sizing: border-box;
position: relative;
max-height: 134px;
-moz-box-shadow: 0px 0px 5px 1px #cccccc;
-webkit-box-shadow: 0px 0px 5px 1px #CCC;
-ms-box-shadow:: 0px 0px 5px 1px #cccccc;
-o-box-shadow: 0px 0px 5px 1px #cccccc;
box-shadow: 0px 0px 5px 1px #CCC;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .hover-slide,
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .product_added{
display: none;
top: 0;
left: 0;
width:100%;
height:100%;
background-color: rgba(0,0,0,0.7);
box-sizing: border-box;
text-align: center;
position: absolute;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .product_added{
z-index: 999;
padding: 45px 20px;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .product_added p{
color: #fff;
font-family: "georgia";
font-style: italic;
font-weight: bold;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li:hover div.hover-slide{
display: block;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .hover-slide a{
display: inline-block;
width: 40%;
height: 100%;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .hover-slide a.add-to-cart {
background: url("../img/panier2.png") no-repeat center center;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .hover-slide a.see-product {
background: url("../img/loupe.png") no-repeat center center;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li:after{
content: '';
display: block;
clear: both;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .img_sellers,
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers {
text-align: center;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .img_sellers{
width: 40%;
float: left;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers {
width: 60%;
padding: 5px 10px;
box-sizing: border-box;
background-color: #E4E4EE;
float: right;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers .product_link_sellers,
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers p.price,
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers .old_price,
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers .percentage,
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers .amount{
font-family: "georgia";
font-style: italic;
font-weight: bold;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers .product_link_sellers{
display: block;
display: -webkit-box;
max-width: 110px;
height: 44px;
margin: 0 auto;
font-size: 12px;
line-height: 15px;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
color: #4F4E9A;
font-weight: 500;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers .product_link_sellers:hover{
text-decoration: none;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers p.price{
border:0;
color: #FB69AA;
font-size: 16px;
padding-top: 18px;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers .old_price {
color: #B0B0B0;
text-decoration: line-through;
}
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers .percentage,
#product #privatesales_similarproduct .slider_sales_product_footer .slides li .info_sellers .amount{
color: #4F4E9A;
}

View File

@ -546,37 +546,39 @@ var oneQuantityAvailableSentence = '{l s='Warning: 1 item in stock!' js=1}';
{/foreach}
</ul>
{/if}
{if isset($accessories) AND $accessories}
<!-- accessories -->
<ul id="idTab7" class="bullet">
<div class="block products_block accessories_block clearfix">
<div class="block_content">
<ul>
{foreach from=$accessories item=accessory name=accessories_list}
{assign var='accessoryLink' value=$link->getProductLink($accessory.id_product, $accessory.link_rewrite, $accessory.category)}
<li class="ajax_block_product {if $smarty.foreach.accessories_list.first}first_item{elseif $smarty.foreach.accessories_list.last}last_item{else}item{/if} product_accessories_description">
<h5><a href="{$accessoryLink|escape:'htmlall':'UTF-8'}">{$accessory.name|truncate:22:'...':true|escape:'htmlall':'UTF-8'}</a></h5>
<div class="product_desc">
<a href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{$accessory.legend|escape:'htmlall':'UTF-8'}" class="product_image"><img src="{$link->getImageLink($accessory.link_rewrite, $accessory.id_image, 'medium')}" alt="{$accessory.legend|escape:'htmlall':'UTF-8'}" width="{$mediumSize.width}" height="{$mediumSize.height}" /></a>
<a href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{l s='More'}" class="product_description">{$accessory.description_short|strip_tags|truncate:70:'...'}</a>
</div>
<p class="product_accessories_price">
{if $accessory.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<span class="price">{if $priceDisplay != 1}{displayWtPrice p=$accessory.price}{else}{displayWtPrice p=$accessory.price_tax_exc}{/if}</span>{/if}
<a class="button" href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
{if ($accessory.allow_oosp || $accessory.quantity > 0) AND $accessory.available_for_order AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
<a class="exclusive button ajax_add_to_cart_button" href="{$link->getPageLink('cart.php')}?qty=1&amp;id_product={$accessory.id_product|intval}&amp;token={$static_token}&amp;add" rel="ajax_id_product_{$accessory.id_product|intval}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{else}
<span class="exclusive">{l s='Add to cart'}</span>
<span class="availability">{if (isset($accessory.quantity_all_versions) && $accessory.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>
{/if}
</p>
</li>
{if !isset($HOOK_SIMILAR_PRODUCT)}
{if isset($accessories) AND $accessories}
<!-- accessories -->
<ul id="idTab7" class="bullet">
<div class="block products_block accessories_block clearfix">
<div class="block_content">
<ul>
{foreach from=$accessories item=accessory name=accessories_list}
{assign var='accessoryLink' value=$link->getProductLink($accessory.id_product, $accessory.link_rewrite, $accessory.category)}
<li class="ajax_block_product {if $smarty.foreach.accessories_list.first}first_item{elseif $smarty.foreach.accessories_list.last}last_item{else}item{/if} product_accessories_description">
<h5><a href="{$accessoryLink|escape:'htmlall':'UTF-8'}">{$accessory.name|truncate:22:'...':true|escape:'htmlall':'UTF-8'}</a></h5>
<div class="product_desc">
<a href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{$accessory.legend|escape:'htmlall':'UTF-8'}" class="product_image"><img src="{$link->getImageLink($accessory.link_rewrite, $accessory.id_image, 'medium')}" alt="{$accessory.legend|escape:'htmlall':'UTF-8'}" width="{$mediumSize.width}" height="{$mediumSize.height}" /></a>
<a href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{l s='More'}" class="product_description">{$accessory.description_short|strip_tags|truncate:70:'...'}</a>
</div>
<p class="product_accessories_price">
{if $accessory.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}<span class="price">{if $priceDisplay != 1}{displayWtPrice p=$accessory.price}{else}{displayWtPrice p=$accessory.price_tax_exc}{/if}</span>{/if}
<a class="button" href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
{if ($accessory.allow_oosp || $accessory.quantity > 0) AND $accessory.available_for_order AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
<a class="exclusive button ajax_add_to_cart_button" href="{$link->getPageLink('cart.php')}?qty=1&amp;id_product={$accessory.id_product|intval}&amp;token={$static_token}&amp;add" rel="ajax_id_product_{$accessory.id_product|intval}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{else}
<span class="exclusive">{l s='Add to cart'}</span>
<span class="availability">{if (isset($accessory.quantity_all_versions) && $accessory.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>
{/if}
</p>
</li>
{/foreach}
</ul>
{/foreach}
</ul>
</div>
</div>
</div>
</ul>
</ul>
{/if}
{/if}
{$HOOK_PRODUCT_TAB_CONTENT}
</div>
@ -622,6 +624,10 @@ var oneQuantityAvailableSentence = '{l s='Warning: 1 item in stock!' js=1}';
</div>
{/if}
{if isset($HOOK_SIMILAR_PRODUCT)}
{$HOOK_SIMILAR_PRODUCT}
{/if}
{$HOOK_PRODUCT_FOOTER}
<!-- Customizable products -->