本文整理汇总了PHP中Mage_Sales_Model_Order_Creditmemo::getIncrementId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Creditmemo::getIncrementId方法的具体用法?PHP Mage_Sales_Model_Order_Creditmemo::getIncrementId怎么用?PHP Mage_Sales_Model_Order_Creditmemo::getIncrementId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Creditmemo
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Creditmemo::getIncrementId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: _getCreditmemoDocumentCode
/**
* Get document code for creditmemo
*
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
* @return string
*/
protected function _getCreditmemoDocumentCode($creditmemo)
{
return self::DOCUMENT_CODE_CREDITMEMO_PREFIX . $creditmemo->getIncrementId();
}
示例3: creditmemo
/**
* Save order in AvaTax system
*
* @see OnePica_AvaTax_Model_Observer_SalesOrderCreditmemoSaveAfter::execute()
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
* @param OnePica_AvaTax_Model_Records_Queue $queue
* @return OnePica_AvaTax_Model_Service_Result_Creditmemo
*/
public function creditmemo($creditmemo, $queue)
{
$this->_lines = array();
$order = $creditmemo->getOrder();
$storeId = $order->getStoreId();
$orderDate = $this->_convertGmtDate($order->getCreatedAt(), $storeId);
$statusDate = $this->_convertGmtDate($queue->getUpdatedAt(), $storeId);
$creditmemoDate = $this->_convertGmtDate($creditmemo->getCreatedAt(), $storeId);
$shippingAddress = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
$this->_request = new GetTaxRequest();
$this->_request->setDocCode($creditmemo->getIncrementId());
$this->_request->setDocType(DocumentType::$ReturnInvoice);
$this->_addGeneralInfo($order);
$this->_addShipping($creditmemo, true);
$items = $creditmemo->getAllItems();
$this->_initProductCollection($items);
$this->_initTaxClassCollection($creditmemo);
//Added code for calculating tax for giftwrap items
$this->_addGwOrderAmount($creditmemo, true);
$this->_addGwItemsAmount($creditmemo, true);
$this->_addGwPrintedCardAmount($creditmemo, true);
$this->_addAdjustments($creditmemo->getBaseAdjustmentPositive(), $creditmemo->getBaseAdjustmentNegative(), $order->getStoreId());
$this->_setOriginAddress($order->getStoreId());
$this->_setDestinationAddress($shippingAddress);
// Set the tax date for calculation.
$override = new TaxOverride();
$override->setTaxDate($orderDate);
$override->setTaxOverrideType(TaxOverrideType::$TaxDate);
$override->setReason('Credit memo - refund');
$this->_request->setTaxOverride($override);
$this->_request->setDocDate($creditmemoDate);
$this->_request->setPaymentDate($creditmemoDate);
$this->_request->setTaxDate($orderDate);
$this->_request->setStatusDate($statusDate);
$configAction = Mage::getStoreConfig('tax/avatax/action', $order->getStoreId());
$commitAction = OnePica_AvaTax_Model_Service_Abstract_Config::ACTION_CALC_SUBMIT_COMMIT;
$this->_request->setCommit($configAction == $commitAction ? true : false);
foreach ($items as $item) {
/** @var Mage_Sales_Model_Order_Creditmemo_Item $item */
$this->_newLine($item, true);
}
$this->_request->setLines($this->_lines);
//send to AvaTax
$result = $this->_send($order->getStoreId());
/** @var OnePica_AvaTax_Model_Service_Result_Creditmemo $creditmemoResult */
$creditmemoResult = Mage::getModel('avatax/service_result_creditmemo');
$resultHasError = $result->getResultCode() != SeverityLevel::$Success;
$creditmemoResult->setHasError($resultHasError);
//if successful
if (!$resultHasError) {
$totalTax = $result->getTotalTax();
$creditmemoResult->setTotalTax($totalTax);
$documentCode = $result->getDocCode();
$creditmemoResult->setDocumentCode($documentCode);
//if not successful
} else {
$messages = array();
foreach ($result->getMessages() as $message) {
$messages[] = $message->getSummary();
}
$creditmemoResult->setErrors($messages);
}
return $creditmemoResult;
}
示例4: getInvoiceAppendixRefund
/**
* Returns the refund appendix and substitutes the placeholders, as far as possible
*
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
* @return string
*/
public function getInvoiceAppendixRefund(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$order = $this->getOrder();
/** @var $customer Mage_Customer_Model_Customer */
$customer = $this->getFactory()->getModelCustomer();
$customer->load($order->getCustomerId());
/** @var $invoice Mage_Sales_Model_Order_Invoice */
$invoice = $creditmemo->getInvoice();
$substitutionArray = array('{{order_increment_id}}' => $order->getIncrementId(), '{{order_id}}' => $order->getId(), '{{creditmemo_increment_id}}' => $creditmemo->getIncrementId(), '{{invoice_increment_id}}' => $invoice->getIncrementId(), '{{invoice_id}}' => $invoice->getId(), '{{customer_increment_id}}' => $customer->getIncrementId(), '{{customer_id}}' => $order->getCustomerId());
$appendix = $this->getConfigParameterInvoice()->getInvoiceAppendixRefund();
$appendix = str_replace(array_keys($substitutionArray), array_values($substitutionArray), $appendix);
return $appendix;
}
示例5: storeCreditMemoCalculation
public static function storeCreditMemoCalculation(Mage_Sales_Model_Order_Creditmemo $creditMemo)
{
$params = array();
$params['calculation_id'] = $creditMemo->getDcOrderId();
$params['order_id'] = $creditMemo->getOrder()->getIncrementId();
$params['order_type'] = 'credit_note';
$params['credit_note_id'] = $creditMemo->getIncrementId();
$params['assign_addresses'] = 1;
$params['output_currency'] = $creditMemo->getOrderCurrencyCode();
$params['seller_first_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-first-name');
$params['seller_last_name'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-last-name');
$params['seller_country'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-country');
$params['seller_address_line_1'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-address-line');
$params['seller_city'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-city');
$params['seller_zip'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-postcode');
$params['seller_phone'] = Mage::getStoreConfig('dc_charge_extension/dccharge/seller-phone');
$shippingAddress = $creditMemo->getOrder()->getShippingAddress();
$billingAddress = $creditMemo->getOrder()->getBillingAddress();
$params['shipto_first_name'] = $shippingAddress->getFirstname();
$params['shipto_last_name'] = $shippingAddress->getLastname();
$params['shipto_address_line_1'] = $shippingAddress->getStreet(-1);
$params['shipto_city'] = $shippingAddress->getCity();
$params['shipto_zip'] = $shippingAddress->getPostcode();
$params['shipto_country'] = $shippingAddress->getCountryId();
$params['shipto_phone'] = $shippingAddress->getTelephone();
$params['soldto_first_name'] = $billingAddress->getFirstname();
$params['soldto_last_name'] = $billingAddress->getLastname();
$params['soldto_address_line_1'] = $billingAddress->getStreet(-1);
$params['soldto_city'] = $billingAddress->getCity();
$params['soldto_zip'] = $billingAddress->getPostcode();
$params['soldto_country'] = $billingAddress->getCountryId();
$params['soldto_phone'] = $billingAddress->getTelephone();
/* @var $helper Dutycalculator_Charge_Helper_Data */
$helper = Mage::helper('dccharge');
$rawXml = $helper->sendRequest('store_calculation', $params);
try {
if (stripos($rawXml, '<?xml') === false) {
throw new Exception($rawXml);
}
new SimpleXMLElement($rawXml);
return true;
} catch (Exception $ex) {
return false;
}
}
开发者ID:Fishead-Communications,项目名称:dutycalculator_charge_import_duty,代码行数:45,代码来源:Importdutytaxes.php
示例6: getCreditmemoDocCode
public function getCreditmemoDocCode(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$prefix = trim($this->getConfig('creditmemo_prefix', $creditmemo->getStore()), self::DOC_CODE_SEPARATOR);
$prefix = (empty($prefix) ? 'R' : $prefix) . self::DOC_CODE_SEPARATOR;
if ($creditmemo->getAvataxDocument()) {
return $creditmemo->getAvataxDocument();
} elseif ($creditmemo->getIncrementId()) {
return $prefix . $creditmemo->getIncrementId();
} else {
return null;
}
}
示例7: _filterCreditmemo
/**
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
*
* @return Bronto_Common_Model_Email_Template_Filter
*/
protected function _filterCreditmemo(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
if (!in_array('creditmemo', $this->_filteredObjects)) {
$index = 1;
foreach ($creditmemo->getAllItems() as $item) {
$_item = $item->getOrderItem();
if (!$_item->getParentItem()) {
$this->_filterOrderItem($_item, $index);
$index++;
}
}
$createdAt = $creditmemo->getCreatedAtStoreDate();
if (empty($createdAt)) {
// unset the blank string to force current timestamp
$createdAt = null;
}
// Add Related Content
$this->_items = $creditmemo->getAllItems();
$this->setField('creditmemoIncrementId', $creditmemo->getIncrementId());
$this->setField('creditmemoCreatedAt', Mage::helper('core')->formatDate($createdAt, 'long', true));
// TODO: needed?
$this->setField('creditmemoItems', $this->_filterCreditmemoItems($creditmemo));
$this->_filteredObjects[] = 'creditmemo';
}
return $this;
}
示例8: creditmemo
/**
* Save order in AvaTax system
*
* @see OnePica_AvaTax_Model_Observer::salesOrderPlaceAfter()
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
* @param OnePica_AvaTax_Model_Records_Queue $queue
* @return mixed
* @throws OnePica_AvaTax_Exception
* @throws OnePica_AvaTax_Model_Avatax_Exception_Commitfailure
* @throws OnePica_AvaTax_Model_Avatax_Exception_Unbalanced
*/
public function creditmemo($creditmemo, $queue)
{
$order = $creditmemo->getOrder();
$storeId = $order->getStoreId();
$orderDate = $this->_convertGmtDate($order->getCreatedAt(), $storeId);
$statusDate = $this->_convertGmtDate($queue->getUpdatedAt(), $storeId);
$creditmemoDate = $this->_convertGmtDate($creditmemo->getCreatedAt(), $storeId);
$shippingAddress = $order->getShippingAddress() ? $order->getShippingAddress() : $order->getBillingAddress();
if (!$shippingAddress) {
throw new OnePica_AvaTax_Exception($this->__('There is no address attached to this order'));
}
$this->_request = new GetTaxRequest();
$this->_request->setDocCode($creditmemo->getIncrementId());
$this->_request->setDocType(DocumentType::$ReturnInvoice);
$this->_addGeneralInfo($order);
$this->_addShipping($creditmemo, true);
$items = $creditmemo->getAllItems();
$this->_initProductCollection($items);
$this->_initTaxClassCollection($creditmemo);
//Added code for calculating tax for giftwrap items
$this->_addGwOrderAmount($creditmemo, true);
$this->_addGwItemsAmount($creditmemo, true);
$this->_addGwPrintedCardAmount($creditmemo, true);
$this->_addAdjustments($creditmemo->getAdjustmentPositive(), $creditmemo->getAdjustmentNegative(), $order->getStoreId());
$this->_setOriginAddress($order->getStoreId());
$this->_setDestinationAddress($shippingAddress);
// Set the tax date for calculation.
$override = new TaxOverride();
$override->setTaxDate($orderDate);
$override->setTaxOverrideType(TaxOverrideType::$TaxDate);
$override->setReason('Credit memo - refund');
$this->_request->setTaxOverride($override);
$this->_request->setDocDate($creditmemoDate);
$this->_request->setPaymentDate($creditmemoDate);
$this->_request->setTaxDate($orderDate);
$this->_request->setStatusDate($statusDate);
$configAction = Mage::getStoreConfig('tax/avatax/action', $order->getStoreId());
$commitAction = OnePica_AvaTax_Model_Config::ACTION_CALC_SUBMIT_COMMIT;
$this->_request->setCommit($configAction == $commitAction ? true : false);
foreach ($items as $item) {
/** @var Mage_Sales_Model_Order_Creditmemo_Item $item */
$this->_newLine($item, true);
}
$this->_request->setLines($this->_lines);
//send to AvaTax
$result = $this->_send($order->getStoreId());
//if successful
if ($result->getResultCode() == SeverityLevel::$Success) {
$message = Mage::helper('avatax')->__('Credit memo #%s was saved to AvaTax', $result->getDocCode());
$this->_addStatusHistoryComment($order, $message);
if ($result->getTotalTax() != $creditmemo->getBaseTaxAmount() * -1) {
throw new OnePica_AvaTax_Model_Avatax_Exception_Unbalanced('Collected: ' . $creditmemo->getTaxAmount() . ', Actual: ' . $result->getTotalTax());
}
//if not successful
} else {
$messages = array();
foreach ($result->getMessages() as $message) {
$messages[] = $message->getSummary();
}
throw new OnePica_AvaTax_Model_Avatax_Exception_Commitfailure(implode(' // ', $messages));
}
return $result;
}