Merge branch 'ticket-12200-FuturSalesInMenu' into develop

This commit is contained in:
Marion Muszynski 2017-01-23 11:28:51 +01:00
commit eaf807cff3
8 changed files with 155 additions and 73 deletions

View File

@ -1266,9 +1266,9 @@ class AdminBulkUpdate extends AdminTab {
'id_product_attribute',
'position',
'poids',
'quantity',
'quantity_sold',
'stock_initial',
'quantity_sold',
'quantity',
'product_name',
'combination',
'ean13',
@ -1428,9 +1428,9 @@ class AdminBulkUpdate extends AdminTab {
$k,
$p->position,
str_replace('.', ',', $p->weight),
$v['qty'],
$quantity_sold,
($v['qty']+$quantity_sold),
$quantity_sold,
$v['qty'],
$p->name[$id_lang],
implode(' - ', $names),
$v['ean13'],
@ -1491,9 +1491,9 @@ class AdminBulkUpdate extends AdminTab {
0,
$p->position,
str_replace('.', ',', $p->weight),
$p->quantity,
$quantity_sold,
($p->quantity+$quantity_sold),
$quantity_sold,
$p->quantity,
$p->name[$id_lang],
'',
$p->ean13,
@ -1573,9 +1573,9 @@ class AdminBulkUpdate extends AdminTab {
'id_product_attribute',
'position',
'poids',
'quantity',
'quantity_sold',
'stock_initial',
'quantity_sold',
'quantity',
'product_name',
'combination',
'ean13',
@ -1734,9 +1734,9 @@ class AdminBulkUpdate extends AdminTab {
$k,
$p->position,
str_replace('.', ',', $p->weight),
$v['qty'],
$quantity_sold,
($v['qty']+$quantity_sold),
$quantity_sold,
$v['qty'],
$p->name[$id_lang],
implode(' - ', $names),
$v['ean13'],
@ -1799,9 +1799,9 @@ class AdminBulkUpdate extends AdminTab {
0,
$p->position,
str_replace('.', ',', $p->weight),
$p->quantity,
$quantity_sold,
($p->quantity+$quantity_sold),
$quantity_sold,
$p->quantity,
$p->name[$id_lang],
'',
$p->ean13,

View File

@ -317,10 +317,23 @@ class Catalog
$sale_link = str_replace('bebeboutik.com', 'bebeboutik.es', $sale_link);
}
$sql = '
SELECT `value`
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale`
WHERE `id_field` = 1
AND `id_lang` = '.(int) $id_lang.'
AND `id_sale` = '. (int)$item->id
;
if ($value = Db::getInstance()->getValue($sql)) {
$item->small_title = $value;
} else {
$item->small_title = 'Non défini';
}
$this->_xml.='<sect_03>';
// $this->_xml .= '<id_vente>'.$item->id.'</id_vente>';
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]>|<![CDATA['.$item->reduction.']]></title>';
$this->_xml .= '<description><![CDATA['.$item->description[(int) $id_lang].']]></description>';
$this->_xml .= '<description><![CDATA['.$item->small_title.']]></description>';
//$this->_xml .= '<description></description>';
//$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
$this->_xml .= '<category></category>';

View File

@ -1,6 +1,6 @@
<?php
class Privatesales_Family_Menu extends Module {
public function __construct() {
$this->name = 'privatesales_family_menu';
$this->tab = 'pricing_promotion';
@ -27,7 +27,7 @@ class Privatesales_Family_Menu extends Module {
$filename = _PS_ROOT_DIR_.'/modules/privatesales_family_menu/menu_'.$id_lang.'.txt';
$expire = time() -3600;
if(file_exists($filename) && filemtime($filename) > $expire) {
$data = file_get_contents($filename);
$menus = json_decode($data, TRUE);
@ -70,55 +70,74 @@ class Privatesales_Family_Menu extends Module {
LEFT JOIN `'._DB_PREFIX_.'privatesale_lang` pl ON pl.`id_sale` = p.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'privatesale_category` pc ON pc.`id_sale` = p.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'category_family_association` pcf ON pcf.`id_category` = pc.`id_category`
WHERE p.`public` = 0
WHERE p.`public` = 0
AND pv.`version` = "'.pSql($site_version_front).'"
AND p.`enabled` = 1
AND p.`date_start` < NOW()
AND p.`date_start` < NOW()
AND p.`date_end` > NOW()
AND pcf.`id_category_family` = '.(int)$child['id_category_family'].'
GROUP BY p.`id_sale`
ORDER BY p.`date_end` ASC
');
$childrens[$key_child]['sales'] = array();
$childrens[$key_child]['sales'] = $this->buildSales($sales, $id_lang);
foreach ($sales as $key_sale => $sale) {
$info_cat = Db::getInstance()->getRow('
SELECT `name`, `link_rewrite`
FROM `'._DB_PREFIX_.'category_lang`
WHERE `id_category` = '.(int)$sale['category_sale'].
' AND id_lang ='.(int)$id_lang
);
if (!file_exists(_PS_ROOT_DIR_.'/img/menu/'.$sale['id_category'].'.jpg')) {
$img_tmp = '';
if (file_exists(_PS_ROOT_DIR_.'/img/c/'. $sale['id_category']. '.jpg')) {
$img_tmp = _PS_ROOT_DIR_.'/img/c/'. $sale['id_category']. '.jpg';
} else {
$id_parent = Category::getIdParent($sale['id_category']);
if(file_exists(_PS_ROOT_DIR_.'/img/c/'. $id_parent. '.jpg')) {
$img_tmp = _PS_ROOT_DIR_.'/img/c/'. $id_parent. '.jpg';
}
}
// create new format image
$image_menu = imagecreatetruecolor(260, 211);
$image_cat = imagecreatefromjpeg($img_tmp);
imagecopyresampled($image_menu, $image_cat, 0, 0, 0, 0, 260, 211, 260, 211);
imagejpeg($image_menu, _PS_ROOT_DIR_.'/img/menu/'.$sale['id_category'].'.jpg',100);
}
$sales[$key_sale]['img'] = '/img/menu/'.$sale['id_category'].'.jpg';
$sales[$key_sale]['link_rewrite'] = $info_cat['link_rewrite'];
$sales[$key_sale]['name'] = $info_cat['name'];
}
$childrens[$key_child]['sales'] = $sales;
$future_sales = Db::getInstance()->Executes('
SELECT p.`id_sale`, p.`id_category` as category_sale, pc.`id_category`
FROM `'._DB_PREFIX_.'privatesale` p
LEFT JOIN `'._DB_PREFIX_.'privatesale_site_version` pv ON pv.`id_sale` = p.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'privatesale_lang` pl ON pl.`id_sale` = p.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'privatesale_category` pc ON pc.`id_sale` = p.`id_sale`
LEFT JOIN `'._DB_PREFIX_.'category_family_association` pcf ON pcf.`id_category` = pc.`id_category`
WHERE p.`public` = 0
AND pv.`version` = "'.pSql($site_version_front).'"
AND p.`enabled` = 1
AND p.`date_start` > NOW()
AND p.`date_end` > NOW()
AND pcf.`id_category_family` = '.(int)$child['id_category_family'].'
GROUP BY p.`id_sale`
ORDER BY p.`date_end` ASC
');
$childrens[$key_child]['future_sales'] = array();
$childrens[$key_child]['future_sales'] = $this->buildSales($future_sales, $id_lang);
}
$families_menu[$key]['children'] = $childrens;
}
return $families_menu;
}
public function buildSales($sales, $id_lang) {
foreach ($sales as $key_sale => $sale) {
$info_cat = Db::getInstance()->getRow('
SELECT `name`, `link_rewrite`
FROM `'._DB_PREFIX_.'category_lang`
WHERE `id_category` = '.(int)$sale['category_sale'].
' AND id_lang ='.(int)$id_lang
);
if (!file_exists(_PS_ROOT_DIR_.'/img/menu/'.$sale['id_category'].'.jpg')) {
$img_tmp = '';
if (file_exists(_PS_ROOT_DIR_.'/img/c/'. $sale['id_category']. '.jpg')) {
$img_tmp = _PS_ROOT_DIR_.'/img/c/'. $sale['id_category']. '.jpg';
} else {
$id_parent = Category::getIdParent($sale['id_category']);
if(file_exists(_PS_ROOT_DIR_.'/img/c/'. $id_parent. '.jpg')) {
$img_tmp = _PS_ROOT_DIR_.'/img/c/'. $id_parent. '.jpg';
}
}
// create new format image
$image_menu = imagecreatetruecolor(260, 211);
$image_cat = imagecreatefromjpeg($img_tmp);
imagecopyresampled($image_menu, $image_cat, 0, 0, 0, 0, 260, 211, 260, 211);
imagejpeg($image_menu, _PS_ROOT_DIR_.'/img/menu/'.$sale['id_category'].'.jpg',100);
}
$sales[$key_sale]['img'] = '/img/menu/'.$sale['id_category'].'.jpg';
$sales[$key_sale]['link_rewrite'] = $info_cat['link_rewrite'];
$sales[$key_sale]['name'] = $info_cat['name'];
}
return $sales;
}
}

View File

@ -677,9 +677,9 @@ class AdminPrivateSalesLogistique extends AdminTab {
'id_product_attribute',
'position',
'poids',
'quantity',
'quantity_sold',
'stock_initial',
'quantity_sold',
'quantity',
'product_name',
'combination',
'ean13',
@ -838,9 +838,9 @@ class AdminPrivateSalesLogistique extends AdminTab {
$k,
$p->position,
str_replace('.', ',', $p->weight),
$v['qty'],
$quantity_sold,
($v['qty']+$quantity_sold),
$quantity_sold,
$v['qty'],
$p->name[$id_lang],
implode(' - ', $names),
$v['ean13'],
@ -904,9 +904,9 @@ class AdminPrivateSalesLogistique extends AdminTab {
0,
$p->position,
str_replace('.', ',', $p->weight),
$p->quantity,
$quantity_sold,
($p->quantity+$quantity_sold),
$quantity_sold,
$p->quantity,
$p->name[$id_lang],
'',
$p->ean13,
@ -987,9 +987,9 @@ class AdminPrivateSalesLogistique extends AdminTab {
'id_product_attribute',
'position',
'poids',
'quantity',
'quantity_sold',
'stock_initial',
'quantity_sold',
'quantity',
'product_name',
'combination',
'ean13',
@ -1144,9 +1144,9 @@ class AdminPrivateSalesLogistique extends AdminTab {
$k,
$p->position,
str_replace('.', ',', $p->weight),
$v['qty'],
$quantity_sold,
($v['qty']+$quantity_sold),
$quantity_sold,
$v['qty'],
$p->name[$id_lang],
implode(' - ', $names),
$v['ean13'],
@ -1203,9 +1203,9 @@ class AdminPrivateSalesLogistique extends AdminTab {
0,
$p->position,
str_replace('.', ',', $p->weight),
$p->quantity,
$quantity_sold,
($p->quantity+$quantity_sold),
$quantity_sold,
$p->quantity,
$p->name[$id_lang],
'',
$p->ean13,

View File

@ -378,7 +378,7 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
$letter_product_stock3btk = 'G';
$letter_product_missing = 'H';
$letter_product_to_sent = 'I'; // (M1 + Multi - Missing)
$letter_product_to_stock = 'I';
$letter_product_to_stock = 'J';
$letter_product_shipped = 'K'; // (M1 + Multi - stock3BTK - Missing + to_stock)

View File

@ -953,6 +953,8 @@ $(document).ready(function () {
// Check contact infos
var phone_mobile = /^((\+|00)33\s?|0)[67](\s?\d{2}){4}$/i;
var phone_mobile_es = /^((\+|00)34\s?|0)[67](\s?\d{2}){4}$/i;
var phone_mobile_without_zero = /^[67](\s?\d{2}){4}$/i;
var phone_mobile_be = /^((\+|00)32\s?|0)4(60|[789]\d)(\s?\d{2}){3}$/i;
var email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/i;
@ -962,16 +964,21 @@ $(document).ready(function () {
return (false);
}
$('#custPhone').val($('#sf_phone').val());
if (!$('#custPhone').val().length) {
ev.preventDefault();
alert($('#error-mobile-mandatory').val() + '\n\nFormat : 0661010203');
alert($('#error-mobile-mandatory').val() + '\n\nFormat : 0671010203');
return (false);
}
if (!(phone_mobile.test($('#custPhone').val()) || phone_mobile_be.test($('#custPhone').val()))) {
ev.preventDefault();
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0661010203');
return (false);
if($('#custPhone').val().length == 9 && !phone_mobile_without_zero.test($('#custPhone').val())){
ev.preventDefault();
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0661010203');
return (false);
} else if($('#custPhone').val().length > 9 && !(phone_mobile.test($('#custPhone').val()) || phone_mobile_be.test($('#custPhone').val()))) {
ev.preventDefault();
alert($('#error-mobile-invalid').val() + '\n\nFormat : 0681010203');
return (false);
}
return (true);

View File

@ -1984,7 +1984,35 @@ li.active .container_submenu .content_submenu {
border-color: #786ec7;
color: #fff;
}
.submenu .sales_submenu p.separator-future-sales {
text-align: center;
border-bottom: 4px double #EAEAEA;
margin: 0 auto;
width: 30%;
color: #AAA;
}
}
/*.submenu .sales_submenu hr.separator-future-sales {
clear: both;
width: 70%;
margin:0 auto;
border-top: 4px double #8c8b8b;
border-bottom:transparent;
border-right:transparent;
border-left:transparent;
text-align: center;
}
.submenu .sales_submenu hr.separator-future-sales:after {
content: 'Ventes à venir';
display: inline-block;
position: relative;
top: -13px;
padding: 0 10px;
background: #fff;
color: #CCC;
font-size: 14px;
font-family: tahoma, arial, sans-serif;
}*/
#shopping_cart_container {
float: right !important;

View File

@ -13,8 +13,9 @@
{foreach from=$menu.children item=child}
<li>
<a href="#" class="sublink"><span>{$child.name}</span></a>
{if $child.sales}
{if $child.sales || $child.future_sales}
<div class="sales_submenu">
{if $child.sales}
<ul>
{foreach from=$child.sales item=sale}
<li>
@ -24,6 +25,20 @@
</li>
{/foreach}
</ul>
{/if}
{if $child.future_sales}
<p class="clearfix"></p>
<p class="separator-future-sales">{l s='Future Sales' mod='privatesales_family_menu'}</p>
<ul>
{foreach from=$child.future_sales item=sale}
<li>
<a class="link_sale" href="{$link->getCategoryLink($sale.id_category, $sale.link_rewrite)|escape:'htmlall':'UTF-8'}">
<img class="thumb_menu" height="50px" src="https://static3.bebeboutik.com{$sale.img}" alt="">
{$sale.name}</a>
</li>
{/foreach}
</ul>
{/if}
</div>
{else}
<div class="sales_submenu">
@ -44,7 +59,7 @@
</li>
{/foreach}
</ul>
</div>
</div>
</div>
{if $page_name != 'authentication'}
@ -67,7 +82,7 @@
img1 = new Image();
img1.src = "/themes/site/img/img_menu.jpg";
$(document).ready(function(e) {
$('#sales_menu ul li a').live('click', function(event){