Commit 0ea3dfba authored by Nahla Shiri's avatar Nahla Shiri

correction sub cat + order

parent 5601f964
......@@ -114,7 +114,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
<h2 class="crete small-title"><?php echo $value->name ?></h2>
<div class="product-list">
<?php
$args = array('post_type' => 'product', 'stock' => 1, 'posts_per_page' => -1, 'product_cat' => $value->name);
$args = array('post_type' => 'product', 'stock' => 1, 'orderby' => 'title', 'order' => 'ASC','posts_per_page' => -1, 'product_cat' => $value->name);
$naps_posts = new WP_Query($args);
$options = array();
......@@ -126,8 +126,8 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
'post_type' => array('product', 'product_variation'),
'post_status' => array('private', 'publish'),
'numberposts' => -1,
'orderby' => 'menu_order',
'order' => 'asc',
'orderby' => 'title',
'order' => 'ASC',
'post_parent' => $id
);
?>
......
......@@ -22,53 +22,9 @@ if (!defined('ABSPATH')) {
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'];
$parent_cat = wp_get_post_terms($product->get_id(), 'product_cat', array( 'parent' => 0,'fields' => 'ids' ));
$sub_cat = wp_get_post_terms($product->get_id(), 'product_cat', array( 'parent' =>$parent_cat[0],'fields' => 'names' ));
/* if (!function_exists('print_attribute_radio')) {
function print_attribute_radio($checked_value, $value, $label, $name, $index=0) {
$current_color = $_GET['attribute_couleur'];
$selected = $default_checked = "";
if ($value == strtolower($current_color)){
$default_checked = "checked";
$selected = "selected";
}
$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);
if ($name == 'pa_couleur') {
$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.'">';
$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>
<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_before_add_to_cart_form');
?>
......@@ -80,7 +36,7 @@ do_action('woocommerce_before_add_to_cart_form');
</div>
<div class="product-slides row">
<div class="product-header">
<h2 class="crete -italic font-small"><?php echo $product_cats[0]->name ?></h2>
<h2 class="crete -italic font-small"><?php echo $sub_cat[0] ?></h2>
<h3 class="crete"><?php the_title(); ?></h3>
</div>
<div class="slides-wrapper center">
......@@ -166,7 +122,7 @@ do_action('woocommerce_before_add_to_cart_form');
<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>
<h2 class = "crete font-small" ><?php echo $sub_cat[0] ?></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">
......
......@@ -24,9 +24,9 @@ global $product;
$attribute_keys = array_keys($attributes);
$product_cats = wp_get_post_terms($product->get_id(), 'product_cat');
$parent_cat = wp_get_post_terms($product->get_id(), 'product_cat', array( 'parent' => 0,'fields' => 'ids' ));
$sub_cat = wp_get_post_terms($product->get_id(), 'product_cat', array( 'parent' =>$parent_cat[0],'fields' => 'names' ));
$subcat_iD = $product_cats[1]->term_id;
$current_variationID = $_GET['variation_id'];
if (!function_exists('print_attribute_radio')) {
......@@ -80,7 +80,7 @@ do_action('woocommerce_before_add_to_cart_form');
</div>
<div class="product-slides row">
<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 $sub_cat[0]; ?></h2>
<h3 class="crete"><?php the_title();?></h3>
</div>
<div class="slides-wrapper center">
......@@ -245,7 +245,7 @@ do_action('woocommerce_before_add_to_cart_form');
<div class="product-info row center left border-l">
<div class="info-content">
<h2 class = "crete font-small" ><?php echo $product_cats[1]->name ?></h2>
<h2 class = "crete font-small" ><?php echo $sub_cat[0]; ?></h2>
<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">
<p class="info-format-txt"><?php echo $_GET['attribute_format']?></p>
......
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