Functions:pageChildrenGet

From Whirlwind eCommerce Wiki
Revision as of 08:34, 3 October 2008 by Root (Talk | contribs)

Jump to: navigation, search

Description

Retrieves page and product data on child pages.

Syntax

$arrChildren= eV::pageChildrenGet($pageId[,$fieldList][,$orderBy][,$orderDir][,$orderType]);

Paramaters

  • $pageId INT
unique database assigned page id of the parent page whos children you would like to retrieve
  • $fieldList STRING (optional)
comma delimited list of field names you would like returned. leaving this value empty will return all fields, though this is not recommended as it could significantly reduce system performance. Page custom fields can be requested by prepending the custom field name with "custom_field_" (example: to include the "myVar" custom field, add "custom_field_myVar" to the $fieldList).
  • $orderBy STRING (optional)
field to order by. This field must be present in the $fieldList. defaults to 'orderId' which corresponds to the order the children are listed in relationships management for the parent $pageId
  • $orderDir STRING (optional)
Either "ASC" or "DESC" signifying the direction of the sorted results. Defaults to "DESC".
  • $orderType STRING (optional)
Either "str" or "num" signifying how the values will be compared when sorting the results. Defaults to "str"

Return Values

Returns a multidimensional array of child page data. The first dimension is a numerically indexed array of each child (starting from 0). The second dimension is an associative array of keys corresponding to the fields requested in the $fieldList attribute.

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 ...
)

Elements from the child page associative array are as follows:

Element Description Example
fields automatically included
pageId
blog_userId
authorId
isLinkDirect
isForum
link
customContent
orderId
relationshipId
page data
templateId
notice
title
subTitle
copy
summary
summaryImage
summaryImageAlt
summaryImageCaption
linkText
publisher
publishDate
startDate]
endDate
isBlog
isPoll
createDate
modDate
author fields
author_firstName
author_lastName
author_userImage
author_handle
blogger fields
blog_firstName
blog_lastName
blog_userImage
blog_handle
forum / comments fields
forumCount
ratingTotal
ratingCount
ratingAverage
product fields
productName
productTitle
productDescription
productId
lowestPrice
lowestListPrice
lowestSalePrice
productCount
productIdList
saleFromDate
saleToDate
lowestLevelPrice
lowestAllPrice
children's children and children's grandchildren (great grandchildren to parent pageId)
childPageCount
grandChildPageCount
poll data
pollCount
custom fields
custom_field_?

Examples

Example
// call
$childArr = eV::pageChildrenGet('title,summary,summaryImage,link');
// output
foreach($childArr as $child) {
echo "<hr>";
echo "<a href=\"" . $child['link'] . "\">";
echo "<img align=\"left\" src=\"" . $child['summaryImage'] . "\">";
echo "</a>";
echo "<a href=\"" . $child['link'] . "\">" . $child['title'] . "</a>";
echo "<br>" . $child['summary'];
};