Example #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;
 }
Example #2
0
 /**
  * Prevent compounding nominal subtotal in case if the trial payment exists
  *
  * @param \Magento\Sales\Model\Quote\Address $address
  * @param \Magento\Sales\Model\Quote\Item\AbstractItem $item
  * @return void
  * @see \Magento\Sales\Model\Quote\Address\Total\Nominal\Subtotal
  */
 protected function _afterCollectSuccess($address, $item)
 {
     $item->setData('skip_compound_row_total', true);
 }