ibexa

Path

ez publish / technical manual / 3.6 / reference / modules / shop / fetch functions / related_purchase


Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

related_purchase

Summary

Fetches products that were purchased together with a given product.

Usage

fetch( 'shop', 'related_purchase',
       hash( 'contentobject_id', id,
             'limit',            limit ) )

Parameters

NameTypeDescriptionRequired
contentobject_id integer The ID number of the object representing the source product. Yes.
limit integer The number of objects that should be fetched. Yes.

Returns

An array of ezcontentobject objects or FALSE.

Description

This function fetches a collection of products (content objects) that were purchased together with a given product. It can be used to create a "People who bought this product has also bought..." list. The source product must be specified using the "contentobject_id" parameter. This parameter must be an integer that reveals the ID number of the content object that represents the source product. The "limit" parameter must be used to limit the result. The function will return an array of ezcontentobject objects or FALSE if no objects were found.

Examples

Example 1

{def $other_products=fetch( 'shop', 'related_purchase',
                            hash( 'contentobject_id', 32,
                                  'limit',             5 ) )}
 
{foreach $other_products as $product}
    {$product.name} <br />
{/foreach}

Outputs the names of 5 products that were bought together with a product represented by object number 32.

Balazs Halasy (06/02/2004 12:49 pm)

Balazs Halasy (29/04/2005 9:17 am)


Comments

There are no comments.