0) "; switch( $filter ) { case "all": $qfilter = ""; break; case "featured": $qfilter = " AND (product_special='Y') "; break; case "discounted": $qfilter = " AND (product_discount_id > 0) "; break; case "featured_and_discounted": $qfilter = " AND (product_special='Y' OR product_discount_id > 0) "; break; } // Check to see if this is a search or a browse by category // Default is to show all products if (!empty( $category_id )) { $list = "SELECT * FROM #__{sc}_product, #__{sc}_product_category_xref WHERE "; $count = "SELECT count(*) as num_rows FROM #__{sc}_product, product_category_xref, category WHERE "; //$q = "product.vendor_id = '$ps_vendor_id' "; $q = "#__{sc}_product_category_xref.category_id='$category_id' "; $q .= "AND #__{sc}_product.product_id=#__{sc}_product_category_xref.product_id "; $q .= $qfilter; $q .= "ORDER BY product_name "; $list .= $q . " LIMIT $limitstart, $limit"; $count .= $q; } elseif (!empty($keyword)) { $list = "SELECT * FROM #__{sc}_product WHERE "; $count = "SELECT count(*) as num_rows FROM #__{sc}_product WHERE "; //$q = "product.vendor_id = '$ps_vendor_id' "; $q = "(#__{sc}_product.product_name LIKE '%$keyword%' OR "; $q .= "#__{sc}_product.product_sku LIKE '%$keyword%' OR "; $q .= "#__{sc}_product.product_s_desc LIKE '%$keyword%' OR "; $q .= "#__{sc}_product.product_desc LIKE '%$keyword%'"; $q .= ") "; $q .= $qfilter; $q .= "ORDER BY product_name "; $list .= $q . " LIMIT $limitstart, $limit"; $count .= $q; } else { $list = "SELECT * FROM #__{sc}_product "; $count = "SELECT count(*) as num_rows FROM #__{sc}_product "; $q = "WHERE 1=1 "; $q .= $qfilter; $q .= "ORDER BY product_name "; $list .= $q . " LIMIT $limitstart, $limit"; $count .= $q; } $db->query($count); $db->next_record(); $num_rows = $db->f("num_rows"); // Create the Page Navigation $pageNav = new vmPageNav( $num_rows, $limitstart, $limit ); // Create the List Object with page navigation $listObj = new listFactory( $pageNav ); // print out the search field and a list heading $listObj->writeSearchHeader($VM_LANG->_('_PHPSHOP_FEATURED_PRODUCTS_LIST_LBL'), IMAGEURL."ps_image/product_code.png", $modulename, "specialprod"); echo ''.$VM_LANG->_PHPSHOP_FILTER.':  '; if($filter != "all") echo ''; echo $VM_LANG->_PHPSHOP_LIST_ALL_PRODUCTS; if ($filter != 'all') echo ''; echo '  |  '; if ($filter != 'featured_and_discounted') echo ''; echo $VM_LANG->_PHPSHOP_SHOW_FEATURED_AND_DISCOUNTED; if ($filter != 'featured_and_discounted') echo ''; echo '  |  '; if ($filter != 'featured') echo ''; echo $VM_LANG->_PHPSHOP_SHOW_FEATURED; if ($filter != 'featured') echo ''; echo '  |  '; if ($filter != 'discounted') echo ''; echo $VM_LANG->_PHPSHOP_SHOW_DISCOUNTED; if ($filter != 'discounted') echo ''; echo '

'; // start the list table $listObj->startTable(); // these are the columns in the table $columns = Array( "#" => "width=\"20\"", $VM_LANG->_PHPSHOP_PRODUCT_LIST_NAME => '', $VM_LANG->_PHPSHOP_PRODUCT_LIST_SKU => '', $VM_LANG->_PHPSHOP_PRODUCT_INVENTORY_PRICE => '', $VM_LANG->_PHPSHOP_FEATURED => '', $VM_LANG->_PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT => '', $VM_LANG->_PHPSHOP_FILEMANAGER_PUBLISHED => '' ); $listObj->writeTableHeader( $columns ); $db->query($list); $i = 0; while ($db->next_record()) { $listObj->newRow(); // The row number $listObj->addCell( $pageNav->rowNumber( $i ) ); $url = $_SERVER['PHP_SELF']."?page=$modulename.product_form&product_id=" . $db->f("product_id"); if ($db->f("product_parent_id")) { $url .= "&product_parent_id=" . $db->f("product_parent_id"); } $tmp_cell = "url($url) . "\">". $db->f("product_name").""; $listObj->addCell( $tmp_cell ); $listObj->addCell( $db->f("product_sku") ); $price=$ps_product->get_price($db->f("product_id")); if ($price) { if (!empty($price["item"])) { $tmp_cell = $CURRENCY_DISPLAY->getFullValue( $price["product_price"] ); } else { $tmp_cell = "none"; } } else { $tmp_cell = "none"; } $listObj->addCell( $tmp_cell ); $listObj->addCell( vmCommonHTML::getYesNoIcon( $db->f("product_special"), "On Special?" )); $listObj->addCell( $db->f("product_discount_id") ); $listObj->addCell( vmCommonHTML::getYesNoIcon( $db->f("product_publish"), "Published?" ) ); $i++; } $listObj->writeTable(); $listObj->endTable(); $listObj->writeFooter( $keyword ); ?>