本文整理汇总了PHP中Magento\Sales\Model\Order::getBaseShippingAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getBaseShippingAmount方法的具体用法?PHP Order::getBaseShippingAmount怎么用?PHP Order::getBaseShippingAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Sales\Model\Order
的用法示例。
在下文中一共展示了Order::getBaseShippingAmount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDataFromOrder
/**
* Set entity data to request
*
* @param \Magento\Sales\Model\Order $order
* @param \Magento\Authorizenet\Model\Directpost $paymentMethod
* @return $this
*/
public function setDataFromOrder(\Magento\Sales\Model\Order $order, \Magento\Authorizenet\Model\Directpost $paymentMethod)
{
$payment = $order->getPayment();
$this->setXType($payment->getAnetTransType());
$this->setXFpSequence($order->getQuoteId());
$this->setXInvoiceNum($order->getIncrementId());
$this->setXAmount($payment->getBaseAmountAuthorized());
$this->setXCurrencyCode($order->getBaseCurrencyCode());
$this->setXTax(sprintf('%.2F', $order->getBaseTaxAmount()))->setXFreight(sprintf('%.2F', $order->getBaseShippingAmount()));
//need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript,
//but we need "" for null values.
$billing = $order->getBillingAddress();
if (!empty($billing)) {
$this->setXFirstName(strval($billing->getFirstname()))->setXLastName(strval($billing->getLastname()))->setXCompany(strval($billing->getCompany()))->setXAddress(strval($billing->getStreetLine(1)))->setXCity(strval($billing->getCity()))->setXState(strval($billing->getRegion()))->setXZip(strval($billing->getPostcode()))->setXCountry(strval($billing->getCountry()))->setXPhone(strval($billing->getTelephone()))->setXFax(strval($billing->getFax()))->setXCustId(strval($billing->getCustomerId()))->setXCustomerIp(strval($order->getRemoteIp()))->setXCustomerTaxId(strval($billing->getTaxId()))->setXEmail(strval($order->getCustomerEmail()))->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer')))->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email')));
}
$shipping = $order->getShippingAddress();
if (!empty($shipping)) {
$this->setXShipToFirstName(strval($shipping->getFirstname()))->setXShipToLastName(strval($shipping->getLastname()))->setXShipToCompany(strval($shipping->getCompany()))->setXShipToAddress(strval($shipping->getStreetLine(1)))->setXShipToCity(strval($shipping->getCity()))->setXShipToState(strval($shipping->getRegion()))->setXShipToZip(strval($shipping->getPostcode()))->setXShipToCountry(strval($shipping->getCountry()));
}
$this->setXPoNum(strval($payment->getPoNumber()));
return $this;
}
示例2: getTotal
/**
* @return TotalInterface
*/
private function getTotal()
{
/** @var TotalInterface $total */
$total = $this->totalFactory->create();
$total->setBaseShippingAmount($this->order->getBaseShippingAmount());
$total->setBaseShippingCanceled($this->order->getBaseShippingCanceled());
$total->setBaseShippingDiscountAmount($this->order->getBaseShippingDiscountAmount());
$total->setBaseShippingDiscountTaxCompensationAmnt($this->order->getBaseShippingDiscountTaxCompensationAmnt());
$total->setBaseShippingInclTax($this->order->getBaseShippingInclTax());
$total->setBaseShippingInvoiced($this->order->getBaseShippingInvoiced());
$total->setBaseShippingRefunded($this->order->getBaseShippingRefunded());
$total->setBaseShippingTaxAmount($this->order->getBaseShippingTaxAmount());
$total->setBaseShippingTaxRefunded($this->order->getBaseShippingTaxRefunded());
$total->setShippingAmount($this->order->getShippingAmount());
$total->setShippingCanceled($this->order->getShippingCanceled());
$total->setShippingDiscountAmount($this->order->getShippingDiscountAmount());
$total->setShippingDiscountTaxCompensationAmount($this->order->getShippingDiscountTaxCompensationAmount());
$total->setShippingInclTax($this->order->getShippingInclTax());
$total->setShippingInvoiced($this->order->getShippingInvoiced());
$total->setShippingRefunded($this->order->getShippingRefunded());
$total->setShippingTaxAmount($this->order->getShippingTaxAmount());
$total->setShippingTaxRefunded($this->order->getShippingTaxRefunded());
return $total;
}
示例3: _getOrderData
/**
* Get order request data as array
*
* @param \Magento\Sales\Model\Order $order
* @return array
*/
protected function _getOrderData(\Magento\Sales\Model\Order $order)
{
$request = array('subtotal' => $this->_formatPrice($this->_formatPrice($order->getPayment()->getBaseAmountAuthorized()) - $this->_formatPrice($order->getBaseTaxAmount()) - $this->_formatPrice($order->getBaseShippingAmount())), 'tax' => $this->_formatPrice($order->getBaseTaxAmount()), 'shipping' => $this->_formatPrice($order->getBaseShippingAmount()), 'invoice' => $order->getIncrementId(), 'address_override' => 'true', 'currency_code' => $order->getBaseCurrencyCode(), 'buyer_email' => $order->getCustomerEmail());
// append to request billing address data
if ($billingAddress = $order->getBillingAddress()) {
$request = array_merge($request, $this->_getBillingAddress($billingAddress));
}
// append to request shipping address data
if ($shippingAddress = $order->getShippingAddress()) {
$request = array_merge($request, $this->_getShippingAddress($shippingAddress));
}
return $request;
}
示例4: getNonTaxableAmount
/**
* Get payment amount data with excluded tax
* @param \Magento\Sales\Model\Order $order
* @return array
*/
private function getNonTaxableAmount(Order $order)
{
return ['subtotal' => $this->_formatPrice($order->getBaseSubtotal()), 'total' => $this->_formatPrice($order->getPayment()->getBaseAmountAuthorized()), 'tax' => $this->_formatPrice($order->getBaseTaxAmount()), 'shipping' => $this->_formatPrice($order->getBaseShippingAmount()), 'discount' => $this->_formatPrice(abs($order->getBaseDiscountAmount()))];
}
示例5: getNonTaxableAmount
/**
* Get payment amount data with excluded tax
* @param \Magento\Sales\Model\Order $order
* @return array
*/
private function getNonTaxableAmount(Order $order)
{
// PayPal denied transaction with 0 amount
$subtotal = $order->getBaseSubtotal() ?: $order->getPayment()->getBaseAmountAuthorized();
return ['subtotal' => $this->formatPrice($subtotal), 'total' => $this->formatPrice($order->getPayment()->getBaseAmountAuthorized()), 'tax' => $this->formatPrice($order->getBaseTaxAmount()), 'shipping' => $this->formatPrice($order->getBaseShippingAmount()), 'discount' => $this->formatPrice(abs($order->getBaseDiscountAmount()))];
}
示例6: getBaseShippingAmount
/**
* {@inheritdoc}
*/
public function getBaseShippingAmount()
{
return $this->_salesModel->getBaseShippingAmount();
}