Commit d929b995 authored by Nahla Shiri's avatar Nahla Shiri

correction variation + filter

parent adc6a1ce
......@@ -230,6 +230,7 @@ select,option{
display: block;
top: 80px;
font-size: 11px;
}
/*==========================================================================
II/ Helper..............Helper classes
......@@ -1504,10 +1505,10 @@ label.chevron.bottom::first-letter {
top: 45%;
}
.product-info .details{
padding: 12px 0px 18px;
padding: 12px 0px 0px;
}
.product-info .details p{
padding-bottom: 6px;
padding-bottom: 2px;
}
.entry-summary .price {
......@@ -1519,6 +1520,7 @@ label.chevron.bottom::first-letter {
line-height: 24px;
letter-spacing: 2px;
display: block;
margin-top:-5px;
}
.product-info .notice{
font-size: 9px;
......@@ -1703,9 +1705,9 @@ label.chevron.bottom::first-letter {
position: relative;
}
.phototheque-content .nav-phototeque{
padding: 40px 10px 40px 40px;
padding: 40px 20px 40px 40px;
max-width: 465px;
width: 34%;
/*width: 34%;*/
border-right: 1px solid rgba(26,26,26,0.2);
overflow: hidden;
height: 100%;
......@@ -1750,7 +1752,7 @@ label.chevron.bottom::first-letter {
}
.gallery-wrapper {
padding: 0px 30px 80px;
width: 65%;
width: 62%;
}
.gallery-wrapper h2{
/*padding-bottom: 41px;*/
......
......@@ -943,6 +943,14 @@
display: none;
height: 0;
}
.search_result {
position: relative;
display: block;
top: 30px;
font-size: 11px;
padding: 0 40px;
}
}
/*END (max-width: 860px) */
/* ------------------------*/ /* ---------->>> 620 <<<-----------*/ /* ------------------------*/
......
jQuery(document).ready(function() {
/*
jQuery(document).on('click', ".format-list", function() {
var format = jQuery(this).find('.format-desc').text();
jQuery('.info-format').text(format);
jQuery('.info-format-txt').text(format);
jQuery('p').each(function() {
var $this = jQuery(this);
if($this.html().replace(/\s|&nbsp;/g, '').length == 0) {
$this.remove();
}
});
*/
jQuery(document).on('click', ".download_file", function() {
var id;
var download_link = jQuery('.download_file_link').attr('href');
......@@ -21,61 +18,19 @@ jQuery(document).ready(function() {
else
id = variation_id;
var link = download_link + 'variation_id=' + id;
window.open(link, '_blank');
return false;
});
/*
jQuery(document).bind('change', 'input[name="variation_id"]', function() {
setTimeout(function(){
var varID = jQuery('input[name="variation_id"]').val();
if (varID != 0) {
var price = jQuery('.woocommerce-variation-price .woocommerce-Price-amount').text();
if(price == "")
{
price = jQuery('.summary .woocommerce-Price-amount').text();
}
var pq = jQuery('.woocommerce-variation-description').text();
jQuery('.price .crete').text(price + " ht");
jQuery('.pq').text(pq);
}
}, 800);
});
jQuery('li.format-list:first-child input').attr('checked', true);
jQuery(document).on('change', '.color-list input,.format-list input ', function() {
window.open(link, '_blank');
return false;
var name = jQuery(this).attr('name');
if (jQuery(this).is(':checked') && name == 'attribute_pa_couleur') {
jQuery('li.format-list:first-child input').attr('checked', true);
jQuery('.info-color').text(jQuery(this).attr('value'));
}
if (jQuery(this).is(':checked') && name == 'attribute_pa_format') {
var format = jQuery('.format-list.selected .format-desc').text();
jQuery('.info-format').text(format);
jQuery('.info-format-txt').text(format);
}
});
*/
jQuery("#search-btn").on('click', function() {
jQuery('article').show();
jQuery('.list-animation section').show();
jQuery('article').removeClass('selected');
jQuery('article').removeClass('hidden');
var tabcolor = [];
i = 0;
......@@ -107,36 +62,22 @@ jQuery(document).ready(function() {
var selected_univers = tabunivers.join(',');
var params = {pa_couleur: selected_colors, pa_format: selected_formats, pa_matiere: selected_matiere, pa_univers: selected_univers};
window.location.href = "?" + jQuery.param(params);
jQuery('.list-animation section').each(function() {
if (jQuery(this).find("article").length) {
/*history.pushState({}, null, "?" + jQuery.param(params));
jQuery.ajax({
type: 'GET',
url: '',
data: {"pa_couleur": selected_colors,"pa_format":selected_formats},
success: function(data) {
},
error: function() {
}
});
jQuery(".product-list article li").each(function() {
var product_color = jQuery(this).attr('data-color');
var product_format = jQuery(this).attr('data-format');
if (jQuery.inArray(product_color, tabcolor) >= 0 || jQuery.inArray(product_format, tabformat) >= 0) {
jQuery(this).closest('article').addClass('in_search');
}
});
*/
// console.log('article found');
}
else {
jQuery(this).hide();
}
});
});
jQuery(window).on('load',function() {
jQuery('.filter-bloc').removeClass('active');
jQuery('.filter-bloc ').each(function() {
if (jQuery(this).find('.bloc-content').length == 0) {
......@@ -145,18 +86,21 @@ jQuery(document).ready(function() {
}
});
var result_found = false;
jQuery('.list-animation section').each(function() {
if (jQuery(this).find("article").length) {
// console.log('article found');
result_found = true;
}
else {
jQuery(this).hide();
}
});
if(result_found == false)
jQuery('.search_notfound').text(' Aucun produit ne correspond à votre recherche');
});
......
......@@ -32,7 +32,7 @@ function loadProductContent() {
$attributes.each(function(i)
{
var $attr = $(this);
if (!$attr.hasClass('pa_couleur'))
if (!$attr.hasClass('pa_couleur') && !$attr.hasClass('pa_taille'))
{
console.log(i, $attr, $attr.find('input:not(:disabled):checked').length);
if (!$attr.find('input:not(:disabled):checked').length)
......@@ -42,6 +42,18 @@ function loadProductContent() {
$firstInput.change();
}
}
/*if ($attr.hasClass('pa_taille'))
{
console.log('--------' + i, $attr, $attr.find('input:not(:disabled):checked').length);
if (!$attr.find('input:not(:disabled):checked').length)
{ console.log('heeeere');
$firstInput = $attr.find('input:not(:disabled)').first();
$firstInput.prop('checked',true);
$firstInput.change();
}
}*/
});
});
function onFoundVariation()
......@@ -49,10 +61,16 @@ function loadProductContent() {
console.log('found variation');
//$('.variations_form .format_list input').prop('checked',false);
$('.variations_form .color-list input:disabled').prop('disabled',false);
$('.variations_form .attribute_pa_taille input:disabled').prop('disabled',false);
console.log('found', $('.variations_form .format-list input:checked + * + .format-desc'));
var format = $('.variations_form .format-list input:checked + * + .format-desc').text();
$('.info-format').text(format);
$('.info-format-txt').text(format);
//var format = $('.variations_form .format-list input:checked + * + .format-desc').text();
var format='';
$('.variations_form .format-list input:checked + * + .format-desc ').each(function() {
format = format + $(this).text()+'<br />';
});
$('.info-format').html(format);
$('.info-format-txt').html(format);
$('.info-color').text($('.color-list input:checked').attr('value'));
var varID = jQuery('input[name="variation_id"]').val();
......
......@@ -42,10 +42,13 @@ if(!$ext_ref) {
while (has_sub_field('tl_images', $post_ID)) :
$options = array();
$private = get_sub_field('prive_acces_pro');
$options['image'] = get_sub_field('tl_image');
$options['title'] = get_sub_field('tl_titre_image');
$options['dwnldLink'] = get_sub_field('tl_link');
echo nap_get_item($post_ID, null, '', $options);
if(!$private || (is_user_logged_in() && $private))
{echo nap_get_item($post_ID, null, '', $options);}
?>
<?php
......
......@@ -365,6 +365,6 @@ $mpdf=new mPDF('utf-8', 'Letter', 0, '', 0, 0, 20, 20, 0, 0);
$mpdf->WriteHTML($file_content);
$mpdf->Output('fiches-techniques/fiche-'.$fiche_num.'.pdf');
$pdf ='/fiches-techniques/fiche-'.$fiche_num.'.pdf';
$pdf ='/nap/fiches-techniques/fiche-'.$fiche_num.'.pdf';
header('Location:'.$pdf );
\ No newline at end of file
......@@ -13,10 +13,7 @@
<div class="row right footer-links">
<ul>
<li class='nl'><a href="#">newsletter</a></li>
<?php
if ( is_user_logged_in() ) { ?>
<li class="to-slide"><a href="<?php echo get_permalink(260)?>">téléchargements</a></li>
<?php } ?>
<li class="to-slide"><a href="<?php echo get_permalink(260)?>">téléchargements</a></li>
<li class="<?php if( !is_user_logged_in() ) echo " login-user"; else echo " to-slide";?>"><?php if ( is_user_logged_in() ) {?><a href="<?php echo get_permalink(3364);?>">photothèque</a><?php } else echo "<a>photothèque</a>"; ?></li>
<li class="to-slide"><a href="<?php echo get_permalink(171)?>">mentions légales</a></li>
</ul>
......
......@@ -289,7 +289,7 @@ function nap_menu() {
$pad_counts = 0;
$hierarchical = 1;
$title = '';
$empty = 0;
$empty = 1;
$args = array(
'taxonomy' => $taxonomy,
......@@ -450,9 +450,14 @@ function nap_distinct_format_variations($variations) {
function nap_filter_attribute($id, $args, $options, $list_attr, $search) {
if(isset($search['pa_format']) && $search['pa_format']!=''){
$list_format=explode(",", $search['pa_format']);
$intersect_format = array_intersect($list_attr['pa_format'],$list_format);
}
if(isset($search['pa_couleur']) && $search['pa_couleur']!=''){
$list_couleur=explode(",", $search['pa_couleur']);
if(isset($list_attr['pa_couleur']) && is_array($list_attr['pa_couleur']))
{$intersect_couleur = array_intersect($list_attr['pa_couleur'],$list_couleur);}
}
if(isset($search['pa_matiere']) && $search['pa_matiere']!=''){
$list_matiere=explode(",", $search['pa_matiere']);
......@@ -461,14 +466,16 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) {
$list_univers=explode(",", $search['pa_univers']);
}
if(
( ($list_couleur && in_array($list_attr['pa_couleur'],$list_couleur)) || empty($list_couleur) ) &&
( ($list_format && in_array($list_attr['pa_format'],$list_format)) || empty($list_format) ) &&
( ($list_couleur && !empty($intersect_couleur)) || empty($list_couleur) ) &&
( ($list_format && !empty($intersect_format)) || empty($list_format) ) &&
( ($list_univers && in_array($list_attr['pa_univers'],$list_univers)) || empty($list_univers) ) &&
( ($list_matiere && in_array($list_attr['pa_matiere'],$list_matiere)) || empty($list_matiere) )
)
{
echo nap_get_item($id, $args, 'catalogue', $options);
}
}
function nap_get_item($post_ID, $args = null, $current_page = '', $options = null, $search = null) {
......@@ -719,7 +726,14 @@ function nap_attribute_by_category($categorie, $attr) {
$products = get_posts($args);
$attribute = array();
foreach ($products as $key => $value) {
$list_attr = woocommerce_get_product_terms($value->ID, $attr, 'names');
if($attr == 'pa_couleur')
{
$list_attr = wc_get_product_terms($value->ID, $attr,array( 'fields' => 'ids' ));
}
else
{ $list_attr = woocommerce_get_product_terms($value->ID, $attr, 'names');}
// print_r($list_attr);
foreach ($list_attr as $key => $value) {
$attribute[] = $value;
}
......
......@@ -64,11 +64,18 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
</div>
<?php
$terms = nap_attribute_by_category($cateID, $value);
if ($value == 'pa_couleur') {
$terms = get_terms($value);
} else
$terms = nap_attribute_by_category($cateID, $value);
$all_terms = get_terms($value);
$colors_ids = array();
foreach($all_terms as $k => $v) {
$colors_ids[$v->name] = $v->term_id;
}
$color_by_category = array_intersect($colors_ids, $terms);
}
if (!empty($terms) && !is_wp_error($terms)):
?>
<div class="bloc-content">
......@@ -79,8 +86,10 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
foreach ( $terms as $term) :
if ($value == 'pa_couleur'):
$colors[$term->name] = get_field('couleurs', 'pa_couleur_' . $term->term_id);
// var_dump($color_by_category);
$name_color = array_search($term,$color_by_category);
$colors[$name_color] = get_field('couleurs', 'pa_couleur_' . $term);
//print_r($colors);
else :
$filter_format = nap_selected_filter($_GET['pa_format'], $term);
$filter_matiere = nap_selected_filter($_GET['pa_matiere'], $term);
......@@ -140,7 +149,8 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
<div class="right-panel right">
<div class="panel panel-content list-animation">
<?php if ($_GET['pa_couleur'] != '' || $_GET['pa_format'] != '' || $_GET['pa_matiere'] != ''): ?>
<span class="search_result">Résultat de votre recherche :</span>
<span class="search_result">Résultat de votre recherche :<span class="search_notfound" style="color:#ff6a5f"></span></span>
<?php endif; ?>
<?php foreach ($child_category as $key => $value) : ?>
......@@ -190,15 +200,15 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$list_att['pa_format'] = explode(',',$list_formats);
}
/* print '*********************';
var_dump($list_att['pa_format']);*/
if ($_GET) {
if (is_array($attribute_value['pa_couleur'])) {
$list_couleurs ='';
foreach ($attribute_value['pa_couleur'] as $key => $value) {
$list_att['pa_couleur'] = nap_color_attribute($value->slug);
// $list_att['pa_couleur'] = nap_color_attribute($value->slug);
$list_couleurs .= nap_color_attribute($value->slug).',';
}
$list_att['pa_couleur'] = explode(',',$list_couleurs);
}
if (is_array($attribute_value['pa_format'])) {
......
......@@ -147,7 +147,7 @@ do_action('woocommerce_before_add_to_cart_form');
<?php if (wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type('variable') )) : ?>
<span class="sku_wrapper"><span class="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : nap_variable_meta($current_variationID, 'sku'); ?></span></span>
<span class="sku_wrapper"><span class="sku">Réf. <?php echo ( $sku = $product->get_sku() ) ? $sku : nap_variable_meta($current_variationID, 'sku'); ?></span></span>
<?php endif; ?>
......
......@@ -78,7 +78,7 @@ if (!function_exists('print_attribute_radio')) {
'<img src="'.$default_active.'" class="active" id="'.$value.'-active" style ="height:35px;width:35px" alt="">';
}
$filtered_label = apply_filters('woocommerce_variation_option_name', $label);
printf('<li class="format-list "><input type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s>
printf('<li class="format-list '.$input_name.'"><input type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s>
<label class="format-label" for="xx%3$s">'.$format_img.'</label>
<div class="format-desc">'.$label.'</div>
......@@ -279,11 +279,11 @@ do_action('woocommerce_before_add_to_cart_form');
<div class="inner-product-info">
<div class="info-content">
<?php
$format = get_post_meta($current_variationID, 'attribute_pa_format', true);
$format_info = get_term_by('slug', $format, 'pa_format');
$format = $format_info->name;?>
$format = $format_info->name;?>
<h2 class = "crete font-small" ><?php echo $sub_cat[0]->name; ?></h2>
<h3 class = "crete font-small info-attr" ><span class="info-format"><?php echo $format ; ?></span> <span class="info-color"><?php echo$_GET['pa_couleur'] ?></span></h3>
<div class="details font-small">
......@@ -301,8 +301,7 @@ do_action('woocommerce_before_add_to_cart_form');
<?php if (wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type('variable') )) : ?>
<span class="sku_wrapper"><span class="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : nap_variable_meta($current_variationID, 'sku'); ?></span></span>
<span class="sku_wrapper">Réf. <span class="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : nap_variable_meta($current_variationID, 'sku'); ?></span></span>
<?php endif; ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment