/** * Returns the inherited DefaultGroupView * * @param SilvercartProductGroupPage $context Context * * @return string */ public function getDefaultGroupViewInherited($context = null) { if (is_null($context)) { $context = $this; } $defaultGroupView = $context->DefaultGroupView; if (empty($defaultGroupView) || SilvercartGroupViewHandler::getGroupView($defaultGroupView) === false) { if ($context->Parent() instanceof SilvercartProductGroupPage) { $defaultGroupView = $this->getDefaultGroupViewInherited($context->Parent()); } else { if ($context->Parent() instanceof SilvercartProductGroupHolder) { $defaultGroupView = $this->getDefaultGroupViewInherited($context->Parent()); } else { $defaultGroupView = SilvercartGroupViewHandler::getDefaultGroupViewInherited(); } } } return $defaultGroupView; }
/** * We set checkbox field values here to false if they are not in the post * data array. * * @param SilvercartWidget_Controller $widget Widget to initialize * @param array $data The post data array * * @return void * * @author Sebastian Diel <*****@*****.**> * @since 28.03.2012 */ public static function populateFromPostDataForProductSliderWidget(SilvercartWidget_Controller $widget, $data) { $widget->write(); if (!array_key_exists('isContentView', $data)) { $widget->isContentView = 0; } if (!array_key_exists('GroupView', $data)) { $widget->GroupView = SilvercartGroupViewHandler::getDefaultGroupViewInherited(); } if (!array_key_exists('Autoplay', $data)) { $widget->autoplay = 0; } if (!array_key_exists('buildArrows', $data)) { $widget->buildArrows = 0; } if (!array_key_exists('buildNavigation', $data)) { $widget->buildNavigation = 0; } if (!array_key_exists('buildStartStop', $data)) { $widget->buildStartStop = 0; } if (!array_key_exists('autoPlayDelayed', $data)) { $widget->autoPlayDelayed = 0; } if (!array_key_exists('autoPlayLocked', $data)) { $widget->autoPlayLocked = 0; } if (!array_key_exists('stopAtEnd', $data)) { $widget->stopAtEnd = 0; } if (!array_key_exists('useSlider', $data)) { $widget->useSlider = 0; } }
/** * returns the required ProductGroupPage template name required by the * decorators owner in dependence on the active group view. * * @param string $templateBase Base name for the template to use. * * @return string */ public function getProductGroupPageTemplateName($templateBase = 'SilvercartProductGroupPage') { $groupView = SilvercartGroupViewHandler::getActiveGroupView(); if (!$this->owner->isGroupViewAllowed($groupView)) { $groupView = $this->owner->getDefaultGroupViewInherited(); } if (empty($groupView)) { $groupView = SilvercartGroupViewHandler::getDefaultGroupViewInherited(); } return SilvercartGroupViewHandler::getProductGroupPageTemplateNameFor($groupView, $templateBase); }