コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $func = _uc_line_item_data($form_state->getValue('line_item_id'), 'callback');
     if (function_exists($func) && ($form = $func('form', $form_state->getValue('order_id'))) != NULL) {
         $func('submit', $form, $form_state);
     } else {
         uc_order_line_item_add($form_state->getValue('order_id'), $form_state->getValue('line_item_id'), $form_state->getValue('title'), $form_state->getValue('amount'));
         drupal_set_message($this->t('Line item added to order.'));
     }
     $form_state->setRedirect('entity.uc_order.edit_form', ['uc_order' => $form_state->getValue('order_id')]);
 }
コード例 #2
0
 /**
  * Order pane submit callback: Add a line item to an order.
  */
 public function addLineItem($form, FormStateInterface $form_state)
 {
     $order =& $form_state->get('order');
     $type = $form_state->getValue('li_type_select');
     uc_order_line_item_add($order->id(), $type, _uc_line_item_data($type, 'title'), 0);
     $order->line_items = $order->getLineItems();
     $form_state->setRebuild();
 }
コード例 #3
0
ファイル: Order.php プロジェクト: pedrocones/hydrotools
 /**
  * {@inheritdoc}
  */
 public function getTotal()
 {
     $total = $this->getSubtotal();
     foreach ($this->line_items as $item) {
         if (_uc_line_item_data($item['type'], 'calculated') == TRUE) {
             $total += $item['amount'];
         }
     }
     return $total;
 }