本文整理汇总了PHP中Mage_Sales_Model_Order_Creditmemo::getStoreId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Creditmemo::getStoreId方法的具体用法?PHP Mage_Sales_Model_Order_Creditmemo::getStoreId怎么用?PHP Mage_Sales_Model_Order_Creditmemo::getStoreId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Creditmemo
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Creditmemo::getStoreId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setEntity
/**
* Set entity
*
* @param Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $object
* @return $this
*/
public function setEntity($object)
{
$this->setEntityId($object->getId());
$this->setEntityIncrementId($object->getIncrementId());
$this->setStoreId($object->getStoreId());
return $this;
}
示例2: _getGwTaxClassId
/**
* Get gift wrapping tax class id
*
* @param Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo|Mage_Sales_Model_Quote_Address $object
* @return int
*/
protected function _getGwTaxClassId($object)
{
if (!$object->getGwPrice() && !$object->getGwItemsPrice() && !$object->getGwPrintedCardPrice()) {
return 0;
}
if ($object instanceof Mage_Sales_Model_Quote_Address) {
$storeId = $object->getQuote()->getStoreId();
} else {
$storeId = $object->getStoreId();
}
return $this->_getWrappingTaxClass($storeId);
}
示例3: registerCreditmemo
/**
* Generate and send a RefundInvoice
*
* @param Aoe_AvaTax_Model_Api $api
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
*
* @return string
* @throws Aoe_AvaTax_Exception
* @throws Exception
*/
public function registerCreditmemo(Aoe_AvaTax_Model_Api $api, Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
if (!$this->isActive($creditmemo->getStore())) {
return null;
}
$incrementId = $creditmemo->getIncrementId();
if (empty($incrementId)) {
/* @var $entityType Mage_Eav_Model_Entity_Type */
$entityType = Mage::getModel('eav/entity_type')->loadByCode('creditmemo');
$creditmemo->setIncrementId($entityType->fetchNewIncrementId($creditmemo->getStoreId()));
}
$result = $api->callGetTaxForCreditmemo($creditmemo, true);
if ($result['ResultCode'] !== 'Success') {
throw new Aoe_AvaTax_Exception($result['ResultCode'], $result['Messages']);
}
// NB: Ignoring the returned tax data on purpose
$creditmemo->getResource()->beginTransaction();
try {
$creditmemo->setAvataxDocument($result['DocCode']);
$creditmemo->addComment(sprintf('RefundInvoice sent to AvaTax (%s)', $result['DocCode']));
$creditmemo->save();
$creditmemo->getOrder()->addStatusHistoryComment(sprintf('RefundInvoice sent to AvaTax (%s)', $result['DocCode']));
$creditmemo->getOrder()->save();
$creditmemo->getResource()->commit();
} catch (Exception $e) {
$creditmemo->getResource()->rollBack();
throw $e;
}
return $result['DocCode'];
}
示例4: getArticles
/**
* Article preparations for PAYMENT_REQUEST, PAYMENT_CHANGE, CONFIRMATION_DELIVER
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $object
* @return array
*/
public function getArticles($object)
{
$articles = array();
$articleDiscountAmount = 0;
$objectItems = $object->getAllItems();
foreach ($objectItems as $item) {
if ($item instanceof Mage_Sales_Model_Order_Item || $item instanceof Mage_Sales_Model_Quote_Item) {
$orderItem = $item;
} else {
$orderItem = Mage::getModel('sales/order_item')->load($item->getOrderItemId());
}
$shopProduct = Mage::getModel('catalog/product')->load($orderItem->getProductId());
if (($orderItem->getProductType() !== 'bundle' || $orderItem->getProductType() === 'bundle' && $shopProduct->getPrice() > 0) && $orderItem->getRowTotal() > 0) {
$article = array();
$article['articleNumber'] = $item->getSku();
$article['articleName'] = $item->getName();
$article['quantity'] = $object instanceof Mage_Sales_Model_Order ? $item->getQtyOrdered() : $item->getQty();
$article['unitPriceGross'] = $item->getPriceInclTax();
$article['tax'] = $item->getTaxAmount();
$article['taxPercent'] = $orderItem->getTaxPercent();
if ($object instanceof Mage_Sales_Model_Quote) {
$article['unitPriceNett'] = $item->getCalculationPrice();
} else {
$article['unitPriceNett'] = $item->getPrice();
// netto
}
$article['discountId'] = '';
if ($item->getDiscountAmount() > 0) {
$discount = array();
$discount['articleNumber'] = 'DISCOUNT-' . $item->getSku();
$discount['articleName'] = 'DISCOUNT - ' . $item->getName();
$discount['quantity'] = $article['quantity'];
$article['tax'] = $item->getRowTotalInclTax() - $item->getRowTotal();
$discount['tax'] = -1 * ($article['tax'] - $item->getTaxAmount());
$tax = 0;
$taxConfig = Mage::getSingleton('tax/config');
if ($taxConfig->priceIncludesTax($object->getStoreId())) {
$tax = $discount['tax'];
}
if (round($discount['tax'], 2) < 0) {
$discount['taxPercent'] = $article['taxPercent'];
}
$discount['unitPriceGross'] = -1 * $item->getDiscountAmount() / $article['quantity'];
$discount['discountId'] = $item->getSku();
$articleDiscountAmount = $articleDiscountAmount + $item->getDiscountAmount();
}
$articles[] = $article;
if ($item->getDiscountAmount() > 0) {
// only for sort reason
$articles[] = $discount;
}
}
}
if ($object instanceof Mage_Sales_Model_Order || $object instanceof Mage_Sales_Model_Order_Invoice || $object instanceof Mage_Sales_Model_Order_Creditmemo) {
$shippingObject = $object;
if ($object instanceof Mage_Sales_Model_Order_Creditmemo) {
$articles = $this->addAdjustments($object, $articles);
}
} else {
$shippingObject = $object->getShippingAddress();
}
if ($shippingObject->getShippingAmount() > 0) {
if ($object instanceof Mage_Sales_Model_Order_Invoice || $object instanceof Mage_Sales_Model_Order_Shipment || $object instanceof Mage_Sales_Model_Order_Creditmemo) {
$shippingDiscountAmount = $shippingObject->getDiscountAmount() - $articleDiscountAmount;
$shippingDescription = $object->getOrder()->getShippingDescription();
} else {
$shippingDiscountAmount = $shippingObject->getShippingDiscountAmount();
$shippingDescription = $shippingObject->getShippingDescription();
}
$article = array();
$article['articleNumber'] = 'SHIPPING';
$article['articleName'] = $shippingDescription;
$article['quantity'] = '1';
$article['unitPriceGross'] = $shippingObject->getShippingInclTax();
$article['tax'] = $shippingObject->getShippingTaxAmount();
$shippingTaxPercent = 0;
if ($shippingObject->getShippingInclTax() - $shippingObject->getShippingAmount() > 0) {
$shippingTaxPercent = ($shippingObject->getShippingInclTax() - $shippingObject->getShippingAmount()) * 100 / $shippingObject->getShippingAmount();
}
$article['taxPercent'] = $shippingTaxPercent;
$article['discountId'] = '';
if ($shippingDiscountAmount > 0) {
$discount = array();
$discount['articleNumber'] = 'SHIPPINGDISCOUNT';
$discount['articleName'] = 'Shipping - Discount';
$discount['quantity'] = 1;
$discount['unitPriceGross'] = -1 * $shippingObject->getShippingDiscountAmount();
$article['tax'] = $shippingObject->getShippingInclTax() - $shippingObject->getShippingAmount();
$discount['tax'] = -1 * ($article['tax'] - $shippingObject->getShippingTaxAmount());
$tax = 0;
if (Mage::getSingleton('tax/config')->shippingPriceIncludesTax($object->getStoreId())) {
$tax = $discount['tax'];
}
$discount['unitPrice'] = -1 * $shippingObject->getShippingDiscountAmount() - $tax;
//.........这里部分代码省略.........