setShippingDiscount() public method

Amount being discounted for the shipping fee. Only supported when the payment_method is set to paypal.
public setShippingDiscount ( string | double $shipping_discount )
$shipping_discount string | double
Exemplo n.º 1
0
 /**
  * Build Amount
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return Amount
  */
 protected function buildAmount($quote)
 {
     $details = new Details();
     $details->setShipping($quote->getShippingAddress()->getBaseShippingAmount())->setTax($quote->getBillingAddress()->getBaseTaxAmount() + $quote->getBillingAddress()->getBaseHiddenTaxAmount() + $quote->getShippingAddress()->getBaseTaxAmount() + $quote->getShippingAddress()->getBaseHiddenTaxAmount())->setSubtotal($quote->getBaseSubtotal());
     $totals = $quote->getTotals();
     if (isset($totals['discount']) && $totals['discount']->getValue()) {
         $details->setShippingDiscount(-$totals['discount']->getValue());
     }
     $amount = new Amount();
     $amount->setCurrency($quote->getBaseCurrencyCode())->setDetails($details)->setTotal($quote->getBaseGrandTotal());
     return $amount;
 }