Hi please see the issue below
I am getting these errors on different pages. This only happened after migrating the site. It uses woo commerce also.
Notice: Undefined index: filtering in C:\xampp
Notice: Undefined index: product_cat in C:\xampp
Notice: Undefined index: pa_product-rules in C:
Code is below
*add_action('woocommerce_before_shop_loop','wpm_product_cat_archive_add_meta');
function wpm_product_cat_archive_add_meta($args){
global $posts;
echo "<pre>";print_r($posts);
exit;
}*/
add_action('init','productrecomm');
function productrecomm(){
global $wpdb;
if(!is_admin()){
$filtering = $_REQUEST['filtering'];
$product_cat = $_REQUEST['product_cat'];
$pa_productrules = $_REQUEST['pa_product-rules'];
if($filtering==1&&$product_cat!=''&&$pa_productrules!='') {
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'posts_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array($product_cat),
'operator' => 'IN',
),
array(
'taxonomy' => 'pa_product-rules',
'terms' => $pa_productrules,
'field' => 'slug',
'operator' => 'IN'
)
)
);
Also then what I have is this error when it should filter the section of the shop
Notice: Undefined index: product_cat in /home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php on line 73
Notice: Undefined index: pa_product-rules in /home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php on line 74
Notice: Undefined index: ft in /home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php on line 76
Notice: Undefined index: bt in /home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php on line 77
Notice: Undefined index: bed in /home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php on line 78
Notice: Undefined index: bath in /home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php on line 79
Notice: Undefined index: shower in /home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php on line 80
Code for this is below
<?php
$filtering = $_REQUEST['filtering'];
$product_cat = $_REQUEST['product_cat'];
$pa_productrules = $_REQUEST['pa_product-rules'];
$ft = $_REQUEST['ft'];
$bt = $_REQUEST['bt'];
$bed = $_REQUEST['bed'];
$bath = $_REQUEST['bath'];
$shower = $_REQUEST['shower'];
$iconslists = array();
$iconslists[0]['icon'] = 'search-icon-'.$ft.'.png';
$iconslists[0]['count'] = '0';
$iconslists[0]['name'] = $ft;
$iconslists[1]['icon'] = 'search-icon-'.$bt.'.png';
$iconslists[1]['count'] = '0';
$iconslists[1]['name'] = $bt;
$iconslists[2]['icon'] = 'search-icon-bed.png';
$iconslists[2]['count'] = $bed;
$iconslists[2]['name'] = 'bedrooms';
$iconslists[3]['icon'] = 'search-icon-bath.png';
$iconslists[3]['count'] = $bath;
$iconslists[3]['name'] = 'bathrooms';
$iconslists[4]['icon'] = 'search-icon-shower.png';
$iconslists[4]['count'] = $shower;
$iconslists[4]['name'] = 'showers';
What I have tried:
Any help would be great. It worked fine on old domain etc but when I have changed the domain name and migrated the site I get these issues. No issues show with debug off but the issue is it doesnt move to the next part of the site as it should.
Thanks In advance.