Use Value Set by Parent?

2 posts by 2 authors in: Forums > CMS Builder
Last Post: May 28, 2012   (RSS)

By Perchpole - May 25, 2012 - edited: May 25, 2012

I have a system in place allowing a user to select 1 of a choice of menus to display on a category page. However, instead of setting this value on every page, it would be rather good if I could work out a way for sub-categories to use the value set by the parent category (if their own value is not set).

Here's the code I have so far...

if(isset($selectedCategory['selectMarginRight'])) {

list($marginRight, $marginRightMetaData) = getRecords(array(
'tableName' => 'margin',
'allowSearch' => false,
'where' => " num = '".intval($selectedCategory['selectMarginRight'])."' ",
'orderBy' => 'title',
));
$marginR = @$marginRight[0];
}
elseif {
......
}


What I need to work out is:

Does the selectedCategory have a parent?
Does that category have a ['selectMarginRight'] value?

If so, getRecords....


Can anyone help, please?

:0)

Perch