addComponent() public method

public addComponent ( CheckoutComponent $component, string $insertBefore = null )
$component CheckoutComponent
$insertBefore string The class of the component to insert this one before
 public function ConfirmationForm()
 {
     $config = new CheckoutComponentConfig(ShoppingCart::curr(), false);
     $config->addComponent(new NotesCheckoutComponent());
     $config->addComponent(new TermsCheckoutComponent());
     $form = new PaymentForm($this->owner, "ConfirmationForm", $config);
     $form->setFailureLink($this->owner->Link('summary'));
     $this->owner->extend('updateConfirmationForm', $form);
     return $form;
 }
 public function registerconfig()
 {
     $order = ShoppingCart::curr();
     //hack to make components work when there is no order
     if (!$order) {
         $order = Order::create();
     }
     $config = new CheckoutComponentConfig($order, false);
     $config->addComponent(new CustomerDetailsCheckoutComponent());
     $config->addComponent(new MembershipCheckoutComponent());
     return $config;
 }
 public function setUp()
 {
     ShopTest::setConfiguration();
     CheckoutConfig::config()->membership_required = false;
     parent::setUp();
     $this->member = $this->objFromFixture("Member", "jeremyperemy");
     $this->cart = $this->objFromFixture("Order", "cart1");
     $this->address1 = $this->objFromFixture("Address", "address1");
     $this->address2 = $this->objFromFixture("Address", "address2");
     $this->config = new CheckoutComponentConfig($this->cart, true);
     $this->config->addComponent(new BillingAddressBookCheckoutComponent());
     $this->address1->MemberID = $this->member->ID;
     $this->address1->write();
 }
 protected function checkoutconfig()
 {
     $config = new CheckoutComponentConfig(ShoppingCart::curr(), true);
     $config->addComponent($comp = new CouponCheckoutComponent());
     $comp->setValidWhenBlank(true);
     return $config;
 }
 public function ContactDetailsForm()
 {
     $cart = ShoppingCart::curr();
     if (!$cart) {
         return false;
     }
     $config = new CheckoutComponentConfig(ShoppingCart::curr());
     $config->addComponent(CustomerDetailsCheckoutComponent::create());
     $form = CheckoutForm::create($this->owner, 'ContactDetailsForm', $config);
     $form->setRedirectLink($this->NextStepLink());
     $form->setActions(FieldList::create(FormAction::create("checkoutSubmit", _t('CheckoutStep.Continue', "Continue"))));
     $this->owner->extend('updateContactDetailsForm', $form);
     return $form;
 }
 public function billingconfig()
 {
     $config = new CheckoutComponentConfig(ShoppingCart::curr());
     $config->addComponent(new BillingAddressBookCheckoutComponent());
     return $config;
 }
 protected function checkoutconfig()
 {
     $config = new CheckoutComponentConfig(ShoppingCart::curr(), false);
     $config->addComponent(PaymentCheckoutComponent::create());
     return $config;
 }
 public function PaymentForm()
 {
     if (!(bool) $this->Cart()) {
         return false;
     }
     $config = new CheckoutComponentConfig(ShoppingCart::curr(), false);
     $config->addComponent(OnsitePaymentCheckoutComponent::create());
     $form = PaymentForm::create($this, "PaymentForm", $config);
     $form->setActions(FieldList::create(FormAction::create("submitpayment", _t('CheckoutForm.SubmitPayment', "Submit Payment"))));
     $form->setFailureLink($this->Link());
     $this->extend('updatePaymentForm', $form);
     return $form;
 }