• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP zen_get_products_to_categories函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中zen_get_products_to_categories函数的典型用法代码示例。如果您正苦于以下问题:PHP zen_get_products_to_categories函数的具体用法?PHP zen_get_products_to_categories怎么用?PHP zen_get_products_to_categories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了zen_get_products_to_categories函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: convert_categories_result

 function convert_categories_result($categories_values, $action = 'index')
 {
     $categories_id = $categories_values->fields['categories_id'];
     // link_to_categories
     $parm = array('category_id' => $categories_id);
     $link = easy_admin_products_html::href_link("categories", $parm);
     if ($action == 'search') {
         $categories_values->fields['link_to_categories'] = easy_admin_products_model::get_category($categories_id, $link);
     } else {
         $categories_values->fields['link_to_categories'] = '<a href="' . $link . '">' . zen_output_string_protected($categories_values->fields['categories_name']) . '</a>';
         // subcategories_count
         $subcategories_counts = self::get_subcategories_counts();
         $categories_values->fields['subcategories_count'] = (int) $subcategories_counts[$categories_id];
     }
     // link_to_products
     $parm = array('category_id' => $categories_id);
     $categories_values->fields['link_to_products'] = easy_admin_products_html::href_link("", $parm);
     // link_to_status
     $parm = array('action' => 'setflag', 'cID' => $categories_id, 'flag' => $categories_values->fields['categories_status'] == '1' ? 0 : 1);
     $parm = self::add_current_parm($parm);
     $categories_values->fields['link_to_status'] = easy_admin_products_html::href_link("categories", $parm);
     $categories_values->fields['is_link'] = zen_get_products_to_categories($categories_id, true, 'products_active') == 'true';
     return $categories_values->fields;
 }
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:24,代码来源:easy_admin_products_category_model.php


示例2: zen_get_products_to_categories

            // show counts
            $total_products = zen_get_products_to_categories($categories->fields['categories_id'], true);
            $total_products_on = zen_get_products_to_categories($categories->fields['categories_id'], false);
            echo $total_products_on . TEXT_PRODUCTS_STATUS_ON_OF . $total_products . TEXT_PRODUCTS_STATUS_ACTIVE;
        }
        ?>
                  &nbsp;&nbsp;
                </td>
                <td class="dataTableContent" width="50" align="left">
<?php 
        if ($categories->fields['categories_status'] == '1') {
            echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag_categories&flag=0&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) && !empty($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '</a>';
        } else {
            echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag_categories&flag=1&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) && !empty($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>';
        }
        if (zen_get_products_to_categories($categories->fields['categories_id'], true, 'products_active') == 'true') {
            echo '&nbsp;&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED);
        }
        ?>
                </td>
                <td class="dataTableContent" align="right"><?php 
        echo $categories->fields['sort_order'];
        ?>
</td>
                <td class="dataTableContent" align="right">
                  <?php 
        echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=edit_category' . (isset($_GET['search']) && !empty($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>';
        ?>
                  <?php 
        echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=delete_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>';
        ?>
开发者ID:ygeneration666,项目名称:ec,代码行数:31,代码来源:category_product_listing.php


示例3: zen_get_products_to_categories

/**
 * Return the number of products in a category
 * TABLES: products, products_to_categories, categories
 * syntax for count: zen_get_products_to_categories($categories->fields['categories_id'], true)
 * syntax for linked products: zen_get_products_to_categories($categories->fields['categories_id'], true, 'products_active')
 */
function zen_get_products_to_categories($category_id, $include_inactive = false, $counts_what = 'products')
{
    global $db;
    $products_count = $cat_products_count = 0;
    $products_linked = '';
    if ($include_inactive == true) {
        switch ($counts_what) {
            case 'products':
                $cat_products_query = "select count(*) as total\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                           where p.products_id = p2c.products_id\n                           and p2c.categories_id = '" . (int) $category_id . "'";
                break;
            case 'products_active':
                $cat_products_query = "select p.products_id\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                           where p.products_id = p2c.products_id\n                           and p2c.categories_id = '" . (int) $category_id . "'";
                break;
        }
    } else {
        switch ($counts_what) {
            case 'products':
                $cat_products_query = "select count(*) as total\n                             from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                             where p.products_id = p2c.products_id\n                             and p.products_status = 1\n                             and p2c.categories_id = '" . (int) $category_id . "'";
                break;
            case 'products_active':
                $cat_products_query = "select p.products_id\n                             from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                             where p.products_id = p2c.products_id\n                             and p.products_status = 1\n                             and p2c.categories_id = '" . (int) $category_id . "'";
                break;
        }
    }
    $cat_products = $db->Execute($cat_products_query);
    switch ($counts_what) {
        case 'products':
            if (!$cat_products->EOF) {
                $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\n                               from " . TABLE_CATEGORIES . "\n                               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;
    }
}
开发者ID:kirkbauer2,项目名称:kirkzc,代码行数:72,代码来源:general.php


示例4: zen_draw_pull_down_menu

$gBitSmarty->assign('currentCategoryId', $current_category_id);
$gBitSmarty->assign('catMenu', zen_draw_pull_down_menu('cPath', zen_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'));
$catListHash = $_REQUEST;
if (isset($_GET['search'])) {
    $prodListHash['search'] = $_GET['search'];
    $catListHash['search'] = $_GET['search'];
} else {
    $catListHash['parent_id'] = $current_category_id;
}
$catCount = 0;
if ($catList = CommerceCategory::getList($catListHash)) {
    $catCount = count($catList);
    if ($gCommerceSystem->isConfigActive('SHOW_COUNTS_ADMIN')) {
        foreach (array_keys($catList) as $catId) {
            $catList[$catId]['total_products'] = zen_get_products_to_categories($catId, true);
            $catList[$catId]['total_products_on'] = zen_get_products_to_categories($catId, false);
        }
    }
    $gBitSmarty->assign('catList', $catList);
    $gBitSmarty->assign('catListHash', $catListHash);
}
$gBitSmarty->assign('catCount', $catCount);
$product = new CommerceProduct();
$offset = new splitPageResults($_GET['page'], MAX_DISPLAY_RESULTS_CATEGORIES, $products_query_raw, $products_query_numrows);
$prodListHash = $_REQUEST;
$prodListHash['all_status'] = 1;
$prodListHash['category_id'] = $current_category_id;
if ($prodList = $product->getList($prodListHash)) {
    $gBitSmarty->assign_by_ref('prodList', $prodList);
    $gBitSmarty->assign_by_ref('prodListHash', $prodListHash);
    $gBitSmarty->assign('prodCount', count($prodList));
开发者ID:bitweaver,项目名称:commerce,代码行数:31,代码来源:category_product_listing.php


示例5: zen_get_products_to_categories

function zen_get_products_to_categories($category_id, $include_inactive = false, $counts_what = 'products')
{
    global $gBitDb;
    $products_count = 0;
    $cat_products_count = 0;
    if ($include_inactive == true) {
        switch ($counts_what) {
            case 'products':
                $cat_products_query = "SELECT count(*) as `total`\n\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE p.`products_id` = p2c.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t and p2c.`categories_id` = '" . (int) $category_id . "'";
                break;
            case 'products_active':
                $cat_products_query = "SELECT p.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE p.`products_id` = p2c.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t and p2c.`categories_id` = '" . (int) $category_id . "'";
                break;
        }
    } else {
        switch ($counts_what) {
            case 'products':
                $cat_products_query = "SELECT count(*) as `total`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE p.`products_id` = p2c.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t and p.`products_status` = '1'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t and p2c.`categories_id` = '" . (int) $category_id . "'";
                break;
            case 'products_active':
                $cat_products_query = "SELECT p.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE p.`products_id` = p2c.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t and p.`products_status` = '1'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t and p2c.`categories_id` = '" . (int) $category_id . "'";
                break;
        }
    }
    $cat_products = $gBitDb->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 'true';
                }
                $cat_products->MoveNext();
            }
            break;
    }
    $cat_child_categories_query = "SELECT `categories_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_CATEGORIES . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE `parent_id` = '" . (int) $category_id . "'";
    $cat_child_categories = $gBitDb->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 'true';
                    }
                    break;
            }
            $cat_child_categories->MoveNext();
        }
    }
    switch ($counts_what) {
        case 'products':
            return $cat_products_count;
            break;
        case 'products_active':
            return 'true';
            break;
    }
}
开发者ID:bitweaver,项目名称:commerce,代码行数:64,代码来源:general.php



注:本文中的zen_get_products_to_categories函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP zen_get_products_type函数代码示例发布时间:2022-05-23
下一篇:
PHP zen_get_products_stock函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap