Commit 1bbdde10 authored by Nahla Shiri's avatar Nahla Shiri

correction js + css + fiche technique

parent 43366f80
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -63,6 +63,14 @@ ...@@ -63,6 +63,14 @@
padding: 0px; padding: 0px;
color: #182566; color: #182566;
} }
::-webkit-scrollbar {
width: 0px; /* remove scrollbar space */
background: transparent; /* optional: just make scrollbar invisible */
}
.product-details .list {overflow: -moz-scrollbars-none;}
@keyframes fadein { @keyframes fadein {
from { from {
opacity:0; opacity:0;
...@@ -700,10 +708,10 @@ nav ul ul{ ...@@ -700,10 +708,10 @@ nav ul ul{
display: none; display: none;
width: 190px; width: 190px;
} }
nav ul ul li:before{ /*nav ul ul li:before{
content: "•"; content: "•";
padding-right: 5px; padding-right: 5px;
} }*/
nav ul ul li { nav ul ul li {
font-size: 14px; font-size: 14px;
font-weight: 300; font-weight: 300;
...@@ -791,6 +799,10 @@ VII/ Pages...............ALL pages ...@@ -791,6 +799,10 @@ VII/ Pages...............ALL pages
========================================================================== */ ========================================================================== */
/* --------------*/ /* ---------->>> HOME <<<-----------*/ /* --------------*/ /* --------------*/ /* ---------->>> HOME <<<-----------*/ /* --------------*/
#home {
background: rgba(7,17,48,0.5);
}
.img-wrapper{ .img-wrapper{
height: 100vh; height: 100vh;
background-size: cover; background-size: cover;
...@@ -865,20 +877,36 @@ aside.news-wrapper { ...@@ -865,20 +877,36 @@ aside.news-wrapper {
height: 100%; height: 100%;
} }
.product-images{ .product-images{
width: 59%; width: 59% !important;
padding: 39px; padding: 39px;
opacity: 0; opacity: 0;
text-align: center;
position: relative;
} }
.product-slides{
width: 80%; .product-images .close-panel{
position: absolute;
left: 5%;
}
.woocommerce-product-details__short-description {
display: none;
}
.product-slides .product-header {
text-align: left;
margin-left: 35px;
}
.product-slides {
width: 580px;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
padding-left: 60px; padding-left: 25px;
} }
.product-header{ .product-header{
color: #182566; color: #182566;
padding-bottom: 33px; padding: 22px 30px 33px;
padding-top: 22px;
} }
.product-header h3{ .product-header h3{
font-size: 25px; font-size: 25px;
...@@ -889,8 +917,8 @@ aside.news-wrapper { ...@@ -889,8 +917,8 @@ aside.news-wrapper {
position: relative; position: relative;
} }
#slides{ #slides{
/* width: 80%;*/ width: 415px;
width: 500px; /*width: 500px;*/
height: 100%; height: 100%;
margin: 0 auto; margin: 0 auto;
} }
...@@ -900,7 +928,7 @@ aside.news-wrapper { ...@@ -900,7 +928,7 @@ aside.news-wrapper {
margin: 0 auto; margin: 0 auto;
} }
.element-slider{ .element-slider{
height: 500px; height: 415px;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
...@@ -970,7 +998,7 @@ aside.news-wrapper { ...@@ -970,7 +998,7 @@ aside.news-wrapper {
margin-bottom: 12px; margin-bottom: 12px;
border-radius: 20px; border-radius: 20px;
position: relative; position: relative;
padding: 3px 0px; //padding: 3px 0px;
/*padding: 3px 10px 4px 3px; */ /*padding: 3px 10px 4px 3px; */
cursor: pointer; cursor: pointer;
text-align: center; text-align: center;
...@@ -979,6 +1007,7 @@ aside.news-wrapper { ...@@ -979,6 +1007,7 @@ aside.news-wrapper {
width: 25px; width: 25px;
display: block; display: block;
height: 25px; height: 25px;
line-height: 25px;
} }
.nav-slider ul li.active{ .nav-slider ul li.active{
background: #FF6A5F; background: #FF6A5F;
...@@ -989,8 +1018,8 @@ aside.news-wrapper { ...@@ -989,8 +1018,8 @@ aside.news-wrapper {
} }
.nav-slider ul li:hover{ .nav-slider ul li:hover{
background: #FF6A5F; background: #FF6A5F;
width: 100%; width: 150%;
padding-right: 13px; padding-right: 10px;
-webkit-transition: all .2s ease-in-out; -webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out; -moz-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out; -o-transition: all .2s ease-in-out;
...@@ -1059,14 +1088,21 @@ aside.news-wrapper { ...@@ -1059,14 +1088,21 @@ aside.news-wrapper {
} }
.product-details .list{ .product-details .list{
width: 50%; width: 50%;
padding: 40px 30px; padding: 40px 0px;
position: relative; position: relative;
height: 100%; height: 100%;
background: #fff; background: #fff;
overflow-y: auto; overflow-y: hidden;
opacity: 0; opacity: 0;
border-left: 1px solid rgba(26,26,26,0.1); border-left: 1px solid rgba(26,26,26,0.1);
} }
.product-details .list ul {
overflow-y: scroll;
max-height: 560px;
margin-right: -17px;
}
.border-l:before{ .border-l:before{
content: ''; content: '';
display: block; display: block;
...@@ -1101,10 +1137,31 @@ aside.news-wrapper { ...@@ -1101,10 +1137,31 @@ aside.news-wrapper {
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
} }
.pa_format ul li{ .pa_format ul li {
text-align: center; text-align: center;
margin-bottom: 25px;
color: #313D7A; color: #313D7A;
max-width: 85%;
}
.pa_format ul li label {
overflow: hidden;
display: block;
vertical-align: text-top;
}
label.chevron.bottom {
display: block;
width: 120%;
}
.pa_format ul li img {
vertical-align: top;
margin-top: -50px;
}
.pa_format ul li:last-of-type{
margin-bottom: 20px;
} }
.pa_format li.disabled{ .pa_format li.disabled{
color: rgba(26,26,26,0.2); color: rgba(26,26,26,0.2);
...@@ -1165,7 +1222,7 @@ aside.news-wrapper { ...@@ -1165,7 +1222,7 @@ aside.news-wrapper {
.product-info .info-content h2{ .product-info .info-content h2{
font-size: 20px; font-size: 20px;
line-height: 24px; line-height: 24px;
letter-spacing: 2px; letter-spacing: 1px;
text-transform: uppercase; text-transform: uppercase;
} }
.product-info .info-content h3{ .product-info .info-content h3{
...@@ -1184,6 +1241,11 @@ aside.news-wrapper { ...@@ -1184,6 +1241,11 @@ aside.news-wrapper {
.product-info .details p{ .product-info .details p{
padding-bottom: 6px; padding-bottom: 6px;
} }
.entry-summary .price {
font-size: 0;
}
.product-info .price{ .product-info .price{
font-size: 20px; font-size: 20px;
line-height: 24px; line-height: 24px;
...@@ -1340,6 +1402,7 @@ aside.news-wrapper { ...@@ -1340,6 +1402,7 @@ aside.news-wrapper {
-moz-appearance:none; -moz-appearance:none;
appearance:none; appearance:none;
position: relative; position: relative;
margin-left: -15px;
} }
.reset_variations, .quantity{ .reset_variations, .quantity{
display: none !important; display: none !important;
...@@ -1592,6 +1655,44 @@ aside.news-wrapper { ...@@ -1592,6 +1655,44 @@ aside.news-wrapper {
display: none; display: none;
} }
.filter-bloc .bloc-content ul {
overflow-y: auto;
max-height: 300px;
overflow-x: hidden;
}
.filter-bloc .list-color-filter li {
display: inline-block;
height: 15px;
width: 15px;
border-radius: 50%;
cursor: pointer;
text-align: center;
margin-bottom: 4px;
margin-right: 3px;
}
.filter-bloc .list-color-filter li.selected:before {
content: '\2713';
color: #fff;
margin: 0 auto;
font-size: 9px;
margin-bottom: 0px;
}
.filter-bloc .list-color-filter li:before {
content: '';
}
.filter-bloc .list-color-filter li:last-child {
width: 100%;
margin-top: 8px;
text-align: center;
font-size: 9px;
letter-spacing: 0.2px;
}
.filter-bloc ul li { .filter-bloc ul li {
display: block; display: block;
padding-bottom: 2px; padding-bottom: 2px;
...@@ -1629,6 +1730,10 @@ aside.news-wrapper { ...@@ -1629,6 +1730,10 @@ aside.news-wrapper {
cursor: pointer; cursor: pointer;
letter-spacing: 0.2px; letter-spacing: 0.2px;
} }
/******NS***********/
/*******************/
.cover-wrapper{ .cover-wrapper{
position: absolute; position: absolute;
left: 0; left: 0;
...@@ -1689,7 +1794,7 @@ aside.news-wrapper { ...@@ -1689,7 +1794,7 @@ aside.news-wrapper {
.right-container .right-panel{ .right-container .right-panel{
position: absolute; position: absolute;
right: 0; right: 0;
padding: 0px 17px; padding: 0px 15px;
padding-bottom: 100px; padding-bottom: 100px;
} }
.panel section > h2{ .panel section > h2{
......
...@@ -157,9 +157,11 @@ $(function(){ ...@@ -157,9 +157,11 @@ $(function(){
$this.addClass('active'); $this.addClass('active');
$('.filter-bloc .bloc-content').slideUp('slow'); $('.filter-bloc .bloc-content').slideUp('slow');
$this.find('.bloc-content').slideDown('slow'); $this.find('.bloc-content').slideDown('slow');
$('.commercial').slideUp('slow');
}else{ }else{
$this.removeClass('active'); $this.removeClass('active');
$this.find('.bloc-content').slideUp('slow'); $this.find('.bloc-content').slideUp('slow');
//$('.commercial').slideDown('slow');
} }
}).on('click','.filter-bloc li:not(.disabled,.reinit)',function(e){ }).on('click','.filter-bloc li:not(.disabled,.reinit)',function(e){
......
jQuery( document ).ready( function() { jQuery(document).ready(function() {
jQuery( document ).on('click',".download_file", function() { jQuery(document).on('click', ".download_file", function() {
var id ; var id;
var download_link = jQuery( '.download_file_link' ).attr('href'); var download_link = jQuery('.download_file_link').attr('href');
var current_var = jQuery( '.download_file_link' ).attr('id'); var current_var = jQuery('.download_file_link').attr('id');
var variation_id = jQuery( 'input[name="variation_id"]' ).val(); var variation_id = jQuery('input[name="variation_id"]').val();
if(variation_id == 0) if (variation_id == 0)
id = current_var; id = current_var;
else else
id = variation_id; id = variation_id;
var link = download_link+'?variation_id='+id; var link = download_link + 'variation_id=' + id;
window.open(link, '_blank'); window.open(link, '_blank');
return false; return false;
...@@ -19,26 +19,66 @@ jQuery( document ).ready( function() { ...@@ -19,26 +19,66 @@ jQuery( document ).ready( function() {
jQuery(document ).on('change','.color-list input,.format-list input ', function() { jQuery(document).on('change', '.color-list input,.format-list input ', function() {
var varID = jQuery( 'input[name="variation_id"]' ).val(); var varID = jQuery('input[name="variation_id"]').val();
if(varID != 0 ){ if (varID != 0) {
var price = jQuery('.woocommerce-variation-price .woocommerce-Price-amount').text(); var price = jQuery('.woocommerce-variation-price .woocommerce-Price-amount').text();
var pq = jQuery('.woocommerce-variation-description').text(); var pq = jQuery('.woocommerce-variation-description').text();
jQuery('.price .crete').text(price); jQuery('.price .crete').text(price);
jQuery('.pq').text(pq); jQuery('.pq').text(pq);
} }
var name= jQuery(this).attr('name'); var name = jQuery(this).attr('name');
if (jQuery(this).is(':checked') && name =='attribute_pa_couleur'){ if (jQuery(this).is(':checked') && name == 'attribute_pa_couleur') {
jQuery('.info-color').text(jQuery(this).attr('value')); jQuery('.info-color').text(jQuery(this).attr('value'));
} }
if (jQuery(this).is(':checked') && name =='attribute_pa_format'){ if (jQuery(this).is(':checked') && name == 'attribute_pa_format') {
jQuery('.info-format').text(jQuery(this).attr('value')); jQuery('.info-format').text(jQuery(this).attr('value'));
jQuery('.info-format-txt').text(jQuery(this).attr('value')); jQuery('.info-format-txt').text(jQuery(this).attr('value'));
} }
}); });
jQuery("#search-btn").on('click', function() {
jQuery('article').show();
jQuery('.list-animation section').show();
jQuery('article').removeClass('in_search');
//filtre couleur
var tabcolor = [];
i = 0;
jQuery(".list-color-filter .selected").each(function() {
tabcolor[i++] = jQuery(this).attr('data-color');
});
//console.log(tabcolor);
jQuery(".product-list article li").each(function() {
var product_color = jQuery(this).attr('data-color');
if (jQuery.inArray(product_color, tabcolor) >= 0) {
jQuery(this).closest('article').addClass('in_search');
}
});
if (tabcolor.length > 0)
{
jQuery('article:not(.in_search)').hide();
jQuery('.list-animation section').each(function() {
if (jQuery(this).find('article.in_search').length == 0) {
jQuery(this).hide();
}
});
}
});
}); });
\ No newline at end of file
...@@ -47,12 +47,16 @@ $(function(){ ...@@ -47,12 +47,16 @@ $(function(){
} }
}) })
} }
$.fn.selectFormat = function(){ $.fn.selectFormat = function(){
$(this).on('click',function(){ $(this).on('click',function(){
var actifImage = $(this).find('img').data('img-active'), var actifImage = $(this).find('img').data('img-active'),
initialImage = $(this).find('img').data('img'); initialImage = $(this).find('img').data('img');
$(this).parent().parent().find('li').each(function(){ $(this).parent().parent().find('li').each(function(){
img = $(this).find('img'); img = $(this).find('img');
img.attr('src',img.data('img')); img.attr('src',img.data('img'));
}) })
$(this).parent().parent().find('li').removeClass('selected'); $(this).parent().parent().find('li').removeClass('selected');
...@@ -88,11 +92,13 @@ $(function(){ ...@@ -88,11 +92,13 @@ $(function(){
tl = new TimelineMax() tl = new TimelineMax()
tl.staggerFromTo('.slides-wrapper .gallery article',0.3,{opacity:0,y:100},{opacity:1,y:0},0.1,0); tl.staggerFromTo('.slides-wrapper .gallery article',0.3,{opacity:0,y:100},{opacity:1,y:0},0.1,0);
tl.fromTo('.gallery',0.5,{opacity:0,visibility:"hidden"},{opacity:1,visibility:"visible"},0); tl.fromTo('.gallery',0.5,{opacity:0,visibility:"hidden"},{opacity:1,visibility:"visible"},0);
tl.fromTo('.nav-slider',0.1,{opacity:1},{opacity:0},0);
tl.fromTo('#slides',0.5,{opacity:1},{opacity:0},0); tl.fromTo('#slides',0.5,{opacity:1},{opacity:0},0);
tl.fromTo('.nav-slider',0.5,{opacity:1},{opacity:0},0);
}); });
$('.gallery').on('click','.close-btn,article',function(){ $('.gallery').on('click','.close-btn,article',function(){
tl.reverse(); $('.gallery').fadeTo( "slow", 0).css('visibility','hidden');
$('#slides,.nav-slider').fadeTo( "slow", 1);
}) })
} }
$.fn.showRightPanelAnimation = function(removeClass,addClass){ $.fn.showRightPanelAnimation = function(removeClass,addClass){
...@@ -119,16 +125,23 @@ $(function(){ ...@@ -119,16 +125,23 @@ $(function(){
}) })
} }
$.fn.productAnimation = function(){ $.fn.productAnimation = function(){
//first format Actif
var activeImg = $('.format-label #format_0').data('img-active');
$('.format-label #format_0').attr('src',activeImg);
tlProduct = new TimelineMax(); tlProduct = new TimelineMax();
tlProduct.fromTo('.product-images',1,{autoAlpha:0, marginLeft:"-10%"},{autoAlpha:1, marginLeft:"0"},0); tlProduct.fromTo('.product-images',0.2,{autoAlpha:0, marginLeft:"-10%"},{autoAlpha:1, marginLeft:"0"},0);
tlProduct.staggerFromTo('.product-details .list',0.7,{opacity:0, marginLeft:"-10%"},{opacity:1, marginLeft:"0"},0.4,0.5); tlProduct.staggerFromTo('.product-details .list',0.2,{opacity:0, marginLeft:"-10%"},{opacity:1, marginLeft:"0"},0.4,0.5);
tlProduct.fromTo('.product-info',1,{autoAlpha:0, marginLeft:"-10%"},{autoAlpha:1, marginLeft:"0"},1.2); tlProduct.fromTo('.product-info',0.2,{autoAlpha:0, marginLeft:"-10%"},{autoAlpha:1, marginLeft:"0"},1.2);
} }
$('.product-list article img, .product-list article ul li').on('click', function() { $('.product-list article img, .product-list article ul li').on('click', function() {
$('head').append($('.header-shop')); $('head').append($('.header-shop'));
var toLink = $(this).data('link'); var toLink = $(this).data('link');
$('.load-page').parent().addClass('active'); $('.load-page').parent().addClass('active');
$('.load-page').load(toLink,function(){ $('.load-page').load(toLink,function(){
//alert('here');
sizeProductDetails = $('.product-details .list').length; sizeProductDetails = $('.product-details .list').length;
if (sizeProductDetails < 2) { if (sizeProductDetails < 2) {
$('.product-info').outerWidth('78.3%'); $('.product-info').outerWidth('78.3%');
...@@ -151,7 +164,7 @@ $(function(){ ...@@ -151,7 +164,7 @@ $(function(){
$('.pa_couleur li').selectColor(); $('.pa_couleur li').selectColor();
$('.pa_format li').selectFormat(); $('.pa_format li').selectFormat();
$('.color-list.selected').selectSlide($('#slides')); $('.color-list.selected').selectSlide($('#slides'));
},500) },100)
$('.download-btn:not(.download_file)').click(function(e){ $('.download-btn:not(.download_file)').click(function(e){
e.stopPropagation(); e.stopPropagation();
}); });
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Template Name: Fiche technique * Template Name: Fiche technique
* *
*/ */
$nfiles = glob("devis/[!\\.]*"); $nfiles = glob("fiches-techniques/[!\\.]*");
if ($nfiles !== FALSE) { if ($nfiles !== FALSE) {
...@@ -15,26 +15,41 @@ if ($nfiles !== FALSE) { ...@@ -15,26 +15,41 @@ if ($nfiles !== FALSE) {
} }
$fiche_num = str_pad($nb_fiche, 6, "0", STR_PAD_LEFT); $fiche_num = str_pad($nb_fiche, 6, "0", STR_PAD_LEFT);
$product_id = $_GET['product_id'];
$variation_id = $_GET['variation_id']; $variation_id = $_GET['variation_id'];
$code_variation = nap_load_variation_settings_fields($variation_id); $file_title = "";
$fiche_id = $code_variation['var_fiche']; $product_cats = wp_get_post_terms($product_id, 'product_cat');
$file_title.=$product_cats[1]->name;
//fiche variable
if($variation_id !='undefined'){
$code_variation = nap_load_variation_settings_fields($variation_id);
$fiche_id = $code_variation['var_fiche'];
$sku = nap_variable_meta($variation_id, 'sku');
$gencod = $code_variation['var_gencod'];
$itf14 = $code_variation['var_itf14'] ;
$variable_product = wc_get_product($variation_id);
$thumb_image = get_the_post_thumbnail($variation_id, 'medium');
$file_title.="<br/>" . $variable_product->get_attribute('format') . " " . get_the_title($product_id);
$color="<span class='variation_color'><strong><em>Couleur </em>: " . $variable_product->get_attribute('couleur') . "</strong></span>";
}
$variable_product = wc_get_product($variation_id); //fiche simple
$product_title = $variable_product->get_title(); else {
$product_infos = get_page_by_title($product_title, OBJECT, 'product');
// titre = Catégorie + sous catégorie + format + tag $fiche_id = get_post_meta($product_id, '_fiche_simple', true);
$file_title = ""; $sku = get_post_meta($product_id, '_sku',true);
$product_cats = array_reverse(wp_get_post_terms($product_infos->ID, 'product_cat')); $gencod = get_post_meta($product_id, '_gencod_simple', true);
$itf14 = get_post_meta($product_id,'_itf14_simple', true);
$thumb_image = get_the_post_thumbnail($product_id, 'medium');
$file_title.=$product_cats[1]->name; $file_title.="<br/>" . get_the_title($product_id);
}
$product = wc_get_product($product_infos->ID);
$tags = $product->get_tag_ids();
$file_title.="<br/>" . $variable_product->get_attribute('format') . " " . get_tag($tags[0])->name;
$icones = ""; $icones = "";
if (get_field('fiche_icones', $fiche_id)): if (get_field('fiche_icones', $fiche_id)):
...@@ -45,7 +60,7 @@ if (get_field('fiche_icones', $fiche_id)): ...@@ -45,7 +60,7 @@ if (get_field('fiche_icones', $fiche_id)):
endwhile; endwhile;
endif; endif;
echo $file_content = "<html> $file_content = "<html>
<head><title>" . $file_title . "</title> <head><title>" . $file_title . "</title>
<style> <style>
.html,body { .html,body {
...@@ -106,10 +121,9 @@ echo $file_content = "<html> ...@@ -106,10 +121,9 @@ echo $file_content = "<html>
.thumb_var img { .thumb_var img {
max-width: 400px !important;
max-height: 400px !important;
padding-right: 100px; padding-right: 100px;
float: right;
} }
.gallery-item { .gallery-item {
...@@ -157,21 +171,21 @@ echo $file_content = "<html> ...@@ -157,21 +171,21 @@ echo $file_content = "<html>
</head> </head>
<body><div class='file_content'> <body><div class='file_content'>
<div class='file_header'> <div class='file_header'>
<div class='half_width thumb_var'> <div class='half_width thumb_var' style='text-align:center'>
" . $thumb_image = get_the_post_thumbnail($variation_id, 'shop_catalog') . " " . $thumb_image. "
</div> </div>
<div class='half_width'> <div class='half_width' style='margin-left:20px;'>
<h1>" . $file_title . "</h1> <h1>" . $file_title . "</h1>
<span class='variation_color'><strong><em>Couleur </em>: " . $variable_product->get_attribute('couleur') . "</strong></span> ".$color."
" . nap_get_content($fiche_id) . " " . nap_get_content($fiche_id) . "
<div>" . $icones . "</div> <div>" . $icones . "</div>
</div> </div>
</div> </div>
<div class='bleu_zone'> <div class='bleu_zone'>
<div class='half_width' style='position:relative; padding-left:30px'> <div class='half_width' style='position:relative; padding-left:30px'>
<p>Code article : " . $code_variation['var_code'] . "</p> <p>Code article : " . $sku . "</p>
<p>Gencod : " . $code_variation['var_gencod'] . "</p> <p>Gencod : " . $gencod. "</p>
<p>ITF 14 : " . $code_variation['var_itf14'] . "</p> <p>ITF 14 : " . $itf14 . "</p>
</div> </div>
...@@ -193,8 +207,10 @@ echo $file_content = "<html> ...@@ -193,8 +207,10 @@ echo $file_content = "<html>
<th>L (cm)</th> <th>L (cm)</th>
<th>l (cm)</th> <th>l (cm)</th>
<th>H (cm)</th> <th>H (cm)</th>
<th>Ø (cm)</th>
<th>Épaisseur (cm)</th> <th>Épaisseur (cm)</th>
<th>Capacité (cm)</th> <th>Capacité (cm)</th>
<th>Taille</th>
<th>Poids (g)</th> <th>Poids (g)</th>
</tr> </tr>
</thead> </thead>
...@@ -203,8 +219,10 @@ echo $file_content = "<html> ...@@ -203,8 +219,10 @@ echo $file_content = "<html>
<td>" . get_field('ft_unite_L1', $fiche_id) . "</td> <td>" . get_field('ft_unite_L1', $fiche_id) . "</td>
<td>" . get_field('ft_unite_l2', $fiche_id) . "</td> <td>" . get_field('ft_unite_l2', $fiche_id) . "</td>
<td>" . get_field('ft_unite_H', $fiche_id) . "</td> <td>" . get_field('ft_unite_H', $fiche_id) . "</td>
<td>" . get_field('ft_unite_diametre', $fiche_id) . "</td>
<td>" . get_field('ft_unite_epaisseur', $fiche_id) . "</td> <td>" . get_field('ft_unite_epaisseur', $fiche_id) . "</td>
<td>" . get_field('ft_unite_capacite', $fiche_id) . "</td> <td>" . get_field('ft_unite_capacite', $fiche_id) . "</td>
<td>" . get_field('ft_unite_taille', $fiche_id) . "</td>
<td>" . get_field('ft_unite_poids', $fiche_id) . "</td> <td>" . get_field('ft_unite_poids', $fiche_id) . "</td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -22,6 +22,13 @@ function get_zones($post_ID = 157) { ...@@ -22,6 +22,13 @@ function get_zones($post_ID = 157) {
return json_encode($allZones); return json_encode($allZones);
} }
function nap_enqueue_scripts() {
// Enqueue jQuery UI and autocomplete
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-autocomplete' );
}
add_action( 'wp_enqueue_scripts', 'nap_enqueue_scripts' );
//Dequeue CSS //Dequeue CSS
function nap_dequeue_unnecessary_css() { function nap_dequeue_unnecessary_css() {
wp_dequeue_style('additional-parent-style'); wp_dequeue_style('additional-parent-style');
...@@ -148,28 +155,13 @@ add_action('woocommerce_product_after_variable_attributes', 'nap_variation_setti ...@@ -148,28 +155,13 @@ add_action('woocommerce_product_after_variable_attributes', 'nap_variation_setti
function nap_variation_settings_fields($loop, $variation_data, $variation) { function nap_variation_settings_fields($loop, $variation_data, $variation) {
// code variation
woocommerce_wp_text_input(
array(
'id' => 'var_code_' . $variation->ID,
'label' => __('Code article', 'woocommerce'),
/* 'desc_tip' => 'true',
'description' => __( 'Ajouter le code article.', 'woocommerce' ), */
'value' => get_post_meta($variation->ID, '_var_code', true),
'custom_attributes' => array(
'step' => 'any',
'min' => '0'
)
)
);
// Gencode // Gencode
woocommerce_wp_text_input( woocommerce_wp_text_input(
array( array(
'id' => 'var_gencod_' . $variation->ID, 'id' => 'var_gencod_' . $variation->ID,
'label' => __('Gencod(EAN13)', 'woocommerce'), 'label' => __('Gencod(EAN13)', 'woocommerce'),
/* 'desc_tip' => 'true',
'description' => __( 'Ajouter le Gencod', 'woocommerce' ), */
'value' => get_post_meta($variation->ID, '_var_gencod', true), 'value' => get_post_meta($variation->ID, '_var_gencod', true),
'custom_attributes' => array( 'custom_attributes' => array(
'step' => 'any', 'step' => 'any',
...@@ -183,8 +175,6 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) { ...@@ -183,8 +175,6 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) {
array( array(
'id' => 'var_itf14_' . $variation->ID, 'id' => 'var_itf14_' . $variation->ID,
'label' => __('ITF 14', 'woocommerce'), 'label' => __('ITF 14', 'woocommerce'),
/* 'desc_tip' => 'true',
'description' => __( 'Ajouter le Gencod', 'woocommerce' ), */
'value' => get_post_meta($variation->ID, '_var_itf14', true), 'value' => get_post_meta($variation->ID, '_var_itf14', true),
'custom_attributes' => array( 'custom_attributes' => array(
'step' => 'any', 'step' => 'any',
...@@ -193,16 +183,53 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) { ...@@ -193,16 +183,53 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) {
) )
); );
// Select fiches techniques
$option = nap_post_type_listing('fiche_technique'); $option = nap_post_type_listing('fiche_technique');
woocommerce_wp_select( woocommerce_wp_text_input(
array(
'id' => 'fiche_var_auto_'. $variation->ID,
'name'=>'fiche_var_auto_'. $variation->ID,
'value' => get_post_meta($variation->ID, 'fiche_var_auto', true),
'label' => __( 'Fiche technique', 'woocommerce' ),
)
);?>
<script type="text/javascript">
jQuery(document).ready(function(){
var posts = <?php echo json_encode( $option ); ?>;
var data = [];
jQuery.each(posts, function( index, value ) {
data.push({'label':value, 'value':index});
});
jQuery('input[name="fiche_var_auto_<?php echo $variation->ID?>"]').click(function() {
jQuery(this).val('');
});
jQuery( 'input[name="fiche_var_auto_<?php echo $variation->ID?>"]' ).autocomplete({
source: data,
minLength: 1,
select: function(event, ui) {
event.preventDefault();
jQuery(this).val(ui.item.label);
jQuery("#_var_fiche_<?php echo $variation->ID?>").val(ui.item.value);
}
});
});
</script>
<?php
woocommerce_wp_hidden_input(
array( array(
'id' => 'var_fiche_' . $variation->ID, 'id' => '_var_fiche_'. $variation->ID,
'label' => __('Fiche technique ', 'woocommerce'), 'label' => __( 'Fiche technique', 'woocommerce' ),
'value' => get_post_meta($variation->ID, '_var_fiche', true), 'value' => get_post_meta($variation->ID, '_var_fiche', true),
'options' => $option 'name'=>'_var_fiche_'. $variation->ID,
) )
); );
} }
// Save Variation Settings // Save Variation Settings
...@@ -210,12 +237,6 @@ add_action('woocommerce_save_product_variation', 'nap_save_variation_settings_fi ...@@ -210,12 +237,6 @@ add_action('woocommerce_save_product_variation', 'nap_save_variation_settings_fi
function nap_save_variation_settings_fields($variation_id) { function nap_save_variation_settings_fields($variation_id) {
// code variation
$var_code = $_POST['var_code_' . $variation_id];
if (!empty($var_code)) {
update_post_meta($variation_id, '_var_code', esc_attr($var_code));
}
// Gencode // Gencode
$var_gencod = $_POST['var_gencod_' . $variation_id]; $var_gencod = $_POST['var_gencod_' . $variation_id];
if (!empty($var_gencod)) { if (!empty($var_gencod)) {
...@@ -228,10 +249,18 @@ function nap_save_variation_settings_fields($variation_id) { ...@@ -228,10 +249,18 @@ function nap_save_variation_settings_fields($variation_id) {
} }
// Select fiches techniques // Select fiches techniques
$var_fiche = $_POST['var_fiche_' . $variation_id]; $var_fiche = $_POST['_var_fiche_'. $variation_id];
if (!empty($var_fiche)) { if (!empty($var_fiche)) {
update_post_meta($variation_id, '_var_fiche', esc_attr($var_fiche)); update_post_meta($variation_id, '_var_fiche', esc_attr($var_fiche));
} }
$select_fiche = $_POST['fiche_var_auto_'.$variation_id];
if( ! empty( $select_fiche ) ) {
update_post_meta( $variation_id, 'fiche_var_auto', esc_attr( $select_fiche ) );
}
} }
function nap_load_variation_settings_fields($variations_id) { function nap_load_variation_settings_fields($variations_id) {
...@@ -252,7 +281,7 @@ function nap_category_image($catID) { ...@@ -252,7 +281,7 @@ function nap_category_image($catID) {
} }
function nap_attachment_image($pageID) { function nap_attachment_image($pageID) {
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id($pageID), 'default'); $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($pageID), 'large');
$url = $thumb['0']; $url = $thumb['0'];
return $url; return $url;
} }
...@@ -299,12 +328,12 @@ function nap_menu() { ...@@ -299,12 +328,12 @@ function nap_menu() {
if ($sub_cats) { if ($sub_cats) {
$class = ''; $class = '';
foreach ($sub_cats as $key => $sub_category) { foreach ($sub_cats as $key => $sub_category) {
$subcat_name = explode(' ', $sub_category->name);
if ($key == 0) if ($key == 0)
$calss = 'active'; $calss = 'active';
else else
$calss = ''; $calss = '';
$menu.= '<li data-cover = "' . nap_category_image($sub_category->term_id) . '"><a class="' . $calss . '" href="#cat' . $sub_category->term_id . '">' . $subcat_name[1] . '</a></li>'; $menu.= '<li data-cover = "' . nap_category_image($sub_category->term_id) . '"><a class="' . $calss . '" href="#cat' . $sub_category->term_id . '">' . $sub_category->name . '</a></li>';
} }
} }
...@@ -394,6 +423,13 @@ function nap_distinct_format_variations($variations) { ...@@ -394,6 +423,13 @@ function nap_distinct_format_variations($variations) {
} }
function nap_image_resize($image,$size){
$ext = substr($image, strrpos($image, "."));
$url = substr($image, 0, strrpos($image, "."));
return $newimage = $url . "-".$size."x".$size. $ext;
}
function nap_get_item($post_ID, $args = null, $current_page = '', $options = null) { function nap_get_item($post_ID, $args = null, $current_page = '', $options = null) {
$link = $image = $size = ''; $link = $image = $size = '';
...@@ -422,12 +458,20 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul ...@@ -422,12 +458,20 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
$nap_article .= '<ul class = "clearfix">'; $nap_article .= '<ul class = "clearfix">';
$variations = get_posts($args); $variations = get_posts($args);
$temp_colors = array(); $temp_colors = array();
if(!empty($variations)){
foreach ($variations as $key => $value) { foreach ($variations as $key => $value) {
$color = nap_variation_color($value->ID); $color = nap_variation_color($value->ID);
$format = nap_variation_format($value->ID);
if (!in_array($color, $temp_colors)) { if (!in_array($color, $temp_colors)) {
$temp_colors[] = $color; $temp_colors[] = $color;
$nap_article.='<li data-link = "' . get_permalink($post_ID) . nap_variation_url($value->ID) . '" data-image = "' . get_the_post_thumbnail_url($value->ID, 'thumbnail') . '" data-color = "' . $color . '"></li> ';
$nap_article.='<li data-link = "' . get_permalink($post_ID) . nap_variation_url($value->ID) . '" data-image = "' . nap_image_resize(get_the_post_thumbnail_url($value->ID),'200') . '" data-color = "' . $color . '" data-format = "' . $format . '"></li> ';
}
}
} }
else
{
$nap_article.='<li data-link = "' . get_permalink($post_ID). '" data-image = "' . nap_image_resize(get_the_post_thumbnail_url($value->ID),'200') . '"></li> ';
} }
$nap_article.='</ul>'; $nap_article.='</ul>';
endif; endif;
...@@ -460,3 +504,98 @@ function my_front_end_login_fail( $username ) { ...@@ -460,3 +504,98 @@ function my_front_end_login_fail( $username ) {
} }
add_action( 'woocommerce_product_options_general_product_data', 'nap_general_product_data_custom_field' );
function nap_general_product_data_custom_field($post_id) {
woocommerce_wp_text_input(
array(
'id' => '_gencod_simple',
'label' => __( 'Gencod(EAN13)', 'woocommerce' ),
)
);
woocommerce_wp_text_input(
array(
'id' => '_itf14_simple',
'label' => __( 'ITF 14', 'woocommerce' ),
)
);
$option = nap_post_type_listing('fiche_technique');
woocommerce_wp_text_input(
array(
'id' => 'fiche_simple_auto',
'name'=>'fiche_simple_auto',
'label' => __( 'Fiche technique', 'woocommerce' ),
)
);?>
<script type="text/javascript">
jQuery(document).ready(function(){
var posts = <?php echo json_encode( $option ); ?>;
var data = [];
jQuery.each(posts, function( index, value ) {
data.push({'label':value, 'value':index});
});
jQuery('input[name="fiche_simple_auto"]').click(function() {
jQuery(this).val('');
});
jQuery( 'input[name="fiche_simple_auto"]' ).autocomplete({
source: data,
minLength: 1,
select: function(event, ui) {
event.preventDefault();
jQuery(this).val(ui.item.label);
jQuery("#_fiche_simple").val(ui.item.value);
}
});
});
</script>
<?php
woocommerce_wp_hidden_input(
array(
'id' => '_fiche_simple',
'label' => __( 'Fiche technique', 'woocommerce' ),
'name'=>'_fiche_simple',
)
);
}
add_action( 'woocommerce_process_product_meta', 'nap_save_general_proddata_custom_field' );
function nap_save_general_proddata_custom_field( $post_id ) {
$select_fiche = $_POST['fiche_simple_auto'];
if( ! empty( $select_fiche ) ) {
update_post_meta( $post_id, 'fiche_simple_auto', esc_attr( $select_fiche ) );
}
$id_fiche = $_POST['_fiche_simple'];
if( ! empty( $id_fiche ) ) {
update_post_meta( $post_id, '_fiche_simple', esc_attr( $id_fiche ) );
}
$text_gencod = $_POST['_gencod_simple'];
if( ! empty( $text_gencod ) ) {
update_post_meta( $post_id, '_gencod_simple', esc_attr( $text_gencod ) );
}
$text_itf14 = $_POST['_itf14_simple'];
if( ! empty( $text_itf14 ) ) {
update_post_meta( $post_id, '_itf14_simple', esc_attr( $text_itf14 ) );
}
}
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<nav class="row"> <nav class="row">
<div class="main-nav nav-wrapper animated slideInLeft"> <div class="main-nav nav-wrapper animated slideInLeft">
<div class="nav-header"> <div class="nav-header">
<a href="<?php echo get_home_url(); ?>" title="nap by CGMP"><h1 class="logo" style="background: url('<?php echo home_url('wp-content/themes/nap/assets/css/img/naplogo.svg')?>')">nap by CGMP</h1></a> <a href="<?php echo get_home_url(); ?>" title="nap by CGMP"><h1 class="logo" >nap by CGMP</h1></a>
</div> </div>
<?php get_template_part( 'nav-list' );?> <?php get_template_part( 'nav-list' );?>
</div> </div>
......
...@@ -20,11 +20,12 @@ if (!defined('ABSPATH')) { ...@@ -20,11 +20,12 @@ if (!defined('ABSPATH')) {
} }
$current_page = 'catalogue'; $current_page = 'catalogue';
get_header(); get_header();
$product;
$cate = get_queried_object(); $cate = get_queried_object();
$cateID = $cate->term_id; $cateID = $cate->term_id;
//SubCats //SubCats
$child_category = get_terms('product_cat', array('parent'=>$cateID, 'child_of' => the_category_ID(), 'exclude' => $cateID, 'orderby' => 'id', 'order' => 'ASC')); $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of' => the_category_ID(), 'exclude' => $cateID, 'orderby' => 'id', 'order' => 'ASC'));
?> ?>
<div class="container clearfix" id="catalogue" data-page = "<?php echo $cateID; ?>"> <div class="container clearfix" id="catalogue" data-page = "<?php echo $cateID; ?>">
...@@ -42,71 +43,55 @@ $child_category = get_terms('product_cat', array('parent'=>$cateID, 'child_of' = ...@@ -42,71 +43,55 @@ $child_category = get_terms('product_cat', array('parent'=>$cateID, 'child_of' =
<span>Filtres</span> <span>Filtres</span>
<span class="close-btn"></span> <span class="close-btn"></span>
</div> </div>
<?php
$attributes = array('Univers' => 'pa_univers', 'Matiére' => 'pa_matiere', 'Format' => 'pa_format', 'Couleurs' => 'pa_couleur');
foreach ($attributes as $key => $value) :
?>
<div class="filter-bloc"> <div class="filter-bloc">
<div class="header"> <div class="header">
<p><span>Univers</span></p> <p><span><?php echo $key ?></span></p>
</div> </div>
<div class="bloc-content"> <?php
<ul> $terms = get_terms($value);
<li>Nouveautés</li>
<li>Noël</li>
<li class = "disabled">Printemps</li>
</ul>
</div>
</div> if (!empty($terms) && !is_wp_error($terms)):
<div class="filter-bloc"> ?>
<div class="header">
<p><span>Matiére</span></p>
</div>
<div class="bloc-content">
<ul>
<li>Nouveautés</li>
<li>Noël</li>
<li class = "disabled">Printemps</li>
</ul>
</div>
</div>
<div class="filter-bloc">
<div class="header">
<p><span>Format</span></p>
</div>
<div class="bloc-content">
<ul>
<li>Nouveautés</li>
<li>Noël</li>
<li class = "disabled">Printemps</li>
</ul>
</div>
</div>
<div class="filter-bloc">
<div class="header">
<p><span>Couleurs</span></p>
</div>
<div class="bloc-content"> <div class="bloc-content">
<ul class = "list-color-filter clearfix"> <ul <?php if ($value == 'pa_couleur') echo 'class = "list-color-filter clearfix"'; ?>>
<li data-color = "#7A3853"></li> <?php
<li data-color = "#fff"></li> foreach ($terms as $term) :
<li data-color = "#7A3853"></li> if ($value == 'pa_couleur'):
<li data-color = "#E8A380"></li> $color = get_field('couleurs', 'pa_couleur_' . $term->term_id);
<li data-color = "#fff"></li>
<li data-color = "#7A3853"></li> if (isset($color) && strlen($color) > 0):
<li data-color = "#E8A380"></li> ?>
<li data-color = "#fff"></li> <li data-color = "<?php echo $color; ?>" class="<?php echo $term->name; ?>"></li>
<li data-color = "#7A3853"></li> <?php
<li data-color = "#7A3853"></li> endif;
<li data-color = "#fff"></li> else :
<li data-color = "#7A3853"></li> ?>
<li data-color = "#E8A380"></li> <li><?php echo $term->name; ?></li>
<li data-color = "#fff"></li> <?php
<li data-color = "#7A3853"></li> endif;
endforeach;
if ($value == 'pa_couleur'):
?>
<li class="reinit">Tout déselectionner</li> <li class="reinit">Tout déselectionner</li>
<?php endif; ?>
</ul> </ul>
</div> </div>
<?php endif; ?>
</div> </div>
<?php endforeach; ?>
<div class="center filter-btn-list"> <div class="center filter-btn-list">
<div class="btn pink-btn rounded">Rechercher</div> <div class="btn pink-btn rounded" id="search-btn">Rechercher</div>
<span class = "reinit-all">Effacer les filtres</span> <span class = "reinit-all">Effacer les filtres</span>
</div> </div>
</div> </div>
...@@ -136,9 +121,9 @@ $child_category = get_terms('product_cat', array('parent'=>$cateID, 'child_of' = ...@@ -136,9 +121,9 @@ $child_category = get_terms('product_cat', array('parent'=>$cateID, 'child_of' =
while ($naps_posts->have_posts()) : $naps_posts->the_post(); while ($naps_posts->have_posts()) : $naps_posts->the_post();
$id = get_the_ID(); $id = get_the_ID();
$options['size'] = (get_field('produit_affichage',$id ))? get_field('produit_affichage',$id ):'small'; $options['size'] = (get_field('produit_affichage', $id)) ? get_field('produit_affichage', $id) : 'small';
$args = array( $args = array(
'post_type' => 'product_variation', 'post_type' => array('product', 'product_variation'),
'post_status' => array('private', 'publish'), 'post_status' => array('private', 'publish'),
'numberposts' => -1, 'numberposts' => -1,
'orderby' => 'menu_order', 'orderby' => 'menu_order',
......
<?php <?php
//print_r($_GET);
/** /**
* Simple product add to cart * Variable product add to cart
* *
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/simple.php. * This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/variable.php.
* *
* HOWEVER, on occasion WooCommerce will need to update template files and you * HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to * (the theme developer) will need to copy the new files to your theme to
...@@ -15,56 +16,216 @@ ...@@ -15,56 +16,216 @@
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.0.0 * @version 3.0.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if (!defined('ABSPATH')) {
exit; exit;
} }
global $product; global $product;
$id = get_the_ID();
$product_cats = wp_get_post_terms($id, 'product_cat');
//print_r($product_cats);
$subcat_iD = $product_cats[0]->term_id;
//$current_variationID = $_GET['variation_id'];
if ( ! $product->is_purchasable() ) { /* if (!function_exists('print_attribute_radio')) {
return;
}
echo wc_get_stock_html( $product ); function print_attribute_radio($checked_value, $value, $label, $name, $index=0) {
if ( $product->is_in_stock() ) : ?> $current_color = $_GET['attribute_couleur'];
$selected = $default_checked = "";
if ($value == strtolower($current_color)){
$default_checked = "checked";
$selected = "selected";
}
<?php do_action( 'woocommerce_before_add_to_cart_form' ); ?> $checked = sanitize_title($checked_value) === $checked_value ? checked($checked_value, sanitize_title($value), false) : checked($checked_value, $value, false);
<form class="cart" method="post" enctype='multipart/form-data'> $input_name = 'attribute_' . esc_attr($name);
<?php
/**
* @since 2.1.0.
*/
do_action( 'woocommerce_before_add_to_cart_button' );
/** $esc_value = esc_attr($value);
* @since 3.0.0. $id = esc_attr($name . '_v_' . $value);
*/ if ($name == 'pa_couleur') {
do_action( 'woocommerce_before_add_to_cart_quantity' ); $hexa = nap_color_attribute($value);
$filtered_label = apply_filters('woocommerce_variation_option_name', $label);
printf(' <style>
#' . $id . ':after { background-color: ' . $hexa . '; }
</style><li class="color-list '.$selected.' " data-color="' . $hexa . '">
<input data-color="' . $hexa . '" type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s ' . $default_checked . '></li>', $input_name, $esc_value, $id, $checked, $filtered_label);
} else {
$icons = nap_icon_format($value);
$format_img='<img src="'.$icons['inactive'].'" data-img = "'.$icons['inactive'].'" data-img-active = "'.$icons['active'].'" id="format_'.$index.'">';
woocommerce_quantity_input( array(
'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : $product->get_min_purchase_quantity(),
) );
/** $filtered_label = apply_filters('woocommerce_variation_option_name', $label);
* @since 3.0.0. printf('<li class="format-list selected"><input type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s>
<label class="format-label" for="%3$s">'.$format_img.'</label>
<div class="format-desc">'.$value.'</span>
</li>', $input_name, $esc_value, $id, $checked, $filtered_label); //<label class="format-label" style="background:url(' . $icons['inactive'] . ')" for="%3$s"></label>
}
}
}
*
*/ */
do_action( 'woocommerce_after_add_to_cart_quantity' );
do_action('woocommerce_before_add_to_cart_form');
?>
<div id="product" class="clearfix">
<div class="product-images row animated">
<div class = "btn-wrapper row close-panel">
<div class="pink-btn circle-btn"><a href="#"><span class = "abs-center backlink">Retour</span></a></div>
</div>
<div class="product-slides row">
<div class="product-header">
<h2 class="crete -italic font-small"><?php echo $product_cats[0]->name ?></h2>
<h3 class="crete"><?php the_title(); ?></h3>
</div>
<div class="slides-wrapper center">
<div class="row">
<div class="nav-slider transition">
<ul>
<li id = "mozaique"><span class="icon mozaique row"></span><span class="desc">Mozaïque</span></li>
<li id = "zoom" data-active="false" ><span class="icon zoom"></span><span class="desc">Zoom</span></li>
<li><span class="icon download"></span><span class="desc">Télécharger</span></li>
</ul>
</div>
<div id="slides">
<?php
?> ?>
<div style="background-image:url('<?php echo get_the_post_thumbnail_url($ID, 'medium') ?>')" class="image element-slider easyzoom easyzoom--overlay easyzoom--with-toggle" data-slick-index = "1">
<a href="<?php echo get_the_post_thumbnail_url($ID, 'full') ?>">
<!--<img src="<?php echo get_the_post_thumbnail_url($ID, 'medium') ?>" alt="" />-->
</a>
</div>
<button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
<?php <?php
/** /* if (get_field('images_ambiance', 'product_cat_' . $subcat_iD)):
* @since 2.1.0. $ambiance = array();
*/ while (has_sub_field('images_ambiance', 'product_cat_' . $subcat_iD)) :
do_action( 'woocommerce_after_add_to_cart_button' ); $image_amb = get_sub_field('img_ab');
$ambiance [] = $image_amb;
$attachment = wp_get_attachment_image_src($image_amb, 'medium');
$hd = wp_get_attachment_image_src($image_amb, 'full');
?> ?>
</form> <div style="background-image:url('<?php echo $attachment[0]; ?>')" class="image element-slider easyzoom easyzoom--overlay easyzoom--with-toggle" data-slick-index = "1">
<a href="<?php echo $hd[0]; ?>">
<!--<img src="<?php echo $attachment[0]; ?>" alt="" />-->
</a>
</div>
<?php
endwhile;
endif; */
?>
</div>
</div>
<div class="gallery clearfix">
<div class="gallery-content clearfix">
<span class="close-btn"></span>
<article class = "row" data-color = "">
<a href="<?php echo get_the_post_thumbnail_url($ID, 'full') ?>"></a>
<figure>
<img src="<?php echo get_the_post_thumbnail_url($ID, 'medium') ?>" alt="" title="">
</figure>
</article>
<?php
if (!empty($ambiance)):
foreach ($ambiance as $key => $value) :
$attachment = wp_get_attachment_image_src($value, 'medium');
$hd = wp_get_attachment_image_src($value, 'full');
?>
<article class = "row" data-color = "red">
<a class = "download-btn" href="<?php echo $hd[0]; ?>" download></a>
<figure>
<img src="<?php echo $attachment[0]; ?>" alt="" title="">
</figure>
</article>
<?php
endforeach;
endif;
?>
</div>
</div>
</div>
</div>
</div>
<?php $formats = explode(',', nap_variation_format($id)); ?>
<div class="product-details full-height row right transition">
<div class="product-info row center right border-l">
<div class="info-content">
<?php $formats = explode(',', nap_variation_format($id)); ?>
<h2 class = "crete font-small" ><?php echo $product_cats[0]->name ?></h2>
<h3 class = "crete font-small info-attr" ><span class="info-format"><?php echo $formats[0]; ?></span> <span class="info-color"><?php echo$_GET['attribute_couleur'] ?></span></h3>
<div class="details font-small">
<p class="info-format-txt">
<?php echo $formats[0]; ?>
</p>
<p class="pq"><?php echo do_shortcode(get_the_excerpt());?></p>
</div>
<div class="price">
<span class="crete"><?php echo $price = get_post_meta(get_the_ID(), '_regular_price', true); ?> € ht</span>
<div class="notice">( prix public conseillé )</div>
<div class="font-small">
<div class="product_meta">
<?php do_action('woocommerce_product_meta_start'); ?>
<?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>
<?php endif; ?>
<?php do_action('woocommerce_product_meta_end'); ?>
</div>
</div>
</div>
</div>
<div class = "btn-list">
<a href="<?php echo get_permalink(157); ?>" class="btn pink-btn rounded">Nous contacter</a>
<a class="btn pink-btn rounded download-btn download_file">Télécharger la fiche technique </a>
<a href="<?php echo get_permalink(43); ?>?product_id=<?php echo $product->get_id() ?>&" class="hidden download_file_link" id="<?php echo $current_variationID ?>"></a>
</div>
<div class="font-small circle-btn add-icon show-product"><span class= "abs-center">Produits associées</span></div>
</div>
</div>
<div class="product-list transition border-l fixed">
<div class="suggest-header">
<h2>Produits associés</h2>
<span class="close-btn"></span>
</div>
<div class="product-list-content">
<article class = "row full-width">
<a href="#"></a>
<figure>
<img src="http://nap.mano.fr/wp-content/uploads/2017/07/505714-papier-toilette-jumbo-500x375.jpg" alt="" title="">
</figure>
<h3 class = "font-small" >Bobines papier toilette</h3>
</article>
<article class = "row full-width">
<a href="#"></a>
<figure>
<img src="http://nap.mano.fr/wp-content/uploads/2017/07/450108-flexibles-noirs-21cm-315x500.jpg" alt="" title="">
</figure>
<h3 class = "font-small" >Pailles</h3>
</article>
<?php do_action( 'woocommerce_after_add_to_cart_form' ); ?>
<?php endif; ?> </div>
</div>
</div>
...@@ -24,13 +24,15 @@ global $product; ...@@ -24,13 +24,15 @@ global $product;
$attribute_keys = array_keys($attributes); $attribute_keys = array_keys($attributes);
$product_cats = array_reverse(wp_get_post_terms($product->get_id(), 'product_cat')); $product_cats = wp_get_post_terms($product->get_id(), 'product_cat');
$subcat_iD = $product_cats[1]->term_id; $subcat_iD = $product_cats[1]->term_id;
$current_variationID = $_GET['variation_id']; $current_variationID = $_GET['variation_id'];
if (!function_exists('print_attribute_radio')) { if (!function_exists('print_attribute_radio')) {
function print_attribute_radio($checked_value, $value, $label, $name) { function print_attribute_radio($checked_value, $value, $label, $name, $index=0) {
$current_color = $_GET['attribute_couleur']; $current_color = $_GET['attribute_couleur'];
$selected = $default_checked = ""; $selected = $default_checked = "";
if ($value == strtolower($current_color)){ if ($value == strtolower($current_color)){
...@@ -53,10 +55,14 @@ if (!function_exists('print_attribute_radio')) { ...@@ -53,10 +55,14 @@ if (!function_exists('print_attribute_radio')) {
<input data-color="' . $hexa . '" type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s ' . $default_checked . '></li>', $input_name, $esc_value, $id, $checked, $filtered_label); <input data-color="' . $hexa . '" type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s ' . $default_checked . '></li>', $input_name, $esc_value, $id, $checked, $filtered_label);
} else { } else {
$icons = nap_icon_format($value); $icons = nap_icon_format($value);
$format_img='<img src="'.$icons['inactive'].'" data-img = "'.$icons['inactive'].'" data-img-active = "'.$icons['active'].'" id="format_'.$index.'">';
$filtered_label = apply_filters('woocommerce_variation_option_name', $label); $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 selected"><input type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s>
<label class="format-label" for="%3$s"><img src="'.$icons['inactive'].'" data-img = "'.$icons['inactive'].'" data-img-active = "'.$icons['active'].'"></label> <label class="format-label" for="%3$s">'.$format_img.'</label>
<div class="format-desc">'.$value.'</span> <div class="format-desc">'.$value.'</span>
</li>', $input_name, $esc_value, $id, $checked, $filtered_label); //<label class="format-label" style="background:url(' . $icons['inactive'] . ')" for="%3$s"></label> </li>', $input_name, $esc_value, $id, $checked, $filtered_label); //<label class="format-label" style="background:url(' . $icons['inactive'] . ')" for="%3$s"></label>
} }
...@@ -75,7 +81,7 @@ do_action('woocommerce_before_add_to_cart_form'); ...@@ -75,7 +81,7 @@ do_action('woocommerce_before_add_to_cart_form');
<div class="product-slides row"> <div class="product-slides row">
<div class="product-header"> <div class="product-header">
<h2 class="crete -italic font-small"><?php echo $product_cats[1]->name ?></h2> <h2 class="crete -italic font-small"><?php echo $product_cats[1]->name ?></h2>
<h3 class="crete"><?php the_title(); ?></h3> <h3 class="crete"><?php the_title();?></h3>
</div> </div>
<div class="slides-wrapper center"> <div class="slides-wrapper center">
<div class="row"> <div class="row">
...@@ -137,7 +143,7 @@ do_action('woocommerce_before_add_to_cart_form'); ...@@ -137,7 +143,7 @@ do_action('woocommerce_before_add_to_cart_form');
</article> </article>
<?php <?php
endforeach; endforeach;
if(!empty($ambiance)):
foreach ($ambiance as $key => $value) : foreach ($ambiance as $key => $value) :
$attachment = wp_get_attachment_image_src($value, 'medium'); $attachment = wp_get_attachment_image_src($value, 'medium');
$hd = wp_get_attachment_image_src($value, 'full'); $hd = wp_get_attachment_image_src($value, 'full');
...@@ -149,7 +155,10 @@ do_action('woocommerce_before_add_to_cart_form'); ...@@ -149,7 +155,10 @@ do_action('woocommerce_before_add_to_cart_form');
<img src="<?php echo $attachment[0]; ?>" alt="" title=""> <img src="<?php echo $attachment[0]; ?>" alt="" title="">
</figure> </figure>
</article> </article>
<?php endforeach; ?> <?php
endforeach;
endif;
?>
</div> </div>
...@@ -175,7 +184,7 @@ do_action('woocommerce_before_add_to_cart_form'); ...@@ -175,7 +184,7 @@ do_action('woocommerce_before_add_to_cart_form');
<div class="list row <?php echo $name;?> left border-l center"> <div class="list row <?php echo $name;?> left border-l center">
<div class="product-header center font-small label"> <div class="product-header center font-small label">
<label for="<?php echo sanitize_title($name); ?>" class = "chevron bottom">Choix <?php if($i==0) echo 'de la '; else echo 'du '; ?><?php echo wc_attribute_label($name); ?></label> <label for="<?php echo sanitize_title($name); ?>" class = "chevron bottom"> <?php if($i==0) echo 'choix de la '; else echo 'choix du '; ?><?php echo strtolower(wc_attribute_label($name)); ?></label>
</div> </div>
<?php <?php
$sanitized_name = sanitize_title($name); $sanitized_name = sanitize_title($name);
...@@ -194,15 +203,17 @@ do_action('woocommerce_before_add_to_cart_form'); ...@@ -194,15 +203,17 @@ do_action('woocommerce_before_add_to_cart_form');
// Get terms if this is a taxonomy - ordered. We need the names too. // Get terms if this is a taxonomy - ordered. We need the names too.
$terms = wc_get_product_terms($product->get_id(), $name, array('fields' => 'all')); $terms = wc_get_product_terms($product->get_id(), $name, array('fields' => 'all'));
foreach ($terms as $term) { foreach ($terms as $key=>$term) {
if (!in_array($term->slug, $options)) { if (!in_array($term->slug, $options)) {
continue; continue;
} }
print_attribute_radio($checked_value, $term->slug, $term->name, $sanitized_name); print_attribute_radio($checked_value, $term->slug, $term->name, $sanitized_name,$key);
} }
} else { } else {
foreach ($options as $option) { foreach ($options as $option) {
print_attribute_radio($checked_value, $option, $option, $sanitized_name); print_attribute_radio($checked_value, $option, $option, $sanitized_name);
} }
} }
} }
...@@ -230,49 +241,12 @@ do_action('woocommerce_before_add_to_cart_form'); ...@@ -230,49 +241,12 @@ do_action('woocommerce_before_add_to_cart_form');
<?php do_action('woocommerce_after_variations_form'); ?> <?php do_action('woocommerce_after_variations_form'); ?>
<!--<div class="list row list-color left border-l">
<div class="product-header center font-small">
<span class = "chevron bottom">Choix de la couleur</span>
</div>
<ul>
<?php
foreach ($var_colors as $key => $value) :
$variable_product = wc_get_product($key);
?>
<li class = "" data-name='<?php echo $variable_product->get_attribute('couleur'); ?>'><span data-color="<?php echo $value; ?>"></span></li>
<?php endforeach; ?>
</ul>
</div>
<div class="list row pa_format left border-l">
<div class="product-header center font-small">
<span class = "chevron bottom">Choix du format</span>
</div>
<ul>
<?php
$formats_tab = nap_distinct_format_variations($variations);
foreach ($formats_tab as $key => $value) :
$icons = nap_icon_format($key);
$term = get_term_by('name', $value, 'pa_format');
// print_r($term);
?>
<li class ="" data-format='<?php echo $term->slug; ?>'>
<img src="<?php echo $icons['inactive'] ?>" data-img = "<?php echo $icons['inactive'] ?>" data-img-active = '<?php echo $icons['active'] ?>'>
<div class="format-desc"><?php echo $value ?></div>
</li>
<?php endforeach; ?>
</ul>
</div>-->
</form> </form>
<div class="product-info row center left border-l"> <div class="product-info row center left border-l">
<div class="info-content"> <div class="info-content">
<h2 class = "crete -italic font-small" ><?php echo $product_cats[1]->name ?></h2> <h2 class = "crete font-small" ><?php echo $product_cats[1]->name ?></h2>
<h3 class = "crete -italic font-small info-attr" ><span class="info-format"><?php echo $_GET['attribute_format']?></span> <span class="info-color"><?php echo$_GET['attribute_couleur'] ?></span></h3> <h3 class = "crete font-small info-attr" ><span class="info-format"><?php echo $_GET['attribute_format']?></span> <span class="info-color"><?php echo$_GET['attribute_couleur'] ?></span></h3>
<div class="details font-small"> <div class="details font-small">
<p class="info-format-txt"><?php echo $_GET['attribute_format']?></p> <p class="info-format-txt"><?php echo $_GET['attribute_format']?></p>
<p class="pq"><?php echo nap_variable_meta($current_variationID, 'variation_description'); ?></p> <p class="pq"><?php echo nap_variable_meta($current_variationID, 'variation_description'); ?></p>
...@@ -302,7 +276,7 @@ do_action('woocommerce_before_add_to_cart_form'); ...@@ -302,7 +276,7 @@ do_action('woocommerce_before_add_to_cart_form');
<div class = "btn-list"> <div class = "btn-list">
<a href="<?php echo get_permalink(157); ?>" class="btn pink-btn rounded">Nous contacter</a> <a href="<?php echo get_permalink(157); ?>" class="btn pink-btn rounded">Nous contacter</a>
<a class="btn pink-btn rounded download-btn download_file">Télécharger la fiche technique </a> <a class="btn pink-btn rounded download-btn download_file">Télécharger la fiche technique </a>
<a href="<?php echo get_permalink(43); ?>" class="hidden download_file_link" id="<?php echo $current_variationID ?>"></a> <a href="<?php echo get_permalink(43); ?>?product_id=<?php echo $product->get_id()?>&" class="hidden download_file_link" id="<?php echo $current_variationID ?>"></a>
</div> </div>
<div class="font-small circle-btn add-icon show-product"><span class= "abs-center">Produits associées</span></div> <div class="font-small circle-btn add-icon show-product"><span class= "abs-center">Produits associées</span></div>
</div> </div>
......
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