Пример #1
0
 /**
  * Recalculate child discount. Separate discount between children
  *
  * @param AbstractItem $child
  * @return $this
  */
 protected function _recalculateChildDiscount($child)
 {
     $item = $child->getParentItem();
     $prices = array('base' => $item->getBaseOriginalPrice(), 'current' => $item->getPrice());
     $keys = array('discount_amount', 'original_discount_amount');
     foreach ($keys as $key) {
         $child->setData($key, $child->getData($key) * $child->getPrice() / $prices['current']);
         $child->setData('base_' . $key, $child->getData('base_' . $key) * $child->getPrice() / $prices['base']);
     }
     return $this;
 }
Пример #2
0
 /**
  * Whether the item row total may be compounded with others
  *
  * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
  * @return bool
  */
 public function getIsItemRowTotalCompoundable(\Magento\Sales\Model\Quote\Item\AbstractItem $item)
 {
     if ($item->getData("skip_compound_{$this->_itemRowTotalKey}")) {
         return false;
     }
     return true;
 }