/** * */ function __construct($optionalController = null, $name, FieldSet $fields, FieldSet $actions, $optionalValidator = null) { parent::__construct($optionalController, $name, $fields, $actions, $optionalValidator); Requirements::javascript("ecommerce_modifier_example/javascript/ModifierExample.js"); }
function __construct($optionalController = null, $name, FieldList $fields, FieldList $actions, $optionalValidator = null) { parent::__construct($optionalController, $name, $fields, $actions, $optionalValidator); Requirements::themedCSS("DiscountCouponModifier", "ecommerce_discount_coupon"); Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js"); Requirements::javascript(THIRDPARTY_DIR . "/jquery-form/jquery.form.js"); //Requirements::block(THIRDPARTY_DIR."/jquery/jquery.js"); //Requirements::javascript(Director::protocol()."ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"); if ($jsRequirements = $this->Config()->get("custom_javascript_files")) { foreach ($jsRequirements as $js) { Requirements::javascript($js); } } }
function __construct($optionalController = null, $name, FieldSet $fields, FieldSet $actions, $validator = null) { parent::__construct($optionalController, $name, $fields, $actions, $validator); Requirements::javascript("ecommerce_corporate_account/javascript/OrderMarkerModifier.js"); }
/** * This function returns a form that allows a user * to change the modifier to the order. * * We have mainly added this function as an example! * * @param Controller $optionalController - optional custom controller class * @param Validator $optionalValidator - optional custom validator class * @return OrderModifierForm or subclass */ public function getModifierForm(Controller $optionalController = null, Validator $optionalValidator = null) { if ($this->ShowForm()) { $fields = new FieldList(); $fields->push($this->headingField()); $fields->push($this->descriptionField()); return OrderModifierForm::create($optionalController, "ModifierForm", $fields, $actions = new FieldList(), $optionalValidator); } }
function __construct($optionalController = null, $name, $fields, $actions, $optionalValidator = null) { parent::__construct($optionalController, $name, $fields, $actions, $optionalValidator); Requirements::javascript("ecommerce_anypriceproduct/javascript/AnyPriceRoundUpDonationModifier.js"); }
function __construct($optionalController = null, $name, FieldSet $fields, FieldSet $actions, $validator = null) { parent::__construct($optionalController, $name, $fields, $actions, $validator); }
function __construct($optionalController = null, $name, FieldList $fields, FieldList $actions, $optionalValidator = null, $recommendedBuyables) { $fieldsArray = new FieldList(array(new HeaderField($this->config()->get("something_recommended_text")))); $productFieldList = new FieldList(); foreach ($recommendedBuyables as $buyable) { $template = Config::inst()->get("RecommendedProductsModifier_Form", "product_template"); if ($template) { $checkboxID = $buyable->ClassName . "|" . $buyable->ID; $arrayData = new ArrayData(array("Buyable" => $buyable, "CheckboxID" => $checkboxID, "Checkbox" => new CheckboxField($checkboxID, _t("RecommendedProductsModifier_Form.ADD", "add")))); $productFieldList->push(new LiteralField("Buyable_" . $buyable->ID, $arrayData->renderWith($template))); } else { //foreach product in cart get recommended products $imageID = $buyable->ImageID; $imagePart = ''; if ($buyable && $buyable->ImageID > 0) { $resizedImage = $buyable->Image()->SetWidth($this->Config()->get("image_width")); if (is_object($resizedImage) && $resizedImage) { $imageLink = $resizedImage->Filename; $imagePart = '<span class="secondPart"><img src="' . $imageLink . '" alt="' . Convert::raw2att($buyable->Title) . '" /></span>'; } } if (!$imagePart) { $imagePart = '<span class="secondPart noImage">[no image available for ' . $buyable->Title . ']</span>'; } $priceAsMoney = EcommerceCurrency::get_money_object_from_order_currency($buyable->calculatedPrice()); $pricePart = '<span class="firstPart">' . $priceAsMoney->NiceLongSymbol() . '</span>'; $title = '<a href="' . $buyable->Link() . '">' . $buyable->Title . '</a>' . $pricePart . $imagePart . ''; $newField = new CheckboxField($buyable->ClassName . "|" . $buyable->ID, $title); $fieldsArray->push($newField); } } $fieldsArray->push(new CompositeField($productFieldList)); $actions = new FieldList(new FormAction('processOrderModifier', $this->config()->get("add_button_text"))); // 6) Form construction parent::__construct($optionalController, $name, $fieldsArray, $actions, $optionalValidator); Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js"); //Requirements::block(THIRDPARTY_DIR."/jquery/jquery.js"); //Requirements::javascript(Director::protocol()."ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"); Requirements::javascript("ecommerce_alsorecommended/javascript/RecommendedProductsModifier.js"); Requirements::themedCSS("RecommendedProductsModifier", "ecommerce_alsrecommended"); }