Commit e3cd3f6d authored by Nahla Shiri's avatar Nahla Shiri

format par defaut

parent e9f0f08a
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="115px" height="117px" viewBox="369.445 239.14 115 117" enable-background="new 369.445 239.14 115 117"
xml:space="preserve">
<title>nappeset_128_droits</title>
<g id="actif">
<g opacity="0.2">
<ellipse fill="#313D7A" stroke="#000000" stroke-width="2" stroke-miterlimit="10" cx="428.742" cy="298.04" rx="50" ry="50.55"/>
</g>
</g>
<g id="tick">
<polyline fill="none" stroke="#313D7A" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" points="399.741,294.501
419.621,315.726 453.742,284.853 "/>
</g>
<g id="Calque_1_1_">
<path fill="#313D7A" stroke="#313D7A" stroke-width="2" stroke-miterlimit="10" d="M426.41,347.639
c-27.65,0.269-50.2-21.879-50.468-49.529s21.879-50.2,49.529-50.469c27.65-0.269,50.2,21.879,50.469,49.529
c0,0.134,0,0.268,0,0.403C476.074,325.09,453.927,347.505,426.41,347.639z M426.41,248.984
c-26.845-0.269-48.857,21.342-49.126,48.187c-0.269,26.845,21.342,48.858,48.187,49.126c26.846,0.269,48.858-21.342,49.127-48.187
c0-0.134,0-0.269,0-0.537C474.731,270.863,453.121,249.118,426.41,248.984z"/>
</g>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="115px" height="116px" viewBox="0 0 115 116" enable-background="new 0 0 115 116" xml:space="preserve">
<title>nappeset_128_droits</title>
<path fill="#313D7A" stroke="#313D7A" stroke-width="2" stroke-miterlimit="10" d="M57.971,107.998
c-27.65,0.268-50.2-21.879-50.469-49.529C7.233,30.819,29.381,8.27,57.031,8.002c27.65-0.27,50.201,21.877,50.469,49.528
c0,0.134,0,0.269,0,0.403C107.633,85.449,85.488,107.865,57.971,107.998z M57.971,9.344C31.125,9.074,9.113,30.686,8.845,57.53
s21.342,48.856,48.187,49.126c26.844,0.27,48.857-21.342,49.125-48.188c0-0.133,0-0.269,0-0.537
C106.291,31.223,84.682,9.478,57.971,9.344z"/>
</svg>
......@@ -343,7 +343,8 @@ function nap_variation_url($variationID) {
$couleur = $variable_product->get_attribute('couleur');
$color_url = get_term_by('slug', $couleur, 'pa_couleur');
$format = $variable_product->get_attribute('format');
//$format = $variable_product->get_attribute('format');
$format = get_post_meta($variationID, 'attribute_pa_format', true);
$format_url = get_term_by('slug', $format, 'pa_format');
$url = '?attribute_couleur=' . $color_url->slug . '&attribute_format=' . $format_url->slug . '&variation_id=' . $variationID;
return preg_replace('/\s+/', '', $url);
......@@ -396,8 +397,12 @@ function nap_distinct_color_variations($variations) {
}
function nap_variation_format($variationID) {
$variable_product = wc_get_product($variationID);
return $variable_product->get_attribute('format');
/*$variable_product = wc_get_product($variationID);
$name= $variable_product->get_attribute('format');*/
$meta = get_post_meta($variationID, 'attribute_pa_format', true);
$term = get_term_by('slug', $meta, 'pa_format');
return $slug = $term->slug;
}
function nap_distinct_format_variations($variations) {
......@@ -498,6 +503,7 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
foreach ($variations as $key => $value) {
$color = nap_variation_color($value->ID);
$format = nap_variation_format($value->ID);
if (!in_array($color, $temp_colors)) {
$temp_colors[] = $color;
......@@ -772,4 +778,4 @@ function nap_show_associated_products() {
$associated_products .= '</div>';
return $associated_products;
}
\ No newline at end of file
}
......@@ -51,19 +51,24 @@ if (!function_exists('print_attribute_radio')) {
$id = esc_attr($name . '_v_' . $value);
if ($name == 'pa_couleur') {
$hexa = nap_color_attribute($value);
$filtered_label = apply_filters('woocommerce_variation_option_name', $label);
$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.'" style ="height:'.$icons['height'].'px;width:'.$icons['width'].'px" >';
if($icons['inactive'] || $icons['active'])
$format_img='<img src="'.$icons['inactive'].'" data-img = "'.$icons['inactive'].'" data-img-active = "'.$icons['active'].'" id="'.$value.'" style ="height:'.$icons['height'].'px;width:'.$icons['width'].'px" >';
else
{ $default_active = home_url('wp-content/themes/nap/assets/css/img/default_active.svg');
$default_inactive = home_url('wp-content/themes/nap/assets/css/img/default_inactive.svg');
$format_img='<img src="'.$default_inactive.'" data-img = "'.$default_inactive.'" data-img-active = "'.$default_active.'" id="'.$value.'" style ="height:35px;width:35px" >';
}
$filtered_label = apply_filters('woocommerce_variation_option_name', $label);
printf('<li class="format-list selected"><input type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s checked>
printf('<li class="format-list"><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">'.$label.'</span>
......@@ -261,7 +266,10 @@ do_action('woocommerce_before_add_to_cart_form');
</form>
<div class="product-info row center left border-l">
<div class="info-content">
<?php $format = str_replace('-', ' ', $_GET['attribute_format']);?>
<?php
$format = get_post_meta($current_variationID, 'attribute_pa_format', true);
$format_info = get_term_by('slug', $format, 'pa_format');
$format = $format_info->name;?>
<h2 class = "crete font-small" ><?php echo $sub_cat[0]->name; ?></h2>
<h3 class = "crete font-small info-attr" ><span class="info-format"><?php echo $format ; ?></span> <span class="info-color"><?php echo$_GET['attribute_couleur'] ?></span></h3>
<div class="details font-small">
......
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