Skip to the content
Documentation

best_sell_list

No ratings yet

Summary

Fetches the most popular / most sold products.

Usage

fetch( 'shop', 'best_sell_list',
       hash( 'top_parent_node_id', id,
             'limit',              limit ) )

Parameters

Name Type Description Required
top_parent_node_id integer The ID number of the top node. Yes.
limit integer The number of objects that should be returned. Yes.

Returns

An array of ezcontentobject objects or FALSE.

Description

This function fetches the most popular / most sold products that are located within a part of the content node tree. The "top_parent_node_id" parameter must be used to tell the function under which node it should look for popular products. The "limit" parameter controls the number of items that will be returned. The function returns an array of ezcontentobject objects. If the function is unable to find any products, FALSE will be returned.

Examples

Example 1

{def $best_sellers=fetch( 'shop', 'best_sell_list',
                          hash( 'top_parent_node_id', 2,
                                'limit',              5 ) )}

{foreach $best_sellers as $product}
    {$product.name} <br />
{/foreach}

Outputs the names of the five most popular products that are located somewhere below node number 2.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.