Making Dropship work with GoogleCheckout

Properties ID: 000003
Filed under:
Configuration:
  1. Go to Admin > System > Configuration > Google API > Shipping - Merchant Calculated
  2. Enable Merchant Calculated rates
  3. Add all Dropship Shipping Methods
There are few bugs in Magento 1.3.2.3 that prevent Dropship from working with GoogleCheckout. Here are the changes that need to be done to make it work correctly:
  1. Edit app/code/core/Mage/Shipping/Model/Shipping.php
    1. Around line 175:
      // ADD:
      $request->setAllItems($address->getAllItems());
      // RIGHT BEFORE:
      return $this->collectRates($request);
      
  2. Edit app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php
    1. Around line 141:
      // ADD:
      $limitCarrier = array_unique($limitCarrier);
      // RIGHT BEFORE:
      foreach($googleAddresses as $googleAddress) {
      
    2. Around line 163:
      // COMMENT OUT:
      #$address->setCollectShippingRates(true)->collectShippingRates();
      
    3. Around line 245:
      // RIGHT AFTER:
          $result->SetShippingDetails($methodName, $rates[$methodName], "true");
          $merchantCalculations->AddResult($result);
      }
      // ADD: 
      else {
          $result->SetShippingDetails($methodName, 0, "false");
          $merchantCalculations->AddResult($result);
      }
      
Even if all is configured and coded correctly, you still might experience issues with GoogleCheckout, because of hardcoded 3 second timeout for merchant calculation API callback, if your vendors are using external API to calculate rates, such as UPS, USPS, FedEx.


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
    1. 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']);
      ...
      
    2. 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);
      
  • 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:
    1. 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();
      ...
      
    2. 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();