Making Dropship work with GoogleCheckout
Configuration:
In versions 1.4.1.0, 1.4.1.1 you will also face magento bug (fixed in 1.4.2).
- Go to Admin > System > Configuration > Google API > Shipping - Merchant Calculated
- Enable Merchant Calculated rates
- Add all Dropship Shipping Methods
- Edit app/code/core/Mage/Shipping/Model/Shipping.php
- Around line 175:
// ADD: $request->setAllItems($address->getAllItems()); // RIGHT BEFORE: return $this->collectRates($request);
- Around line 175:
- Edit app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php
- Around line 141:
// ADD: $limitCarrier = array_unique($limitCarrier); // RIGHT BEFORE: foreach($googleAddresses as $googleAddress) { - Around line 163:
// COMMENT OUT: #$address->setCollectShippingRates(true)->collectShippingRates();
- Around line 245:
// RIGHT AFTER: $result->SetShippingDetails($methodName, $rates[$methodName], "true"); $merchantCalculations->AddResult($result); } // ADD: else { $result->SetShippingDetails($methodName, 0, "false"); $merchantCalculations->AddResult($result); }
- Around line 141:
In versions 1.4.1.0, 1.4.1.1 you will also face magento bug (fixed in 1.4.2).
- Edit app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php
- Find method _importGoogleTotals (in 1.4.1.0 starts at line 417) and following code in it
... if (!empty($method)) { Mage::getSingleton('tax/config')->setShippingPriceIncludeTax(false); $rate = Mage::getModel('sales/quote_address_rate') ->setCode($method) ->setPrice($shipping['shipping-cost']['VALUE']); ... - Replace it with
if (!empty($method)) { Mage::getSingleton('tax/config')->setShippingPriceIncludeTax(false); list ($gcCT, $gcMT) = explode(' - ', $shipping['shipping-name']['VALUE'], 2); $rate = Mage::getModel('sales/quote_address_rate') ->setCode($method) ->setPrice($shipping['shipping-cost']['VALUE']) ->setCarrierTitle($gcCT) ->setMethodTitle($gcMT);
- Find method _importGoogleTotals (in 1.4.1.0 starts at line 417) and following code in it
- If you find errors like "Merchant Calculations: We were looking for data in your merchant-calculation-results, but were not able to find it: shipping-name" in your integration console mostly likely you added one method in magento admin "Configuration > Google API > Google Checkout Shipping - Merchant Calculated > Allowed Methods". To eliminate that errors:
- Find method _responseMerchantCalculationCallback (in 1.4.1.0 starts at line 114) and following code in it (at line 171)
... if ($gRequestMethods = $this->getData('root/calculate/shipping/method')) { $carriers = array(); $errors = array(); ... - Replace it with
$gRequestMethods = $this->getData('root/calculate/shipping/method'); if ($gRequestMethods) { // Make stable format of $gRequestMethods for convenient usage if (array_key_exists('VALUE', $gRequestMethods)) { $gRequestMethods = array($gRequestMethods); } $carriers = array(); $errors = array();
- Find method _responseMerchantCalculationCallback (in 1.4.1.0 starts at line 114) and following code in it (at line 171)
