Welcome To GujjuService.com

Electrical Rate Card

[insert_php]
global $post;
$post_slug = $post->post_name;

if($post_slug == “electrical-rate-card”){
$parent_cat_ID = 98;
$parent_cat_name = “electrical”;
}else if($post_slug == “gas-rate-card”){
$parent_cat_ID = 124;
$parent_cat_name = “gas-service”;
}else if($post_slug == “plumbing-rate-card”){
$parent_cat_ID = 111;
$parent_cat_name = “plumber”;
}else if($post_slug == “ro-rate-card”){
$parent_cat_ID = 123;
$parent_cat_name = “ro-service”;
}

$args = array(
‘hierarchical’ => 1,
‘show_option_none’ => ”,
‘hide_empty’ => 0,
‘parent’ => $parent_cat_ID,
‘taxonomy’ => ‘product_cat’
);

$subcats = get_categories($args);

$cnt = 0;

if(!empty($subcats)){
foreach ($subcats as $sc) {
$link = get_term_link( $sc->slug, $sc->taxonomy);
$subcats = get_categories($args);

$cnt++;

$lnk = ‘details-0-‘.$cnt;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
$args = array(
‘post_type’ => ‘product’,
‘stock’ => 1,
‘product_cat’ => $sc->slug,
‘orderby’ =>’date’,
‘order’ => ‘ASC’
);

$loop = new WP_Query($args);
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
while($loop->have_posts()){
//print_r($sc);
$loop->the_post();
global $product;

$id = $product->id;
$service_name = $product->get_title();
$service_price = $product->get_price();
$curr_symbol = get_woocommerce_currency_symbol();

if($service_price == NULL){
$service_price = “Cost after inspection.
Minimum Charge is 250″;
}else{
$service_price = $curr_symbol.”.$service_price;
}

$url = get_permalink($id);

echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
}
wp_reset_query();
echo ‘

‘;
echo ‘

Service Name Service Price Quantity Add To Cart
‘.$service_name.’ ‘.$service_price.’
‘;

echo ‘‘;
echo ‘‘;
echo ‘‘;
echo ‘‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
}
}else{
$args = array(
‘post_type’ => ‘product’,
‘stock’ => 1,
‘product_cat’ => $sc->slug,
‘orderby’ =>’date’,
‘order’ => ‘ASC’
);
$loop = new WP_Query($args);
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
while($loop->have_posts()){
//print_r($sc);
$loop->the_post();
global $product;

$id = $product->id;
$service_name = $product->get_title();
$service_price = $product->get_price();
$curr_symbol = get_woocommerce_currency_symbol();

if($service_price == NULL){
$service_price = “Cost after inspection.
Minimum Charge is 250″;
}else{
$service_price = $curr_symbol.”.$service_price;
}

$url = get_permalink($id);

echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
}
wp_reset_query();
echo ‘

‘;
echo ‘

Service Name Service Price Quantity Total Add To Cart
‘.$service_name.’ ‘.$service_price.’
‘;

echo ‘‘;

echo ‘‘;
echo ‘‘;
echo ‘‘;
echo ‘

‘;
}
[/insert_php]