我們從Magento導入訂單和付款數據到Quickbooks桌面版。以下是兩個查詢 - 這些查詢成功,但沒有數據導入。對我們有什麼想法?導入訂單,付款從Magento到Quickbooks桌面
首先,我們創建一個查詢,形成訂單堆
$qb_order = new QuickBooks_IPP_Object_Invoice();
$qb_meta = new QuickBooks_IPP_Object_MetaData();
$qb_meta->setCreateTime($order->getCreatedAt());
$qb_meta->setLastUpdatedTime($order->getUpdatedAt());
$qb_order->setMetaData($qb_meta);
$qb_header = new QuickBooks_IPP_Object_Header();
$qb_header->setDocNumber($order->getIncrementId());
if (!$qb_customer_id = $this->_getQbCustomerId($order->getCustomerId())) return false;
$qb_header->setCustomerId($qb_customer_id);
$qb_header->setShipDate($order->getDeliveryDate());
$qb_header->setSubTotalAmt($order->getBaseSubtotal());
$qb_header->setTaxAmt($order->getBaseTaxAmount());
$qb_header->setTotalAmt($order->getBaseGrandTotal());
$qb_header->setARAccountId("Accounts Receivable");
if ($address = $order->getBillingAddress()) {
$qb_header->setBillAddr($this->_convertAddress($address, "Billing"));
}
if ($address = $order->getShippingAddress()) {
$qb_header->setShipAddr($this->_convertAddress($address, "Shipping"));
}
$qb_header->setDiscountAmt($order->getBaseDiscountAmount());
$qb_order->setHeader($qb_header);
foreach($order->getItemsCollection() as $item) {
$qb_order->addLine($this->_convertOrderItem($item));
}
這裏是XML,這是查詢之後形成:
<?xml version="1.0" encoding="UTF-8"?>
<Add xmlns="http://www.intuit.com/sb/cdm/v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
RequestId="4562cdf8407178e362082c0441dffa74"
xsi:schemaLocation="http://www.intuit.com/sb/cdm/v2 ./RestDataFilter.xsd ">
<OfferingId>ipp</OfferingId>
<ExternalRealmId>631645715</ExternalRealmId>
<Object xsi:type="Invoice">
<Header>
<DocNumber>100001570</DocNumber>
<CustomerId>103699</CustomerId>
<ShipDate>2013-02-21</ShipDate>
<SubTotalAmt>33.0000</SubTotalAmt>
<TaxAmt>2.6400</TaxAmt>
<TotalAmt>35.64</TotalAmt>
<ARAccountId>Accounts Receivable</ARAccountId>
<BillAddr>
<Line1></Line1>
<Line2></Line2>
<Line3></Line3>
<Line4></Line4>
<City></City>
<Country></Country>
<CountrySubDivisionCode></CountrySubDivisionCode>
<PostalCode></PostalCode>
<Tag>Billing</Tag>
</BillAddr>
<ShipAddr>
<Line1></Line1>
<Line2></Line2>
<Line3></Line3>
<Line4></Line4>
<City></City>
<Country></Country>
<CountrySubDivisionCode></CountrySubDivisionCode>
<PostalCode></PostalCode>
<Tag>Shipping</Tag>
</ShipAddr>
<DiscountAmt>0.0000</DiscountAmt>
</Header>
<Line>
<Desc>Special Product For POS
sdf</Desc>
<Amount>33.0000</Amount>
<ItemType>Product</ItemType>
<UnitPrice>33.0000</UnitPrice>
<Qty>1</Qty>
</Line>
</Object>
</Add>
這裏是服務器響應:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
<Success RequestId="4562cdf8407178e362082c0441dffa74">
<ObjectRef>
<Id idDomain="NG">494527</Id>
<SyncToken>1</SyncToken>
<LastUpdatedTime>2013-02-21T05:44:12Z</LastUpdatedTime>
</ObjectRef>
<RequestName>InvoiceAdd</RequestName>
<ProcessedTime>2013-02-21T05:44:12Z</ProcessedTime>
</Success>
</RestResponse>
=============================================== ==================
這是用於根據訂單創建付款的第二組代碼。同樣同樣的問題,成功的XML但沒有數據的輸入:
$order = Mage::getModel("sales/order")->load($invoice->getOrderId());
if (!$qb_order_id = $this->getHelper()->getObjectQbId($order)) return false;
$qb_payment = new QuickBooks_IPP_Object_Payment();
$qb_meta = new QuickBooks_IPP_Object_MetaData();
$qb_meta->setCreateTime($invoice->getCreatedAt());
$qb_meta->setLastUpdatedTime($invoice->getUpdatedAt());
$qb_payment->setMetaData($qb_meta);
$qb_header = new QuickBooks_IPP_Object_Header();
$qb_header->setDocNumber($invoice->getIncrementId());
$qb_header->setTxnDate($invoice->getCreatedAt());
if (!$qb_customer_id = $this->_getQbCustomerId($order->getCustomerId())) return false;
$qb_header->setCustomerId($qb_customer_id);
$qb_header->setTotalAmt($invoice->getBaseGrandTotal());
$qb_header->setProcessPayment('false');
$qb_payment->setHeader($qb_header);
$qb_line = new QuickBooks_IPP_Object_Line();
$qb_line->setAmount($invoice->getBaseGrandTotal());
$qb_line->setTxnId($qb_order_id);
$qb_payment->addLine($qb_line);
這裏是XML,它的代碼後形成:
<?xml version="1.0" encoding="UTF-8"?>
<Add xmlns="http://www.intuit.com/sb/cdm/v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
RequestId="dc07317b838eb3d0c89e310b4984468a"
xsi:schemaLocation="http://www.intuit.com/sb/cdm/v2 ./RestDataFilter.xsd ">
<OfferingId>ipp</OfferingId>
<ExternalRealmId>631645715</ExternalRealmId>
<Object xsi:type="Payment">
<Header>
<DocNumber>100000265</DocNumber>
<TxnDate>2013-02-21</TxnDate>
<CustomerId>103699</CustomerId>
<TotalAmt>35.64</TotalAmt>
<ProcessPayment>false</ProcessPayment>
</Header>
<Line>
<Amount>35.6400</Amount>
<TxnId>494527</TxnId>
</Line>
</Object>
</Add>
下面是來自服務器的應答:
<?xml version="1.0" ?>
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
<Success RequestId="dc07317b838eb3d0c89e310b4984468a">
<ObjectRef>
<Id idDomain="NG">494529</Id>
<SyncToken>1</SyncToken>
<LastUpdatedTime>2013-02-21T05:48:07Z</LastUpdatedTime>
</ObjectRef>
<RequestName>PaymentAdd</RequestName>
<ProcessedTime>2013-02-21T05:48:07Z</ProcessedTime>
</Success>
</RestResponse>
便箋和無恥自我插件 - 有商業Magento + QuickBooks集成已經在那裏,你可能也想看看:http://consolibyte.com/quickbooks-integration/magento-quickbooks/ – 2013-02-21 12:32:23