服务报价 | 域名主机 | 网络营销 | 软件工具| [加入收藏]
 热线电话: #
当前位置: 主页 > php教程 > zencart教程 >

解决zencart后台目录产品黄色icon_yellow_on.gif方法

时间:2015-07-08 22:55来源:未知 作者:最模板 点击:
解决方法,导入时候发现 更新成功! - 型号: as NO.1209 就是重复model 文件位置:manager\includes\modules\category_product_listing.php 文件内容: if (zen_get_products_to_categories($categories-fields[categories_id]

解决方法,导入时候发现 更新成功! - 型号: 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;
}
}

(责任编辑:最模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
热点内容