Click here to Skip to main content
15,899,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Comments
Richard MacCutchan 16-Oct-17 11:42am    
Sounds like your $_REQUEST array has not been initialised properly.
Member 13468212 16-Oct-17 11:49am    
Ok, Weird because it all worked before. All thats happened is the sites been moved and updated.

Ive also found that the session isnt being picked up as it should because it should count the icons based on the questions before but its not counting them at all!

Can you help me fix this please?
Richard MacCutchan 16-Oct-17 12:46pm    
Sorry, I have no idea how to fix it, but the error message was pretty obvious. You need to use your debugger to find out what item is being missed, or which line of code is not working correctly.
Member 13468212 16-Oct-17 11:51am    
Notice: id was called incorrectly. Product properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/boilerflash/woocommerce/archive-product.php'), wc_get_template_part, load_template, require('/themes/boilerflash/woocommerce/content-product.php'), do_action('woocommerce_after_shop_loop_item_title'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_loop_price, wc_get_template, include('/themes/boilerflash/woocommerce/loop/price.php'), WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see Debugging in WordPress for more information. (This message was added in version 3.0.) in /home/boilerflash18/public_html/wp-includes/functions.php on line 4138

Also have this one on the products page?
EZW 2-Nov-17 14:03pm    
Maybe the server is misconfigured?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900