Commit 4ac0e8a6 authored by imac's avatar imac

[Update]Fixed menu

parent a174e96c
...@@ -810,6 +810,9 @@ nav ul ul{ ...@@ -810,6 +810,9 @@ nav ul ul{
display: none; display: none;
width: 190px; width: 190px;
} }
.header .nav-wrapper ul li.current ul{
display: block;
}
/*nav ul ul li:before{ /*nav ul ul li:before{
content: "•"; content: "•";
padding-right: 5px; padding-right: 5px;
...@@ -1150,7 +1153,7 @@ aside.news-wrapper { ...@@ -1150,7 +1153,7 @@ aside.news-wrapper {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
cursor:pointer; cursor:pointer;
} }
#slides .element-slider:last-child .image{ #slides .element-slider:last-child .image{
margin-bottom: 0px; margin-bottom: 0px;
...@@ -2682,7 +2685,7 @@ div.wpcf7-mail-sent-ok{ ...@@ -2682,7 +2685,7 @@ div.wpcf7-mail-sent-ok{
top: 0;left:0;right: 0; top: 0;left:0;right: 0;
/*margin:0 -4px -5px -2px;*/ /*margin:0 -4px -5px -2px;*/
transition: all .2s ease; transition: all .2s ease;
z-index: 9999999999999999; z-index: 999999;
} }
#loading-container-subpage{ #loading-container-subpage{
display: none; display: none;
......
...@@ -72,13 +72,13 @@ var initFunction=function(){ ...@@ -72,13 +72,13 @@ var initFunction=function(){
elemToScroll = $(document).find(".main"); elemToScroll = $(document).find(".main");
scrollAnchor('body', true); scrollAnchor('body', true);
} }
elemToScroll.on("scroll",{ items: "ul.phototheque li .subcat a"},onScroll); elemToScroll.on("scroll",onScroll);
document.getElementById('load-page').addEventListener('scroll', window.scrollAnimation.throttledEvent, false); document.getElementById('load-page').addEventListener('scroll', window.scrollAnimation.throttledEvent, false);
$(document).find('ul.phototheque').on('click',' li.parent-cat>a',function(e){ $(document).find('ul.main-list-nav').on('click',' li.parent-cat>a',function(e){
var windowWidth = $(window).width(); var windowWidth = $(window).width();
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
$('.phototheque>li').removeClass('current'); $('.main-list-nav>li').removeClass('current');
$(this).parent().addClass('current'); $(this).parent().addClass('current');
//if (windowWidth < 860){ //if (windowWidth < 860){
//$('.nav-phototeque .nav-content>ul>li').addClass('animated fadeOutLeft'); //$('.nav-phototeque .nav-content>ul>li').addClass('animated fadeOutLeft');
...@@ -87,9 +87,9 @@ var initFunction=function(){ ...@@ -87,9 +87,9 @@ var initFunction=function(){
//$('.nav-phototeque .nav-content li.current ul').css('display','inline-block !important'); //$('.nav-phototeque .nav-content li.current ul').css('display','inline-block !important');
//.phototheque-content nav li //.phototheque-content nav li
//}else{ //}else{
$('.phototheque .subcat').slideUp('slow'); $('.main-list-nav .subcat').stop().slideUp('slow');
$('.phototheque .off .subcat').slideUp(); // $('.main-list-nav .off .subcat').slideUp();
$(this).parent().find('.subcat').slideDown('slow'); $(this).parent().find('.subcat').stop().slideDown('slow');
//} //}
...@@ -97,7 +97,7 @@ var initFunction=function(){ ...@@ -97,7 +97,7 @@ var initFunction=function(){
setTimeout(function(){ setTimeout(function(){
$('.gallery-wrapper').removeClass('hidden-elem').addClass('animated visible-elem fadeInUp'); $('.gallery-wrapper').removeClass('hidden-elem').addClass('animated visible-elem fadeInUp');
$.fn.responsive(); $.fn.responsive();
},50) },100);
} }
function appendLoading() { function appendLoading() {
$('.load-page').append($('#loading-container-subpage').clone()); $('.load-page').append($('#loading-container-subpage').clone());
...@@ -110,11 +110,30 @@ var initFunction=function(){ ...@@ -110,11 +110,30 @@ var initFunction=function(){
e.preventDefault(); e.preventDefault();
var link = $(this).attr("href"), var link = $(this).attr("href"),
windowWidth = $(window).width(); windowWidth = $(window).width();
$('.load-page').parent().addClass('active'); if ($(this).parent().parent().hasClass('nav-page')){
$(document).find('.right-container').first().remove();
$('.load-page').parent().css({
'left':$('.nav-wrapper').outerWidth()
});
$('.load-page').css('opacity',1);
$(document).find('#loading-container-subpage').css({
'left': $('.nav-wrapper').outerWidth(),
'width': 'calc(100% - ' + $('.nav-wrapper').outerWidth()+'px)',
})
/**/
$('nav ul li').removeClass('current').addClass('off');
$(this).parent().addClass('current');
$(window)
/**/
}else{
$('.load-page').parent().css({
'left':0,
});
$('.load-page').parent().addClass('active');
}
history.pushState(null, null, link); history.pushState(null, null, link);
$('.load-page').load(link,function(){ $('.load-page').load(link,{'ajax' : 1},function(){
$.fn.loadPageContent(); $.fn.loadPageContent();
$('#loading-container-subpage').hide();
}); });
if (windowWidth < 860){ if (windowWidth < 860){
$( ".c-hamburger" ).trigger( "click" ); $( ".c-hamburger" ).trigger( "click" );
...@@ -161,6 +180,7 @@ $('#file-p').on('change',function(e){ ...@@ -161,6 +180,7 @@ $('#file-p').on('change',function(e){
$(document).on('click','.int-link',function(e){ $(document).on('click','.int-link',function(e){
e.preventDefault(); e.preventDefault();
$('.load-page').parent().removeClass('active'); $('.load-page').parent().removeClass('active');
$('.load-page').parent().css('left','100%');
history.pushState(null, null, $(this).find('a').attr('href')); history.pushState(null, null, $(this).find('a').attr('href'));
$('html').css('overflow','auto'); $('html').css('overflow','auto');
tlProduct.reverse(); tlProduct.reverse();
...@@ -634,6 +654,7 @@ function scrollAnchor(elemId, skipZero){ ...@@ -634,6 +654,7 @@ function scrollAnchor(elemId, skipZero){
$('.subcat').each(function(){ $('.subcat').each(function(){
$(this).find('a[href^="#"]').on('click', function (e) { $(this).find('a[href^="#"]').on('click', function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation();
$('a').each(function () { $('a').each(function () {
$(this).removeClass('active'); $(this).removeClass('active');
}) })
...@@ -720,7 +741,7 @@ $(document).ready(function(){ ...@@ -720,7 +741,7 @@ $(document).ready(function(){
$('.filter-bloc .list-color-filter li').setColorToWhite(); $('.filter-bloc .list-color-filter li').setColorToWhite();
setTimeout(function(){ setTimeout(function(){
onScrollCover(); onScrollCover();
}, 330); }, 330);
$.fn.open_nav(); $.fn.open_nav();
if ($(document).find('#load-page').children().length){ if ($(document).find('#load-page').children().length){
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
@ini_set('post_max_size', '64M'); @ini_set('post_max_size', '64M');
@ini_set('max_execution_time', '300'); @ini_set('max_execution_time', '300');
//Get Zones //Get Zones
function get_zones($post_ID = 157) { function get_zones($post_ID = 157) {
if (get_field('zones_commerciaux', $post_ID)): if (get_field('zones_commerciaux', $post_ID)):
$i = 0; $i = 0;
...@@ -88,7 +88,7 @@ function nap_change_wp_search_size($query) { ...@@ -88,7 +88,7 @@ function nap_change_wp_search_size($query) {
add_filter('pre_get_posts', 'nap_change_wp_search_size'); add_filter('pre_get_posts', 'nap_change_wp_search_size');
//Custom logo //Custom logo
function nap_custom_loginlogo() { function nap_custom_loginlogo() {
echo '<style type="text/css"> echo '<style type="text/css">
h1 a {background-image: url(' . home_url('wp-content/themes/nap/assets/images/logo.svg') . ') !important;width:102px !important;background-size:100px !important;height:52px !important;background: #05162b; h1 a {background-image: url(' . home_url('wp-content/themes/nap/assets/images/logo.svg') . ') !important;width:102px !important;background-size:100px !important;height:52px !important;background: #05162b;
...@@ -310,7 +310,7 @@ function nap_menu() { ...@@ -310,7 +310,7 @@ function nap_menu() {
} else { } else {
$nappe_sets = false; $nappe_sets = false;
} }
$menu.= '<li class ="parent-cat" data-page = "' . $category_id . '" data-img = "' . nap_category_image($category_id) . '"><a href="' . get_term_link($cat->slug, 'product_cat') . '">' . $cat->name . '</a>'; $menu.= '<li class ="parent-cat to-slide" data-page = "' . $category_id . '" data-img = "' . nap_category_image($category_id) . '"><a href="' . get_term_link($cat->slug, 'product_cat') . '">' . $cat->name . '</a>';
$args2 = array( $args2 = array(
'taxonomy' => $taxonomy, 'taxonomy' => $taxonomy,
...@@ -454,31 +454,31 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) { ...@@ -454,31 +454,31 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) {
if (isset($search['sku']) && $search['sku'] != '') { if (isset($search['sku']) && $search['sku'] != '') {
$serach_by_ref=true; $serach_by_ref=true;
$_product = wc_get_product($id); $_product = wc_get_product($id);
if( $_product->is_type( 'simple' ) ){ if( $_product->is_type( 'simple' ) ){
$product_id = get_product_by_sku( $search['sku'] ); $product_id = get_product_by_sku( $search['sku'] );
if($id == $product_id[0]->post_id) if($id == $product_id[0]->post_id)
$ref_product = 1; $ref_product = 1;
} elseif( $_product->is_type( 'variable' ) ){ } elseif( $_product->is_type( 'variable' ) ){
$variation = get_product_by_sku($search['sku']); $variation = get_product_by_sku($search['sku']);
$variation_id = $variation[0]->post_id; $variation_id = $variation[0]->post_id;
$variable_product = wc_get_product($variation_id); $variable_product = wc_get_product($variation_id);
if($id == $variable_product->parent_id) if($id == $variable_product->parent_id)
$ref_product = 1; $ref_product = 1;
} }
// print $ref_product; // print $ref_product;
} }
if (isset($search['pa_format']) && $search['pa_format'] != '') { if (isset($search['pa_format']) && $search['pa_format'] != '') {
$list_format = explode(",", $search['pa_format']); $list_format = explode(",", $search['pa_format']);
$intersect_format = array_intersect($list_attr['pa_format'], $list_format); $intersect_format = array_intersect($list_attr['pa_format'], $list_format);
...@@ -495,14 +495,14 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) { ...@@ -495,14 +495,14 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) {
if (isset($search['pa_univers']) && $search['pa_univers'] != '') { if (isset($search['pa_univers']) && $search['pa_univers'] != '') {
$list_univers = explode(",", $search['pa_univers']); $list_univers = explode(",", $search['pa_univers']);
} }
if( $serach_by_ref && $ref_product) if( $serach_by_ref && $ref_product)
{ echo nap_get_item($id, $args, 'catalogue', $options); { echo nap_get_item($id, $args, 'catalogue', $options);
return; return;
} }
if ( (!$serach_by_ref)&& if ( (!$serach_by_ref)&&
( ($list_couleur && !empty($intersect_couleur)) || empty($list_couleur) ) && ( ($list_couleur && !empty($intersect_couleur)) || empty($list_couleur) ) &&
( ($list_format && !empty($intersect_format)) || empty($list_format) ) && ( ($list_format && !empty($intersect_format)) || empty($list_format) ) &&
...@@ -512,7 +512,7 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) { ...@@ -512,7 +512,7 @@ function nap_filter_attribute($id, $args, $options, $list_attr, $search) {
echo nap_get_item($id, $args, 'catalogue', $options); echo nap_get_item($id, $args, 'catalogue', $options);
} }
} }
function nap_get_item($post_ID, $args = null, $current_page = '', $options = null, $search = null) { function nap_get_item($post_ID, $args = null, $current_page = '', $options = null, $search = null) {
...@@ -561,7 +561,7 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul ...@@ -561,7 +561,7 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
} }
$nap_article = '<article class = " visible row "> $nap_article = '<article class = " visible row ">
<a href="#"></a> <a href="#"></a>
<figure data-bg = "" class = "' . $size . ' transition"> <figure data-bg = "" class = "' . $size . ' transition">
<div class="abs-full article-bg transition"></div>'; <div class="abs-full article-bg transition"></div>';
$nap_article.= $nap_img; $nap_article.= $nap_img;
if ($current_page == 'catalogue') : if ($current_page == 'catalogue') :
...@@ -586,7 +586,7 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul ...@@ -586,7 +586,7 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
$nap_article.='</ul>'; $nap_article.='</ul>';
endif; endif;
$nap_article.='</figure> $nap_article.='</figure>
<h3 class = "font-small" >' . $title_item . '</h3> <h3 class = "font-small" >' . $title_item . '</h3>
</article>'; </article>';
...@@ -713,7 +713,7 @@ function externe_referrer() { ...@@ -713,7 +713,7 @@ function externe_referrer() {
$pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) && ($_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0' || $_SERVER['HTTP_CACHE_CONTROL'] == 'no-cache'); $pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) && ($_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0' || $_SERVER['HTTP_CACHE_CONTROL'] == 'no-cache');
//The second parameter on print_r returns the result to a variable rather than displaying it //The second parameter on print_r returns the result to a variable rather than displaying it
$RequestSignature = md5($_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'] . print_r($_POST, true)); $RequestSignature = md5($_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'] . print_r($_POST, true));
if (($pageWasRefreshed || empty($url))) { // && (from-site) //$_SESSION['LastRequest'] == $RequestSignature if (($pageWasRefreshed || empty($url))) { // && (from-site) //$_SESSION['LastRequest'] == $RequestSignature
$ref = true; $ref = true;
} else { } else {
$ref = false; $ref = false;
...@@ -880,7 +880,7 @@ add_filter( 'wpseo_metadesc', function( $description ) ...@@ -880,7 +880,7 @@ add_filter( 'wpseo_metadesc', function( $description )
global $post; global $post;
$terms = get_the_terms( $post->ID, 'product_cat' ); $terms = get_the_terms( $post->ID, 'product_cat' );
return return
( is_product() || (isset($product) && $product->is_type( 'variable' )) ) ( is_product() || (isset($product) && $product->is_type( 'variable' )) )
? $terms[1]->description ? $terms[1]->description
: $description; : $description;
...@@ -891,8 +891,8 @@ add_filter( 'wpseo_metadesc', function( $description ) ...@@ -891,8 +891,8 @@ add_filter( 'wpseo_metadesc', function( $description )
function get_product_by_sku( $sku ) { function get_product_by_sku( $sku ) {
global $wpdb; global $wpdb;
$post_item = $wpdb->get_results("SELECT post_id FROM np_postmeta WHERE meta_key='_sku' AND meta_value=".$sku." LIMIT 1"); $post_item = $wpdb->get_results("SELECT post_id FROM np_postmeta WHERE meta_key='_sku' AND meta_value=".$sku." LIMIT 1");
......
<div class="nav-content font-big"> <div class="nav-content font-big">
<?php <?php
$arrow = 'arrow-white'; $arrow = 'arrow-white nav-page';
if (isset($current_page) and $current_page == 'phototheque') { if (isset($current_page) and $current_page == 'phototheque') {
$arrow = 'arrow-blue phototheque'; $arrow = 'arrow-blue phototheque';
} }
?> ?>
<ul class = "<?php echo $arrow ?>"> <ul class = "main-list-nav <?php echo $arrow ?>">
<?php echo nap_menu(); ?> <?php echo nap_menu(); ?>
<li data-page = "uniqpaper" data-img = "<?php echo nap_attachment_image(151);?>"><a href="<?php echo get_permalink(151);?>">Personnalisation</a></li> <li class="to-slide" data-page = "uniqpaper" data-img = "<?php echo nap_attachment_image(151);?>"><a href="<?php echo get_permalink(151);?>">Personnalisation</a></li>
</ul> </ul>
<?php if (!(isset($current_page) and $current_page == 'phototheque')) { ?> <?php if (!(isset($current_page) and $current_page == 'phototheque')) { ?>
<ul class= "font-medium arrow-pink pink-list"> <ul class= "font-medium arrow-pink pink-list">
<li data-page = "stories" data-img = "<?php echo nap_attachment_image(154);?>"><a href="<?php echo get_permalink(154);?>">Stories</a></li> <li class="to-slide" data-page = "stories" data-img = "<?php echo nap_attachment_image(154);?>"><a href="<?php echo get_permalink(154);?>">Stories</a></li>
<li data-page = "contact" data-img = "<?php echo nap_attachment_image(157);?>" ><a href="<?php echo get_permalink(157);?>">Contact</a></li> <li class="to-slide" data-page = "contact" data-img = "<?php echo nap_attachment_image(157);?>" ><a href="<?php echo get_permalink(157);?>">Contact</a></li>
</ul> </ul>
<?php } ?> <?php } ?>
</div> </div>
\ No newline at end of file
...@@ -20,7 +20,10 @@ if (!defined('ABSPATH')) { ...@@ -20,7 +20,10 @@ if (!defined('ABSPATH')) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
$current_page = 'catalogue'; $current_page = 'catalogue';
get_header(); if (!(isset($_POST['ajax']))) {
get_header();
}
$product; $product;
$cate = get_queried_object(); $cate = get_queried_object();
$cateID = $cate->term_id; $cateID = $cate->term_id;
...@@ -33,8 +36,9 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -33,8 +36,9 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
?> ?>
<div class="container clearfix" id="catalogue" data-page = "<?php echo $cateID; ?>"> <div class="container clearfix" id="catalogue" data-page = "<?php echo $cateID; ?>">
<?php if (!(isset($_POST['ajax']))) { ?>
<div class="container-bg abs-full"></div> <div class="container-bg abs-full"></div>
<?php get_sidebar() ?> <?php get_sidebar(); } ?>
<div class="header mobile-nav display--only-mobile blue-bg fixed"> <div class="header mobile-nav display--only-mobile blue-bg fixed">
<div class="nav-wrapper blue-bg"> <div class="nav-wrapper blue-bg">
<ul></ul> <ul></ul>
...@@ -67,14 +71,14 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -67,14 +71,14 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$terms = nap_attribute_by_category($cateID, $value); $terms = nap_attribute_by_category($cateID, $value);
if ($value == 'pa_couleur') { if ($value == 'pa_couleur') {
$all_terms = get_terms($value); $all_terms = get_terms($value);
$colors_ids = array(); $colors_ids = array();
foreach($all_terms as $k => $v) { foreach($all_terms as $k => $v) {
$colors_ids[$v->name] = $v->term_id; $colors_ids[$v->name] = $v->term_id;
} }
$color_by_category = array_intersect($colors_ids, $terms); $color_by_category = array_intersect($colors_ids, $terms);
} }
if (!empty($terms) && !is_wp_error($terms)): if (!empty($terms) && !is_wp_error($terms)):
?> ?>
...@@ -82,9 +86,9 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -82,9 +86,9 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
<ul <?php if ($value == 'pa_couleur') echo 'class = "list-color-filter clearfix"'; ?> id="<?php echo $value; ?>"> <ul <?php if ($value == 'pa_couleur') echo 'class = "list-color-filter clearfix"'; ?> id="<?php echo $value; ?>">
<?php <?php
$colors = array(); $colors = array();
foreach ( $terms as $term) : foreach ( $terms as $term) :
if ($value == 'pa_couleur'): if ($value == 'pa_couleur'):
// var_dump($color_by_category); // var_dump($color_by_category);
$name_color = array_search($term,$color_by_category); $name_color = array_search($term,$color_by_category);
...@@ -94,12 +98,12 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -94,12 +98,12 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$filter_format = nap_selected_filter($_GET['pa_format'], $term); $filter_format = nap_selected_filter($_GET['pa_format'], $term);
$filter_matiere = nap_selected_filter($_GET['pa_matiere'], $term); $filter_matiere = nap_selected_filter($_GET['pa_matiere'], $term);
$filter_univers = nap_selected_filter($_GET['pa_univers'], $term); $filter_univers = nap_selected_filter($_GET['pa_univers'], $term);
?> ?>
<li class="<?php echo $filter_format . ' ' . $filter_matiere .' '.$filter_univers ?>"><?php echo $term; ?></li> <li class="<?php echo $filter_format . ' ' . $filter_matiere .' '.$filter_univers ?>"><?php echo $term; ?></li>
<?php <?php
endif; endif;
endforeach; endforeach;
foreach (array_unique($colors) as $name => $code) { foreach (array_unique($colors) as $name => $code) {
...@@ -141,7 +145,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -141,7 +145,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
<p><?php echo $value->description; ?></p> <p><?php echo $value->description; ?></p>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
<?php <?php
endforeach; endforeach;
?> ?>
...@@ -150,7 +154,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -150,7 +154,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
<div class="panel panel-content list-animation"> <div class="panel panel-content list-animation">
<?php if ($_GET['pa_couleur'] != '' || $_GET['pa_format'] != '' || $_GET['pa_matiere'] != '' || $_GET['pa_univers'] != '' || $_GET['sku'] != ''): ?> <?php if ($_GET['pa_couleur'] != '' || $_GET['pa_format'] != '' || $_GET['pa_matiere'] != '' || $_GET['pa_univers'] != '' || $_GET['sku'] != ''): ?>
<span class="search_result">Résultat de votre recherche :<span class="search_notfound" style="color:#ff6a5f"></span></span> <span class="search_result">Résultat de votre recherche :<span class="search_notfound" style="color:#ff6a5f"></span></span>
<?php endif; ?> <?php endif; ?>
<?php foreach ($child_category as $key => $value) : ?> <?php foreach ($child_category as $key => $value) : ?>
...@@ -188,19 +192,19 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -188,19 +192,19 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$attribute_value['pa_format'] = get_the_terms($id, 'pa_format'); $attribute_value['pa_format'] = get_the_terms($id, 'pa_format');
$attribute_value['pa_matiere'] = get_the_terms($id, 'pa_matiere'); $attribute_value['pa_matiere'] = get_the_terms($id, 'pa_matiere');
$attribute_value['pa_univers'] = get_the_terms($id, 'pa_univers'); $attribute_value['pa_univers'] = get_the_terms($id, 'pa_univers');
//var_dump($attribute_value['pa_format']); //var_dump($attribute_value['pa_format']);
if (is_array($attribute_value['pa_format'])) { if (is_array($attribute_value['pa_format'])) {
$list_formats =''; $list_formats ='';
foreach ($attribute_value['pa_format'] as $key => $value) { foreach ($attribute_value['pa_format'] as $key => $value) {
$list_formats .= $value->name.','; $list_formats .= $value->name.',';
} }
$list_att['pa_format'] = explode(',',$list_formats); $list_att['pa_format'] = explode(',',$list_formats);
} }
if ($_GET) { if ($_GET) {
if (is_array($attribute_value['pa_couleur'])) { if (is_array($attribute_value['pa_couleur'])) {
$list_couleurs =''; $list_couleurs ='';
...@@ -210,16 +214,16 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -210,16 +214,16 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
} }
$list_att['pa_couleur'] = explode(',',$list_couleurs); $list_att['pa_couleur'] = explode(',',$list_couleurs);
} }
if (is_array($attribute_value['pa_format'])) { if (is_array($attribute_value['pa_format'])) {
$list_formats =''; $list_formats ='';
foreach ($attribute_value['pa_format'] as $key => $value) { foreach ($attribute_value['pa_format'] as $key => $value) {
$list_formats .= $value->name.','; $list_formats .= $value->name.',';
} }
$list_att['pa_format'] = explode(',',$list_formats); $list_att['pa_format'] = explode(',',$list_formats);
} }
if (is_array($attribute_value['pa_matiere'])) { if (is_array($attribute_value['pa_matiere'])) {
foreach ($attribute_value['pa_matiere'] as $key => $value) { foreach ($attribute_value['pa_matiere'] as $key => $value) {
$list_att['pa_matiere'] = $value->name; $list_att['pa_matiere'] = $value->name;
...@@ -230,7 +234,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -230,7 +234,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$list_att['pa_univers'] = $value->name; $list_att['pa_univers'] = $value->name;
} }
} }
nap_filter_attribute($id, $args, $options, $list_att, $_GET); nap_filter_attribute($id, $args, $options, $list_att, $_GET);
} else { } else {
echo nap_get_item($id, $args, $current_page, $options); echo nap_get_item($id, $args, $current_page, $options);
...@@ -238,11 +242,14 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' ...@@ -238,11 +242,14 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
endwhile; endwhile;
wp_reset_query(); wp_reset_query();
?> ?>
</div> </div>
</section> </section>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php get_footer(); ?> <?php
if (!(isset($_POST['ajax']))) {
get_footer();
} ?>
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