如何修复3/4问题的未定义索引 [英] How do I fix undefined index for 3/4 problems

查看:68
本文介绍了如何修复3/4问题的未定义索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请看下面的问题

我在不同的页面上收到这些错误。这只发生在迁移网站后。它也使用了woo商业。



注意:未定义的索引:在C中过滤:\ xampp

注意:未定义的索引:C:\ xampp
注意:未定义的索引:C中的pa_product-rules:



代码如下



 * add_action('woocommerce_before_shop_loop','wpm_product_cat_archive_add_meta'); 
函数wpm_product_cat_archive_add_meta($ args){
全球$ posts;
echo< pre>; print_r($ posts);
退出;
} * /
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'=> ;'产品',
'posts_per_page'=> -1,
'poss._status'=>'发布',
'tax_query'=>数组(
array(
'taxonomy'=>'product_cat',
'field'=>'slug',
'terms'=>数组($ product_cat),
'运算符'=>'IN',
),
数组(
'taxonomy'=>'pa_product-rules',
'terms'=> $ pa_productrules,
'field'=>'slug',
'运营商'=>'IN'


);





另外,我有什么是这个错误,当它应该过滤商店的部分



注意:未定义的索引:第73行/home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php中的product_cat



注意:未定义索引:第74行/home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php中的pa_product-rules



注意:未定义的索引:ft在第76行的/home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php



注意:未定义的索引:bt在第77行的/home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php



注意:未定义的索引:位于第78行的/home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php



注意:未定义索引:第79行/home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php中的浴缸



不是冰:未定义索引:淋浴在/home/boilerflash18/public_html/wp-content/themes/boilerflash/woocommerce/loop/result-count.php第80行





代码如下:



<?php

$ filtering = $ _REQUEST ['过滤' ];

$ 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';

$ iconlists [0] ['name'] = $ ft;



$ iconslists [1] ['icon'] ='search-icon - '。$ bt。 '.png';

$ iconslists [1] ['count'] ='0';

$ iconslists [1] ['name'] = $ bt;



$ iconslists [2] ['icon'] ='搜索 - icon-bed.png';

$ iconslists [2] ['count'] = $ bed;

$ iconslists [2] ['name'] ='卧室';



$ iconslists [3] ['icon'] ='search-icon-bath.png';

$图标列表[ 3] ['count'] = $ bath;

$ iconslists [3] ['name'] ='浴室';



$ iconslists [4] ['icon'] ='search-icon-shower.png';

$ iconslists [4] ['count'] = $ shower;

$ iconslists [4] ['name'] ='淋浴';



我的尝试:



任何帮助都会很棒。它在旧域等方面运行良好,但当我更改域名并迁移网站时,我遇到了这些问题。调试关闭没有问题,但问题是它不会移动到网站的下一部分。



先谢谢。

解决方案

args){
global


帖子;
echo< pre>; print_r(


帖子);
退出;
} * /
add_action('init','productrecomm');
function productrecomm(){
global


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.

解决方案

args){ global


posts; echo "<pre>";print_r(


posts); exit; }*/ add_action('init','productrecomm'); function productrecomm(){ global


这篇关于如何修复3/4问题的未定义索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆