/** * Default form registration routine of a product slider widget * * @param SilvercartWidget_Controller $widget Widget to initialize * @param DataObject $element Element to add cart form for * @param int &$elementIdx Element counter to use as ID and increment * @param string $addCartFormName The name of the form * * @return void * * @author Sebastian Diel <*****@*****.**> * @since 21.02.2013 */ public static function registerAddCartFormForProductWidget(SilvercartWidget_Controller $widget, $element, &$elementIdx, $addCartFormName = 'ProductAddCartForm') { if ($element instanceof SilvercartProduct) { if (empty($widget->GroupView)) { $widget->GroupView = SilvercartGroupViewHandler::getDefaultGroupViewInherited(); } $controller = Controller::curr(); $groupView = $widget->GroupView; $productAddCartFormName = SilvercartGroupViewHandler::getCartFormNameFor($groupView); $formIdentifier = $addCartFormName . $widget->ID . '_' . $element->ID; $productAddCartForm = new $productAddCartFormName($controller, array('productID' => $element->ID)); $controller->registerCustomHtmlForm($formIdentifier, $productAddCartForm); $elementIdx++; } }
/** * returns the required CartFormName required by the decorators owner in * dependence on the active group view. * * @return string */ public function getCartFormName() { return SilvercartGroupViewHandler::getCartFormNameFor(SilvercartGroupViewHandler::getActiveGroupView()); }