/** * @param \Magento\Sales\Model\Order\Item $orderItem * @param array $response * @return void */ protected function assertOrderItem(\Magento\Sales\Model\Order\Item $orderItem, array $response) { $this->assertEquals($orderItem->getId(), $response['item_id']); $this->assertEquals($orderItem->getOrderId(), $response['order_id']); $this->assertEquals($orderItem->getProductId(), $response['product_id']); $this->assertEquals($orderItem->getProductType(), $response['product_type']); $this->assertEquals($orderItem->getBasePrice(), $response['base_price']); $this->assertEquals($orderItem->getRowTotal(), $response['row_total']); }
/** * Return the total amount minus discount * * @param OrderItem|InvoiceItem|CreditmemoItem $item * @return mixed */ public function getTotalAmount($item) { $totalAmount = $item->getRowTotal() - $item->getDiscountAmount() + $item->getTaxAmount() + $item->getHiddenTaxAmount(); return $totalAmount; }
/** * Return the total amount minus discount * * @param OrderItem|InvoiceItem|CreditMemoItem $item * @return mixed */ public function getTotalAmount($item) { $totalAmount = $item->getRowTotal() - $item->getDiscountAmount() + $item->getTaxAmount() + $item->getHiddenTaxAmount() + $this->weeeHelper->getRowWeeeTaxInclTax($item); return $totalAmount; }
/** * Return the total amount minus discount * * @param OrderItem|InvoiceItem|CreditmemoItem $item * @return mixed */ public function getTotalAmount($item) { $totalAmount = $item->getRowTotal() + $item->getTaxAmount() + $item->getDiscountTaxCompensationAmount() + $item->getWeeeTaxAppliedRowAmount() - $item->getDiscountAmount(); return $totalAmount; }
/** * Retrieve tracking variables for an order item * * @param \Magento\Sales\Model\Order\Item $item The order item * * @return array */ private function getOrderItemVariables($item) { $variables = []; if (!$item->isDummy()) { $itemId = $item->getId(); $prefix = "order.items.{$itemId}"; $variables[$prefix . '.sku'] = $item->getSku(); $variables[$prefix . '.product_id'] = $item->getProductId(); $variables[$prefix . '.qty'] = $item->getQtyOrdered(); $variables[$prefix . '.price'] = $item->getBasePrice(); $variables[$prefix . '.row_total'] = $item->getRowTotal(); $variables[$prefix . '.label'] = $item->getName(); $variables[$prefix . '.salesrules'] = $item->getAppliedRuleIds(); if ($product = $item->getProduct()) { $categoriesId = $product->getCategoryIds(); if (count($categoriesId)) { $variables[$prefix . '.category_ids'] = implode(",", $categoriesId); } } } return $variables; }