Functions:recentlyViewedGet

From Whirlwind eCommerce Wiki
Jump to: navigation, search

Description

eV::recentlyViewedGet($fieldList) retrieves an array of page data for a history of recently viewed pages. These pages are added to recently viewed history by applying the recentlyViewedAdd function inside of templates of those pages.

Syntax

$array = eV::recentlyViewedGet($fieldList);

Paramaters

  • $fieldList STRING REQUIRED
Comma delimated list of field names that should be returned for each recently viewed page history entry.

Return Values

Returns a multidimensional array. The first dimension of this array is the index of the page. The second dimension are the fields of data returned for each page.

The returned array is as follows (all possible fields are listed, note that only fields requested will be returned):

Array
(
    [0] => Array
        (
            // fields automatically included
            [pageId] => INT
            [blog_userId] => INT // user id for blogger
            [authorId] => INT // user id for author
            [isLinkDirect] => BIT // signal that this is an outside link circumvents page forwarding
            [isForum] => BIT
            [link] => STR
            [customContent] => STR
            [orderId] => INT
            [relationshipId] => INT

            //page data
            [templateId] => INT
            [notice] => STR
            [title] => STR
            [subTitle] => STR
            [copy] => STR
            [summary] => STR
            [summaryImage] => STR
            [summaryImageAlt] => STR
            [summaryImageCaption] => STR
            [linkText] => STR
            [publisher] => STR
            [publishDate] => DATETIME
            [startDate] => DATETIME
            [endDate] => DATETIME
            [isBlog] => BIT
            [isPoll] => BIT
            [createDate] => DATETIME
            [modDate] => DATETIME

            // author fields
            [author_firstName] => STRING
            [author_lastName] => STRING
            [author_userImage] => STRING
            [author_handle] => STRING

            // blogger fields
            [blog_firstName] => STRING
            [blog_lastName] => STRING
            [blog_userImage] => STRING
            [blog_handle] => STRING

            // forum / comments fields
            [forumCount] => INT
            [ratingTotal] => INT
            [ratingCount] => INT
            [ratingAverage] => DECIMAL

            // product fields
            [productName] => STRING (for first product in page)
            [productTitle] => STRING (for first product in page)
            [productDescription] => STRING (for first product in page)
            [productId] => INT (for first product in page)
            [lowestPrice] => DECIMAL
            [lowestListPrice] => DECIMAL
            [lowestSalePrice] => DECIMAL
            [productCount] => INT
            [productIdList] => STRING (comma delimited list of INT)
            [saleFromDate] => DATETIME (for first product in page)
            [saleToDate] => DATETIME (for first product in page)
            [lowestLevelPrice] => DECIMAL
            [lowestAllPrice] => DECIMAL

            //children's children and children's grandchildren (great grandchildren to parent pageId)
            [childPageCount] => INT
            [grandChildPageCount] => INT

            //poll data
            [pollCount] => INT

            //custom fields
            [custom_field_?] => ?
                        
        )
    [1] => Array ...
)

Examples

// get array of pages recently viewed
$arrViewedPages = eV::recentlyViewedGet('title,summaryImage,pageId');
 
//output the pages
foreach($arrViewedPages as $page) {
echo "<hr><img src=\"" . $page['summaryImage'] . "\"><br>";
echo "<a href=\"index.php?pageId=" . $page['pageId'] . "\">" . $page['title'] . "</a>";
};