We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ecshop/upload/includes/lib_main.php
Line 273 in 725956b
$arr = $GLOBALS['db']->GetAll('SELECT cat_id, cat_name, parent_id, is_show FROM ' . $GLOBALS['yp']->table('category') . 'WHERE is_show=1');
get_parent_cats 这个函数以上读取可用分类的时候,是通过 is_show=1 来读取的,但是如果上层有分类设置为 is_show=0 的话,那么下层的一些商品的详情页在这里读取上层分类数据的时候就会跳不出这个 while(1) 造成死循环了。
get_parent_cats
is_show=1
is_show=0
while(1)
临时解决方法参考(标注 // Eric @20210217 的行是添加的):
// Eric @20210217
function get_parent_cats($cat) { if ($cat == 0) { return array(); } $arr = $GLOBALS['db']->GetAll('SELECT cat_id, cat_name, parent_id, is_show FROM ' . $GLOBALS['yp']->table('category') . 'WHERE is_show=1'); if (empty($arr)) { return array(); } $index = 0; $cats = array(); $flag = false; // Eric @20210217 while (1) { $flag = false; // Eric @20210217 foreach ($arr AS $row) { if ($cat == $row['cat_id']) { $cat = $row['parent_id']; $flag = true; // Eric @20210217 $cats[$index]['cat_id'] = $row['cat_id']; $cats[$index]['cat_name'] = $row['cat_name']; $cats[$index]['parent_id'] = $row['parent_id']; $cats[$index]['is_show'] = $row['is_show']; $index++; break; } } if ($index == 0 || $cat == 0) { break; } // Eric @20210217 if (!$flag) { break; } } return $cats; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ecshop/upload/includes/lib_main.php
Line 273 in 725956b
get_parent_cats
这个函数以上读取可用分类的时候,是通过is_show=1
来读取的,但是如果上层有分类设置为is_show=0
的话,那么下层的一些商品的详情页在这里读取上层分类数据的时候就会跳不出这个while(1)
造成死循环了。临时解决方法参考(标注
// Eric @20210217
的行是添加的):The text was updated successfully, but these errors were encountered: