protected function checkoutconfig()
 {
     $config = new CheckoutComponentConfig(ShoppingCart::curr(), true);
     $config->addComponent($comp = new CouponCheckoutComponent());
     $comp->setValidWhenBlank(true);
     return $config;
 }
 public function __construct($controller, $name, Order $order)
 {
     $this->config = new CheckoutComponentConfig($order, false);
     $this->config->addComponent($couponcompoent = new CouponCheckoutComponent());
     $fields = $this->config->getFormFields();
     $actions = new FieldList(FormAction::create('applyCoupon', _t('ApplyCoupon', 'Apply coupon')));
     $validator = new CheckoutComponentValidator($this->config);
     parent::__construct($controller, $name, $fields, $actions, $validator);
     $this->loadDataFrom($this->config->getData(), Form::MERGE_IGNORE_FALSEISH);
     $storeddata = $couponcompoent->getData($order);
     if (isset($storeddata['Code'])) {
         $actions->push(FormAction::create('removeCoupon', _t('RemoveCoupon', 'Remove coupon')));
     }
     $controller->extend("updateCouponForm", $this, $order);
 }