/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->submitCustomerForm($form, $form_state); $values = $form_state->getValues(); $this->order->setEmail($values['mail']); $this->order->setOwnerId($values['uid']); $this->order->save(); drupal_set_message($this->t('The order %label has been assigned to customer %customer.', ['%label' => $this->order->label(), '%customer' => $this->order->getOwner()->label()])); $form_state->setRedirectUrl($this->order->toUrl('collection')); }
/** * {@inheritdoc} */ public function removeLineItem(OrderInterface $cart, LineItemInterface $line_item, $save_cart = TRUE) { $line_item->delete(); $cart->removeLineItem($line_item); $this->eventDispatcher->dispatch(CartEvents::CART_LINE_ITEM_REMOVE, new CartLineItemRemoveEvent($cart, $line_item)); if ($save_cart) { $cart->save(); } }