Filter products and hide sale code

12 posts by 2 authors in: Forums > CMS Builder
Last Post: September 20, 2012   (RSS)

By Mohaukla - September 20, 2012

Yes the code you gave me replaced the SEO type text after the link (category= Yard and Garden) with a 'num' value (category=1) and that works great for the filtering.

I just added your code to the php section and substituted 'title' for the necessary field but the 'num' value is still showing up


So I now have


<?php
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('D:/HostingSpaces/2tinker/2tinker.com/wwwroot/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

list($footer_site_wideRecords, $footer_site_wideMetaData) = getRecords(array(
'tableName' => 'footer_site_wide',
'where' => '', // load first record
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$footer_site_wideRecord = @$footer_site_wideRecords[0]; // get first record
if (!$footer_site_wideRecord) { dieWith404("Record not found!"); } // show error message if no record found

// load records from 'products'
list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'perPage' => '5',
'loadUploads' => true,
'allowSearch' => true,
));

$categories = mysql_select ('categories');
//make the array key the 'num' field
$categoriesSorted = array_groupBy($categories,'num');
//use the passed url value to call the correct category name field.
echo @$categoriesSorted[intval($_REQUEST['categories'])]['title'];


?>


And request code:
<?php echo @$_REQUEST['categories']; ?>


and showme code of: (based on the link clicked was Landscape or 4)


Landscape
Array
(
[0] => Array
(
[num] => 1
[createdDate] => 2012-09-11 21:42:55
[createdByUserNum] => 1
[updatedDate] => 2012-09-11 21:42:55
[updatedByUserNum] => 1
[dragSortOrder] => 40
[title] => Yard and Garden
[content] =>
[_tableName] => categories
)

[1] => Array
(
[num] => 2
[createdDate] => 2012-09-11 21:43:16
[createdByUserNum] => 1
[updatedDate] => 2012-09-11 21:43:16
[updatedByUserNum] => 1
[dragSortOrder] => 30
[title] => Automotive
[content] =>
[_tableName] => categories
)

[2] => Array
(
[num] => 3
[createdDate] => 2012-09-11 21:43:30
[createdByUserNum] => 1
[updatedDate] => 2012-09-11 21:43:30
[updatedByUserNum] => 1
[dragSortOrder] => 20
[title] => Recreational
[content] =>
[_tableName] => categories
)

[3] => Array
(
[num] => 4
[createdDate] => 2012-09-11 21:43:52
[createdByUserNum] => 1
[updatedDate] => 2012-09-11 21:43:52
[updatedByUserNum] => 1
[dragSortOrder] => 10
[title] => Landscape
[content] =>
[_tableName] => categories
)

)


You can see it here after clicking on any category

http://2tinker.com.r15.millsys.org/index.php
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"