本文整理汇总了PHP中tep_products_in_category_count函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_products_in_category_count函数的具体用法?PHP tep_products_in_category_count怎么用?PHP tep_products_in_category_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_products_in_category_count函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tep_db_prepare_input
if (isset($HTTP_GET_VARS['search'])) {
$search = tep_db_prepare_input($HTTP_GET_VARS['search']);
$categories_query = tep_db_query("select c.categories_status,c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
} else {
$categories_query = tep_db_query("select c.categories_status,c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int) $current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int) $languages_id . "' order by c.sort_order, cd.categories_name");
}
while ($categories = tep_db_fetch_array($categories_query)) {
$categories_count++;
$rows++;
// Get parent_id for subcategories if search
if (isset($HTTP_GET_VARS['search'])) {
$cPath = $categories['parent_id'];
}
if ((!isset($HTTP_GET_VARS['cID']) && !isset($HTTP_GET_VARS['pID']) || isset($HTTP_GET_VARS['cID']) && $HTTP_GET_VARS['cID'] == $categories['categories_id']) && !isset($cInfo) && substr($action, 0, 3) != 'new') {
$category_childs = array('childs_count' => tep_childs_in_category_count($categories['categories_id']));
$category_products = array('products_count' => tep_products_in_category_count($categories['categories_id']));
$cInfo_array = array_merge($categories, $category_childs, $category_products);
$cInfo = new objectInfo($cInfo_array);
}
if (isset($cInfo) && is_object($cInfo) && $categories['categories_id'] == $cInfo->categories_id) {
echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '\'">' . "\n";
} else {
echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . '\'">' . "\n";
}
?>
<td class="dataTableContent"><?php
echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '">' . tep_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a> <b>' . $categories['categories_name'] . '</b>';
?>
</td>
<td class="dataTableContent" align="center">
<?php
示例2: tep_products_in_category_count
function tep_products_in_category_count($categories_id, $include_deactivated = false)
{
$products_count = 0;
if ($include_deactivated) {
$products_query = tep_db_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) $categories_id . "'");
} else {
$products_query = tep_db_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) $categories_id . "'");
}
$products = tep_db_fetch_array($products_query);
$products_count += $products['total'];
$childs_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int) $categories_id . "'");
if (tep_db_num_rows($childs_query)) {
while ($childs = tep_db_fetch_array($childs_query)) {
$products_count += tep_products_in_category_count($childs['categories_id'], $include_deactivated);
}
}
return $products_count;
}
示例3: tep_products_in_category_count
function tep_products_in_category_count($categories_id, $include_deactivated = false)
{
global $osC_Database;
$products_count = 0;
$Qproducts = $osC_Database->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 = :categories_id');
if ($include_deactivated === true) {
$Qproducts->appendQuery('and p.products_status = 1');
}
$Qproducts->bindTable(':table_products', TABLE_PRODUCTS);
$Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
$Qproducts->bindInt(':categories_id', $categories_id);
$Qproducts->execute();
$products_count += $Qproducts->valueInt('total');
$Qchildren = $osC_Database->query('select categories_id from :table_categories where parent_id = :parent_id');
$Qchildren->bindTable(':table_categories', TABLE_CATEGORIES);
$Qchildren->bindInt(':parent_id', $categories_id);
$Qchildren->execute();
while ($Qchildren->next()) {
$products_count += tep_products_in_category_count($Qchildren->valueInt('categories_id'), $include_deactivated);
}
return $products_count;
}
示例4: set_time_limit
<?php
require 'includes/application_top.php';
set_time_limit(0);
// OPRUIMEN LEGE CATEGORIEËN EN SUBCATEGORIEËN
$categories_id = 0;
$categories = tep_get_category_tree($categories_id, '', '0', '', true);
// 'snoeit' tot 4 subcategorieën diep
for ($t = 0; $t <= 4; $t++) {
for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
if (tep_childs_in_category_count($categories[$i]['id']) == 0) {
if (tep_products_in_category_count($categories[$i]['id'], $include_deactivated = true) == 0) {
tep_remove_category($categories[$i]['id']);
}
}
}
}
// OPRUIMEN LEGE MERKEN
$manuf_query = tep_db_query("SELECT manufacturers_id FROM " . TABLE_MANUFACTURERS);
$row = mysql_fetch_array($manuf_query);
while ($row) {
$manuf_id[] = $row[0];
$row = mysql_fetch_array($manuf_query);
}
sort($manuf_id);
// array met alle manufacturers-id's
$aantal = count($manuf_id);
$prod_manufs_query = tep_db_query("SELECT DISTINCT manufacturers_id FROM " . TABLE_PRODUCTS);
$row2 = mysql_fetch_array($prod_manufs_query);
while ($row2) {
$prod_manufs[] = $row2[0];
示例5: while
}
}
?>
</tr>
</thead>
<?php
if ($displayCategories && $categories_entries > 0) {
?>
<tbody class="categories_tbody">
<?php
//FIND CATEGORIES
$anwkatwteleia = $bool_count_products || $bool_count_subcategories ? ' : ' : '';
$comma = $bool_count_products && $bool_count_subcategories ? ' , ' : '';
while ($categories = tep_db_fetch_array($categories_query)) {
//The next two lines slow execution down if count_products=true or/and count_subcategories=true. By default they are set to false.
$bcp = $bool_count_products ? tep_products_in_category_count($categories['categories_id'], true) . '<span class="cat_products_count" id="catid_' . $categories['categories_id'] . '">' . AAS_HEADING_PRODUCTS_COUNT . '</span>' : '';
$bcs = $bool_count_subcategories ? tep_childs_in_category_count($categories['categories_id']) . AAS_HEADING_SUBCATEGORIES_COUNT : '';
?>
<tr class="folder gradeX" id="cat_<?php
echo $categories['categories_id'];
?>
">
<td class="nojedit centerAlign checkboxen" ><input type="checkbox" id="category_<?php
echo $categories['categories_id'];
?>
" disabled="disabled"></td>
<td class="nojedit centerAlign previewPage" style="padding:0px;"><?php
echo '<a href="' . tep_href_link(FILENAME_AAS, 'cPath=' . $categories['categories_id']) . '">' . tep_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a>';
?>
<a target="_blank" class="view_category_class" title="<?php
示例6: while
if (!empty($_GET['search'])) {
$Qcategories->appendQuery('and cd.categories_name like :categories_name');
$Qcategories->bindValue(':categories_name', '%' . $_GET['search'] . '%');
} else {
$Qcategories->appendQuery('and c.parent_id = :parent_id');
$Qcategories->bindInt(':parent_id', $current_category_id);
}
$Qcategories->appendQuery('order by c.sort_order, cd.categories_name');
$Qcategories->bindTable(':table_categories', TABLE_CATEGORIES);
$Qcategories->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
$Qcategories->bindInt(':language_id', $osC_Language->getID());
$Qcategories->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
$Qcategories->execute();
while ($Qcategories->next()) {
if (!isset($cInfo) && (!isset($_GET['cID']) && !isset($_GET['pID']) || isset($_GET['cID']) && $_GET['cID'] == $Qcategories->valueInt('categories_id')) && $action != 'cNew') {
$cInfo_extra = array('childs_count' => tep_childs_in_category_count($Qcategories->valueInt('categories_id')), 'products_count' => tep_products_in_category_count($Qcategories->valueInt('categories_id')));
$cInfo = new objectInfo(array_merge($Qcategories->toArray(), $cInfo_extra));
}
if (isset($cInfo) && $Qcategories->valueInt('categories_id') == $cInfo->categories_id) {
echo ' <tr class="selected">' . "\n";
} else {
echo ' <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);" onClick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'page=' . $_GET['page'] . '&cPath=' . $cPath . '&search=' . $_GET['search'] . '&cID=' . $Qcategories->valueInt('categories_id')) . '\';">' . "\n";
}
?>
<td><?php
echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $osC_CategoryTree->buildBreadcrumb($Qcategories->valueInt('categories_id'))) . '">' . tep_image('images/icons/folder.gif', ICON_FOLDER) . ' <b>' . $Qcategories->value('categories_name') . '</b></a>';
?>
</td>
<td align="center"><?php
echo tep_image('templates/' . $template . '/images/icons/checkbox_ticked.gif');
?>
示例7: array
<tr>
<td align="right" class="smallText"><?php
echo HTML::button(OSCOM::getDef('image_back'), 'fa fa-chevron-left', OSCOM::link($back_url, $back_url_params));
?>
</td>
</tr>
</table>
<?php
} else {
$heading = $contents = [];
if (isset($_GET['cID']) && is_numeric($_GET['cID']) && $_GET['cID'] > 0) {
$Qcategory = $OSCOM_Db->get(['categories c', 'categories_description cd'], ['c.categories_id', 'cd.categories_name', 'c.categories_image', 'c.parent_id', 'c.sort_order', 'c.date_added', 'c.last_modified'], ['c.categories_id' => ['val' => (int) $_GET['cID'], 'rel' => 'cd.categories_id'], 'cd.language_id' => $OSCOM_Language->getId()]);
if ($Qcategory->fetch() !== false) {
$category_childs = array('childs_count' => tep_childs_in_category_count($Qcategory->valueInt('categories_id')));
$category_products = array('products_count' => tep_products_in_category_count($Qcategory->valueInt('categories_id')));
$cInfo_array = array_merge($Qcategory->toArray(), $category_childs, $category_products);
$cInfo = new objectInfo($cInfo_array);
}
} elseif (isset($_GET['pID']) && is_numeric($_GET['pID']) && $_GET['pID'] > 0) {
$Qproduct = $OSCOM_Db->get(['products p', 'products_description pd'], ['p.products_id', 'pd.products_name', 'p.products_quantity', 'p.products_image', 'p.products_price', 'p.products_date_added', 'p.products_last_modified', 'p.products_date_available', 'p.products_status'], ['p.products_id' => ['val' => (int) $_GET['pID'], 'rel' => ['pd.products_id']], 'pd.language_id' => $OSCOM_Language->getId()]);
if ($Qproduct->fetch() !== false) {
$Qreviews = $OSCOM_Db->get('reviews', '(avg(reviews_rating) / 5 * 100) as average_rating', ['products_id' => $Qproduct->valueInt('products_id')]);
$pInfo_array = array_merge($Qproduct->toArray(), $Qreviews->toArray());
$pInfo = new objectInfo($pInfo_array);
}
}
switch ($action) {
case 'new_category':
$heading[] = array('text' => OSCOM::getDef('text_info_heading_new_category'));
$contents = array('form' => HTML::form('newcategory', OSCOM::link(FILENAME_CATEGORIES, 'action=insert_category&cPath=' . $cPath), 'post', 'enctype="multipart/form-data"'));