/** * Adds calculator options to select * * @param ElementInterface|Select $select */ private function addCalculatorOptions(ElementInterface $select) { $collection = $this->getCalculators(); $collection->map(function (ShippingCalculatorInterface $calculator) use($select) { $select->addOptionToSelect($calculator->getAlias(), $calculator->getAlias()); }); }
/** * Adds payment method options to select * * @param ElementInterface|RadioGroup $radioGroup */ private function addPaymentOptions(ElementInterface $radioGroup) { $order = $this->getOrderProvider()->getCurrentOrder(); $shippingMethod = $order->getShippingMethod(); if ($shippingMethod instanceof ShippingMethodInterface) { $collection = $shippingMethod->getPaymentMethods(); $collection->map(function (PaymentMethodInterface $paymentMethod) use($radioGroup) { $radioGroup->addOptionToSelect($paymentMethod->getId(), $paymentMethod->translate()->getName()); }); } }