Re: Best sellers page - how to set a limit
Quote:
Originally Posted by
yellow1912
You can edit includes/modules/pages/best_sellers/header_php.php and put LIMIT into the sql query.
Thank you for your reply. I did figure that much, but my problem is that I do not know this programming language. Rather than come here immediately for answers, I tried to solve this on my own by entering LIMIT into the dev tool kit for ideas on how it is used. I saw several examples in other Zen files, although when I tried editing the header.php file on my own, I received errors every time. I even Googled SQL limit query and saw similar examples, but of course they don't work when I try them. If anyone knows how to set a limit of 50 results for the following, your help would be greatly appreciated.
Code:
if (BEST_SELLERS_SHOW_OUT_OF_STOCK == 'true') {
$listing_sql = "select distinct p.products_quantity, p.products_id, p.products_image, p.products_model, pd.products_name, p.products_ordered
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_ordered > 0
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
order by p.products_ordered desc, pd.products_name";
} else {
$listing_sql = "select distinct p.products_quantity, p.products_id, p.products_image, p.products_model, pd.products_name, p.products_ordered
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_ordered > 0
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_quantity > 0
and p.master_categories_id != 123
and p.products_id != 1992
order by p.products_ordered desc, pd.products_name";
}
$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);
/* ,
'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
*/
asort($define_list);
reset($define_list);
$column_list = array();
foreach ($define_list as $key => $value)
{
if ($value > 0) $column_list[] = $key;
}
?>
Best sellers on Home page (main page)?
I have a new site with no best seller history. My vendor has a best seller list, which is called from the main db on their site and is the same db that I use. Mine is a dupe of theirs, but on my server.
Is it possible to create a best sellers Product Listing on the Home page that would have a different layout from the other product pages and would call from the main db?
I'm not good at databases, so I don't know if I would have to manually add these products and links or just what. Suggestions?
Ref: http://artbeautiful.com