解决方法,导入时候发现 更新成功! - 型号: as NO.1209 就是重复model
文件位置:manager\includes\modules\category_product_listing.php
文件内容:
if (zen_get_products_to_categories($categories->fields['categories_id'], true, 'products_active') == 'true') {
echo ' ' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED);
}
函数位置: 后台\includes\functions\general.php
函数内容:
//////////////////////////////////////////////////////////
function zen_get_products_to_categories($category_id, $include_inactive = false, $counts_what = 'products') {
global $db;
$products_count = 0;
if ($include_inactive == true) {
switch ($counts_what) {
case ('products'):
$cat_products_query = "select count(*) as total
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_id = p2c.products_id
and p2c.categories_id = '" . (int)$category_id . "'";
break;
case ('products_active'):
$cat_products_query = "select p.products_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_id = p2c.products_id
and p2c.categories_id = '" . (int)$category_id . "'";
break;
}
} else {
switch ($counts_what) {
case ('products'):
$cat_products_query = "select count(*) as total
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_id = p2c.products_id
and p.products_status = 1
and p2c.categories_id = '" . (int)$category_id . "'";
break;
case ('products_active'):
$cat_products_query = "select p.products_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_id = p2c.products_id
and p.products_status = 1
and p2c.categories_id = '" . (int)$category_id . "'";
break;
}
}
$cat_products = $db->Execute($cat_products_query);
switch ($counts_what) {
case ('products'):
$cat_products_count += $cat_products->fields['total'];
break;
case ('products_active'):
while (!$cat_products->EOF) {
if (zen_get_product_is_linked($cat_products->fields['products_id']) == 'true') {
return $products_linked = 'true';
}
$cat_products->MoveNext();
}
break;
}
$cat_child_categories_query = "select categories_id
from " . TABLE_CATEGORIES . "
where parent_id = '" . (int)$category_id . "'";
$cat_child_categories = $db->Execute($cat_child_categories_query);
if ($cat_child_categories->RecordCount() > 0) {
while (!$cat_child_categories->EOF) {
switch ($counts_what) {
case ('products'):
$cat_products_count += zen_get_products_to_categories($cat_child_categories->fields['categories_id'], $include_inactive);
break;
case ('products_active'):
if (zen_get_products_to_categories($cat_child_categories->fields['categories_id'], true, 'products_active') == 'true') {
return $products_linked = 'true';
}
break;
}
$cat_child_categories->MoveNext();
}
}
switch ($counts_what) {
case ('products'):
return $cat_products_count;
break;
case ('products_active'):
return $products_linked;
break;
}
}
(责任编辑:最模板) |