QQ 1640076782

2010年01月30日

osc-筛选分类按字母顺序

Filed under: 网站程序OSC — past @ 9:09 下午

osc-筛选分类按字母顺序:

如果您的商店上有一类目录的产品很多,这一修正可能会派上用场.

这将允许您将孤立的产品添加到一个从上面列出的类别,以字母开始点击显示吧。
因此,当一个
类别被点击的会显示所有相关产品,所有其他产品将不会显示。

具体操作:

1.显示字母列表:

<?php
$lstr = “ABCDEFGHIJKLMNOPQRSTUVWXYZ”;
for( $i = 0; $i < strlen($lstr); $i++ ) {
$l = substr( $lstr, $i, 1);
echo ‘<a href=”‘ . tep_href_link(FILENAME_DEFAULT, ‘alpha=’ . $l ) . ‘”><u>’ . $l . ‘</u></a>&nbsp;&nbsp;’;
}
if (tep_session_is_registered(‘last_cat’));

if (tep_not_null($current_category_id)){
tep_session_register(‘last_cat’);
$last_cat = $current_category_id;
}
?>

2.筛选结果

if (isset($_GET['alpha'])) {
$listing_sql = “select ” . $select_column_list . ” p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from ” . TABLE_PRODUCTS_DESCRIPTION . ” pd, ” . TABLE_PRODUCTS . ” p left join ” . TABLE_MANUFACTURERS . ” m on p.manufacturers_id = m.manufacturers_id left join ” . TABLE_SPECIALS . ” s on p.products_id = s.products_id, ” . TABLE_PRODUCTS_TO_CATEGORIES . ” p2c where p.products_status = ’1′ and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.products_name like ‘” . $_GET['alpha'] .  “%’ and pd.language_id = ‘” . (int)$languages_id . “‘ and p2c.categories_id = ‘” . (int)$_SESSION['last_cat'] .”‘”;
// show the products in a given category
} elseif(isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
//  Filter Category Alphabetically ?end