Example #1
0
 /**
  * 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;
 }
Example #2
0
 /**
  * @param Item $item
  * @return Product
  */
 protected function makeProduct(Item $item)
 {
     $product = SignifydModel::Make("\\Signifyd\\Models\\Product");
     $product->itemId = $item->getSku();
     $product->itemName = $item->getName();
     $product->itemPrice = $item->getPrice();
     $product->itemQuantity = (int) $item->getQtyOrdered();
     $product->itemUrl = $item->getProduct()->getProductUrl();
     $product->itemWeight = $item->getProduct()->getWeight();
     return $product;
 }
Example #3
0
 /**
  * Get item sku
  *
  * @param \Magento\Sales\Model\Order\Item $item
  *
  * @return string
  */
 public function getSku(\Magento\Sales\Model\Order\Item $item)
 {
     return $item->getSku();
 }