Commit ac261a42 authored by Nahla Shiri's avatar Nahla Shiri

variation js style

parent 85535e53
......@@ -53,6 +53,8 @@ $(function(){
$(document).on('click','.acces li',function(e){
e.stopImmediatePropagation();
$('.popup-container').fadeIn();
// $('#user_login').attr('placeholder', 'Identifiant');
// $('#user_pass').attr('placeholder', 'Mot de passe');
$('.popup-first').removeClass('fadeOutDown ').addClass('animated visible-elem pulse');
});
......@@ -278,12 +280,11 @@ $.fn.getMenuBg = function(){
navHeader = $('.nav-header').outerHeight(),
containerHeight = windowHeight - footerHeight ,
navPhototequeWidth = $('.nav-phototeque').outerWidth(),
maxHeight = productHeight > windowHeight ? productHeight-footerHeight : containerHeight-footerHeight,
maxHeight = productHeight > windowHeight ? productHeight : containerHeight,
galleryWidth = windowWidth - navPhototequeWidth,
filterWidth = $('.right-container .left-panel').outerWidth(),
footerContact = $('.contact-form .footer').outerHeight(),
sizeProductDetails = $('.product-details >div').length;
if (sizeProductDetails <= 2) $('.product-info').outerWidth('78.3%');
footerContact = $('.contact-form .footer').outerHeight();
$('.gallery-wrapper').outerWidth(galleryWidth).css('margin-left',navPhototequeWidth) ;
$('.main,.load-page').outerHeight(containerHeight);
$('.full-height').outerHeight(maxHeight);
......@@ -296,6 +297,11 @@ $.fn.getMenuBg = function(){
$('.contact-form .inner-form').outerHeight(windowHeight - footerContact);
$('#catalogue .panel-content section').last().height(windowHeight - footerHeight);
}
//Wordpress js login
$('#user_login').attr('placeholder', 'Identifiant');
$('#user_pass').attr('placeholder', 'Mot de passe');
$("#user_login").addClass("my-login-username");
});//END Function
function animateOnScroll(){
......@@ -410,7 +416,6 @@ function scrollAnchor(elemId, skipZero){
});
});
}
$(window).load( function() {
initFunction();
});//END document load
......
jQuery( document ).ready( function() {
jQuery( ".download_file" ).click( function() {
jQuery( document ).on('click',".download_file", function() {
var id ;
var download_link = jQuery( '.download_file_link' ).attr('href');
var current_var = jQuery( '.download_file_link' ).attr('id');
var variation_id = jQuery( 'input[name="variation_id"]' ).val();
var link = download_link+'?variation_id='+variation_id;
alert(link);
window.location.href= link;
if(variation_id == 0)
id = current_var;
else
id = variation_id;
var link = download_link+'?variation_id='+id;
window.open(link, '_blank');
return false;
});
jQuery('.color-list').each(function (index, value) {
var color = jQuery(this).find('input').attr('data-color');
jQuery(this).find('input[type=radio]:after').css('background-color',color);
});
});
\ No newline at end of file
......@@ -132,6 +132,13 @@ $(function(){
var toLink = $(this).data('link');
$('.load-page').parent().addClass('active');
$('.load-page').load(toLink,function(){
sizeProductDetails = $('.product-details .list').length;
if (sizeProductDetails < 2) {
$('.product-info').outerWidth('78.3%');
console.log(sizeProductDetails);
}
$('.list-color li').getListColors();
$('.list-color li').selectColor();
$('.list-format li').selectFormat();
......@@ -139,6 +146,7 @@ $(function(){
$('article[data-color], .list-color li span').selectSlide($('#slides'));
$('#mozaique').open_gallery();
initFunction();
$.fn.responsive();
$('html').css('overflow','hidden');
setTimeout(function(){
$.fn.productAnimation();
......@@ -146,8 +154,8 @@ $(function(){
$.fn.slider_product();
$('.list-color li').selectColor();
$('.list-format li').selectFormat();
},500)
$('.download-btn').click(function(e){
},900)
$('.download-btn:not(.download_file)').click(function(e){
e.stopPropagation();
});
});
......
......@@ -443,15 +443,8 @@ function nap_upload_image($img){
return trim(strtolower($img));
}
function nap_print_attribute_radio( $checked_value, $value, $label, $name ) {
$checked = sanitize_title( $checked_value ) === $checked_value ? checked( $checked_value, sanitize_title( $value ), false ) : checked( $checked_value, $value, false );
$input_name = 'attribute_' . esc_attr( $name ) ;
$esc_value = esc_attr( $value );
$id = esc_attr( $name . '_v_' . $value );
$filtered_label = apply_filters( 'woocommerce_variation_option_name', $label );
printf( '<div><input type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s><label for="%3$s">%5$s</label></div>', $input_name, $esc_value, $id, $checked, $filtered_label );
}
function nap_variable_meta($varID, $meta){
return get_post_meta( $varID, '_'.$meta, true );
}
\ No newline at end of file
......@@ -48,8 +48,7 @@
</style>
<?php
print_r($_POST);
print_r($_GET);
/**
* Variable product add to cart
*
......@@ -76,10 +75,15 @@ $attribute_keys = array_keys($attributes);
$product_cats = array_reverse(wp_get_post_terms($product->get_id(), 'product_cat'));
$subcat_iD = $product_cats[1]->term_id;
$current_variationID = $_GET['variation_id'];
if (!function_exists('print_attribute_radio')) {
function print_attribute_radio($checked_value, $value, $label, $name) {
$current_color = $_GET['attribute_couleur'];
$default_checked = "";
if ($value == strtolower($current_color))
$default_checked = "checked";
$checked = sanitize_title($checked_value) === $checked_value ? checked($checked_value, sanitize_title($value), false) : checked($checked_value, $value, false);
$input_name = 'attribute_' . esc_attr($name);
......@@ -91,7 +95,7 @@ if (!function_exists('print_attribute_radio')) {
$filtered_label = apply_filters('woocommerce_variation_option_name', $label);
printf(' <style>
#' . $id . ':after { background-color: ' . $hexa . '; }
</style><li class="color-list" data-color="' . $hexa . '"><input data-color="' . $hexa . '" type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s><span data-color="' . $hexa . '"></span></li>', $input_name, $esc_value, $id, $checked, $filtered_label);
</style><li class="color-list" data-color="' . $hexa . '"><input data-color="' . $hexa . '" type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s ' . $default_checked . '><span data-color="' . $hexa . '"></span></li>', $input_name, $esc_value, $id, $checked, $filtered_label);
} else {
$icons = nap_icon_format($value);
$filtered_label = apply_filters('woocommerce_variation_option_name', $label);
......@@ -196,7 +200,7 @@ do_action('woocommerce_before_add_to_cart_form');
<div class="product-details full-height row right clearfix transition">
<form class="variations_form cart" method="post" enctype='multipart/form-data' data-product_id="<?php echo absint($product->get_id()); ?>" data-product_variations="<?php echo htmlspecialchars(wp_json_encode($available_variations)) ?>">
<form class="variations_form cart left row" method="post" enctype='multipart/form-data' data-product_id="<?php echo absint($product->get_id()); ?>" data-product_variations="<?php echo htmlspecialchars(wp_json_encode($available_variations)) ?>">
<?php do_action('woocommerce_before_variations_form'); ?>
<?php if (empty($available_variations) && false !== $available_variations) : ?>
......@@ -298,6 +302,9 @@ do_action('woocommerce_before_add_to_cart_form');
<?php endforeach; ?>
</ul>
</div>-->
</form>
<div class="product-info row center left border-l">
<div class="info-content">
......@@ -305,24 +312,24 @@ do_action('woocommerce_before_add_to_cart_form');
<h3 class = "crete -italic font-small" >39x39 abricot</h3>
<div class="details font-small">
<p>39 x 39 cm - 2 feuilles</p>
<p>18 paquets de 100</p>
<p><?php echo nap_variable_meta($current_variationID, 'variation_description'); ?></p>
</div>
<div class="price">
<span class="crete"><?php echo $product->get_price_html(); ?> ht</span>
<span class="crete"><?php echo nap_variable_meta($current_variationID, 'price'); ?> 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 do_action('woocommerce_product_meta_start'); ?>
<?php if ( wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type( 'variable' ) ) ) : ?>
<?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 : esc_html__( 'N/A', 'woocommerce' ); ?></span></span>
<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' ); ?>
<?php do_action('woocommerce_product_meta_end'); ?>
</div>
......@@ -330,17 +337,12 @@ do_action('woocommerce_before_add_to_cart_form');
</div>
</div>
<div class = "btn-list">
<div class="btn pink-btn rounded">Nous contacter</div>
<div class="btn pink-btn rounded download-btn">
<a href="<?php echo get_permalink(43); ?>" class="hidden download_file_link"></a>
<a href="#" class="download_file">Télécharger la fiche technique </a>
</div>
<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); ?>" 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>
</form>
</div>
<div class="product-list transition border-l fixed">
<div class="suggest-header">
......
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