Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop

This commit is contained in:
Christophe Latour 2017-08-28 18:09:45 +02:00
commit cd5729905c
11 changed files with 193 additions and 72 deletions

View File

@ -1,15 +1,23 @@
{if count($sizes) > 0}
{if count($attr) > 0}
<div class="block_filter">
<div class="content">
<h4 class="open">{l s='Recherche par' mod='filtervp'} {$name}</h4>
<h4 class="open">{l s='Recherche par' mod='filtervp'}</h4>
<div class="content_filter">
<ul id="filters">
{foreach from=$sizes item=size}
<h5>{$attr[0]['group']}</h5>
{assign var="current_name" value=$attr[0]['group']}
<ul class="filters" id="filters">
{foreach from=$attr key=key item=attribute}
{if $key!=0 && $current_name!=$attribute['group']}
</ul>
<h5>{$attribute['group']}</h5>
<ul class="filters">
{/if}
<li>
<input type="checkbox" name="size" value="{$size.id_attribute}" id="size_{$size.id_attribute}">
<label for="size_{$size.id_attribute}">{$size.name}</label>
<input type="checkbox" name="size" value="{$attribute['id_attribute']}" id="size_{$size.id_attribute}">
<label for="size_{$size.id_attribute}">{$attribute['name']}</label>
</li>
{assign var="current_name" value=$attribute['group']}
{/foreach}
</ul>
</div>

View File

@ -1,7 +1,8 @@
<?php
class Filtervp extends Module {
const FILTER_ID = 75;
const FILTER_SIZE = 272;
// const FILTER_ID = 75;
const FILTER_ID = 1;
// const FILTER_SIZE = 272;
public function __construct() {
$this->name = 'filtervp';
@ -23,29 +24,91 @@ class Filtervp extends Module {
return TRUE;
}
public function hookdisplayLeftVP($params) {
global $smarty;
$sizes = self::getAllValueAttr(Filtervp::FILTER_ID, Tools::getValue('id_category'));
public function hookPrivateSales_Edit($params) {
if (empty($sizes)) {
$sizes = self::getAllValueAttr(self::FILTER_SIZE, Tools::getValue('id_category'));
$name = self::getAttrName(self::FILTER_SIZE);
} else {
$name = self::getAttrName(self::FILTER_ID);
$attr_groups = Db::getInstance()->ExecuteS('
SELECT
al.`name`,
a.`id_attribute_group`'.($params['sale'] !== NULL? ', (
SELECT IFNULL(s.`id_sale`, NULL)
FROM `'._DB_PREFIX_.'attribute_group_ps` s
WHERE a.`id_attribute_group` = s.`id_attribute_group` AND s.`id_sale` = '.$params['sale']->id.'
) AS `id_sale`': '').'
FROM ps_attribute_group a
LEFT JOIN ps_attribute_group_lang al ON al.id_attribute_group = a.id_attribute_group
WHERE al.`id_lang` = 2
');
echo '
<div class="form-group">
<label class="control-label">'.$this->l('Attribute groups:').'</label>
<div class="">
<select id="attr_groups" name="attr_groups[]" multiple="multiple" size="5" class="form-control">';
$all_opt = array();
foreach($attr_groups as $attribute) {
$all_opt[] = $attribute['id_attribute_group'];
echo '<option value="'.$attribute['id_attribute_group'].'"'.(isset($attribute['id_sale']) && $attribute['id_sale'] !== NULL?' selected="selected"':'').'>'.$attribute['name'].'</option>';
}
echo '
</select>
</div>
<div class="btn-group btn-group-sm" role="group">
<button type="button" class="select_all_for_attr_group btn btn-default">Tout</button>
<button type="button" class="clear_for_attr_group btn btn-default">Clear</button>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#attr_groups").select2({
maximumSelectionLength: '.count($attr_groups).',
placeholder: "'.$this->l('Select one or more attribute group:').'",
allowClear: true
});
$(".select_all_for_attr_group").on("click", function () { $("#attr_groups").select2().val(["'.(implode('","',$all_opt)).'"]).trigger("change"); });
$(".clear_for_attr_group").on("click", function () { $("#attr_groups").select2().val(null).trigger("change"); });
});
</script>
<div class="clear"></div>
</div>';
}
if($name == 'Tailles') {
$name = 'Taille';
};
public function hookPrivateSales_Delete($params) {
Db::getInstance()->Execute('
DELETE FROM `'._DB_PREFIX_.'attribute_group_ps`
WHERE `id_sale` = '.$params['sale']->id
);
}
public function hookPrivateSales_Create($params) {
if($attr_groups = Tools::getValue('attr_groups')) {
foreach($attr_groups as $group) {
Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'attribute_group_ps` VALUES (
'.(int) $group.', '.$params['sale']->id.'
)
');
}
}
}
public function hookPrivateSales_Update($params) {
Db::getInstance()->Execute('
DELETE FROM `'._DB_PREFIX_.'attribute_group_ps`
WHERE `id_sale` = '.$params['sale']->id
);
$this->hookPrivateSales_Create($params);
}
public function hookdisplayLeftVP($params) {
global $smarty;
$attributes = self::getAllAttrByGroup(Tools::getValue('id_category'));
$smarty->assign(array(
'name' => $name,
'sizes' => $sizes,
'attr' => $attributes,
));
return $this->display(__FILE__, 'filter.tpl');
}
public static function getAllValueAttr($id_attr, $id_cat){
global $cookie;
@ -71,6 +134,35 @@ class Filtervp extends Module {
return $results;
}
public function getAllAttrByGroup($id_cat)
{
global $cookie;
$id_lang = $cookie->id_lang;
$results = Db::getInstance()->ExecuteS('
SELECT
al.`name`,
a.`id_attribute`,
agl.`name` as `group`
FROM
`'._DB_PREFIX_.'attribute` a
LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON al.id_lang = '.(int)$id_lang.' AND al.id_attribute = a.id_attribute
LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON agl.id_attribute_group = a.id_attribute_group AND agl.id_lang = '.(int)$id_lang.'
LEFT JOIN '._DB_PREFIX_.'attribute_group_ps agp ON agp.id_attribute_group = agl.id_attribute_group
LEFT JOIN '._DB_PREFIX_.'privatesale_category pc ON pc.id_sale = agp.id_sale
LEFT JOIN '._DB_PREFIX_.'category_product cp ON cp.id_category = pc.id_category
LEFT JOIN '._DB_PREFIX_.'product p ON cp.id_product = p.id_product
INNER JOIN ps_product_attribute pa ON pa.id_product = cp.id_product
INNER JOIN ps_product_attribute_combination pac ON pac.id_attribute = a.id_attribute AND pac.id_product_attribute = pa.id_product_attribute
WHERE agp.id_sale IS NOT NULL AND pc.id_category = '.(int)$id_cat.'
GROUP BY
a.`id_attribute`
ORDER BY
agl.`name` ASC, al.`name` ASC
');
return $results;
}
public static function getAttrName($id_attr){
global $cookie;
$id_lang = $cookie->id_lang;

View File

@ -264,7 +264,7 @@ if(count($lines)) {
array(495, 10, 'DT', 'DATFAC', date('d.m.Y')),
array(505, 10, 'DT', 'DATCDE', date('d.m.Y')),
array(515, 5, 'A', 'CALPHA', $address['lastname']),
array(520, 5, 'A', 'PRTMIS', ''),
array(520, 5, 'A', 'PRTMIS', '3BTK'),
array(525, 1, 'A', 'COLLEC', ''),
array(526, 1, 'A', 'TOPMDM', 'N'),
array(527, 2, 'A', 'TOPEMB', ''),

View File

@ -29,7 +29,7 @@
var PS_MRData = {$MR_Data};
var id_address = '{$address->id|intval}';
var ssl = {$ssl};
var weight = {$cart->getTotalWeight()|floatval} * 1000; // en Kg
var weight = parseInt({$cart->getTotalWeight()|floatval} * 1000); // en Kg
if( weight == 0 ) weight = 100;
//var weight = 999999; // en Kg
var iso_code = '{$country->iso_code|escape:'htmlall':'UTF-8'}';

View File

@ -229,7 +229,7 @@
VALUES (
'.(int) $id_order_detail.',
'.(int) $row['detail_quantity'].',
"'.pSQL($shipping_number['number']).'",
"'.pSQL(trim($shipping_number['number'])).'",
"'.$shipping_number['date'].'"
)
');
@ -339,6 +339,15 @@
') as $row) {
$sent_products[(int) $row['id_order_detail']] = (int) $row['quantity'];
}
foreach(Db::getInstance()->ExecuteS('
SELECT l.`id_order_detail`, SUM(l.`quantity`) AS `quantity`
FROM `'._DB_PREFIX_.'mondialrelay_parcel` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (l.`id_order_detail` = d.`id_order_detail`)
WHERE d.`id_order` IN ('.implode(', ', $id_orders).')
GROUP BY l.`id_order_detail`
') as $row) {
$sent_products[(int) $row['id_order_detail']] = (int) $row['quantity'];
}
foreach(Db::getInstance()->ExecuteS('
SELECT l.`id_order_detail`, SUM(l.`quantity`) AS `quantity`
FROM `'._DB_PREFIX_.'philea_parcel` l

View File

@ -949,7 +949,7 @@ class Sale {
foreach ($sales_order as $sale) {
if (!in_array($sale, $id_sales)) {
foreach(Db::getInstance()->executeS('
GREATEST(d.`product_quantity` - d.`product_quantity_refunded`, 0) as `p_quantity`
SELECT GREATEST(d.`product_quantity` - d.`product_quantity_refunded`, 0) as `p_quantity`
FROM `'._DB_PREFIX_.'product_ps_cache` c
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`product_id` = c.`id_product`)
WHERE d.`id_order` = '.(int)$key.'

View File

@ -7439,3 +7439,10 @@ table#carrierTable tbody td {
float:right;
background: #e26ea2;
}
.block_filter .content_filter h5{
font-size: 15px;
text-decoration: underline;
color: #514E8C;
margin:10px 0px;
}

View File

@ -652,6 +652,7 @@ $_LANG['product_801ab24683a4a8c433c6eb40c48bcd9d'] = 'Descargar';
$_LANG['product_98edb85b00d9527ad5acebe451b3fae6'] = 'Accesorios';
$_LANG['product_b16b1fd8f9d7e9a2e13f46d8ab5c460d'] = 'Plazo de entrega estimado de';
$_LANG['product_2cb89a2218fd65eb7ff6cadee6971805'] = '3 semanas';
$_LANG['product_36c60995077a3b5eb5ff416b80cc5091'] = 'Retraso específico según la marca';
$_LANG['product_77d3431a7762a970d92fbf926d292a38'] = 'Haz un pedido de varias marcas';
$_LANG['product_2d39cbe34b52916e3cf9adcbe16a1b60'] = '= pagarás sólo una vez los gastos de envío !';
$_LANG['product_dba25e6675be5fa38a43f015fd6f91d4'] = 'Pago';
@ -757,6 +758,8 @@ $_LANG['shopping-cart_f7b96335c6a33477579e43f3da368507'] = 'Disfrutar de nuestra
$_LANG['shopping-cart_4bfddaa41fee050e0c15efa9a5cb4c65'] = 'Ahorros conseguidos :';
$_LANG['shopping-cart_7bb63c7de5a5ee79356083a12f21e1e8'] = 'en vez de';
$_LANG['shopping-cart_e261a45e4cec10be2d5abcd2049f8ac7'] = 'Los gastos de envío se calcurán en el paso 3';
$_LANG['shopping-cart_ea3bd794dfeb4537c194ee43899516ed'] = 'Mi pedido es un regalo. Esta opción, genera una factura sin los precios indicados y permite añadir una pequeña dedicatoria sobre esta. ¡Ideal para enviar tu regalo directamente a casa de tus familiares o amigos! ';
$_LANG['shopping-cart_b4e59f3a4554655a099738382ebedbff'] = 'Si lo desea, puede añadir una nota al regalo:';
$_LANG['shopping-cart_af0f5bdc5be121b9307687aeeae38c17'] = 'Dirección de envío';
$_LANG['shopping-cart_601d8c4b9f72fc1862013c19b677a499'] = 'Dirección de facturación';
$_LANG['shopping-cart_f8617a92ba0a0a4eabee724eab7c9f48'] = 'Transportista:';

View File

@ -737,6 +737,8 @@ $_LANG['shopping-cart_f7b96335c6a33477579e43f3da368507'] = 'Profitez de nos offr
$_LANG['shopping-cart_4bfddaa41fee050e0c15efa9a5cb4c65'] = 'Les économies réalisées :';
$_LANG['shopping-cart_7bb63c7de5a5ee79356083a12f21e1e8'] = 'au lieu de';
$_LANG['shopping-cart_e261a45e4cec10be2d5abcd2049f8ac7'] = 'Les frais de port sont calculés en étape 3';
$_LANG['shopping-cart_ea3bd794dfeb4537c194ee43899516ed'] = 'Ma commande est un cadeau. Elle me permet de bénéficier d\'une facture sans prix et d\'insérer un petit mot sur cette dernière. C\'est idéal pour expédier votre cadeau directement chez vos proches !';
$_LANG['shopping-cart_b4e59f3a4554655a099738382ebedbff'] = 'Vous pouvez ajouter un message d\'accompagnement à votre commande.';
$_LANG['shopping-cart_af0f5bdc5be121b9307687aeeae38c17'] = 'Adresse de livraison';
$_LANG['shopping-cart_601d8c4b9f72fc1862013c19b677a499'] = 'Adresse de facturation';
$_LANG['shopping-cart_f8617a92ba0a0a4eabee724eab7c9f48'] = 'Transporteur :';