Functions:pageCustomSearchGroup

From Whirlwind eCommerce Wiki
Jump to: navigation, search
Page Template Managers

Page Template Functions

Description

Retrieves data associated with a particular Custom Search Group

Syntax

$csArr = eV::pageCustomSearchGroup($groupIdOrName);

Paramaters

  • $groupIdOrName INT or STRING
the groupId as set by the system when creating the group or the exact name of the group (cap sensitive). Note: using the group name is not recommended as changes to the group name by content managers would disable the call to the group within the page template.

Return Values

Returns associative array of group information. Returns Boolean FALSE if no matching group is found. The array is as follows:

Array
(
    [groupName] => STRING
    [groupNotes] => STRING
    [groupId] => INT
    [selectField] => STRING
    [options] => Array
        (
            [optionId] => INT
            [optionName] => STRING
            [link] => STRING
            
        )
)

Elements from the custom search group associative array are as follows:

optionName
Element Description Example
groupName STRING group name as set in Custom Search Groups administration for the group By Category
groupNotes STRING extended description of the group as set in Custom Search Groups administration Select a category to jump to that category
groupId INTEGER unique id assigned to the custom search group upon creation 154
selectField STRING the entire select field output necessary to support a custom search group drop down. This includes the <SELECT> tags, all <Option%gt; tags, option tag contents and javascript built in to jump to the page. Simply place the output of this element where you want to tag to appear. <select id="eV_customSearch_autoSelect_12" name="eV_customSearch_autoSelect_12" onChange="window.location.href=this.options[this.selectedIndex].value;">

<option value="index.php?fa=PAGE.search&optionId=32">Category 1</option> <option value="index.php?fa=PAGE.search&optionId=33">Category 2</option> <option value="index.php?fa=PAGE.search&optionId=36">Category X</option> &;lt;/select>

options ARRAY of individual selection options. Use to build your own custom output of the custom search group. array()
optionId INTEGER unique ID assigned to option upon creation 145
STRING name of the option as set in Custom Search Groups Category 2
link STRING link to forward visitor to when the option is selected index.php?fa=PAGE.search&optionId=145

Examples

Using the selectField option. Using the groupId in the calling function
// call your group at the beginning of your script
$groupArr = eV:pageCustomSearchGroup(45);
 
//output your field
//first display the group name (which should describe to the visitor what the field is for)
// than output the select field
echo $groupArr['groupName'] . "<br>" . $groupArr['selectField'];
Using the options Array. Using the groupName in the calling function
// call your group at the beginning of your script
//NOTE: it is not recommended to use the group name in this function as changes to group name by content managers will disable this call
$groupArr = eV:pageCustomSearchGroup('Select a Category');
 
//output information about the group and open the list
echo $groupArr['groupName'] . "<br>" . $groupArr['groupNotes'] . "<ul>";
// build a series of links to jump to the group
foreach($groupArr['options'] as $option) echo "<li><a href=\"" . $option['link'] . "\">" . $option['optionName'] . "</a>";
//close the list
echo "</ul>";