Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Google Checkout - shipping/shipments, invoicing problems and workaround
 
ASchroder
Member
 
Avatar
Total Posts:  49
Joined:  2008-10-09
New Zealand
 

I have been trying to get Google checkout working for Magento for about a day now.

I have read this page:
http://www.magentocommerce.com/wiki/using_google_checkout_with_magento#shipping_settings

But it seems to not work at all like it claims it will.

When I ‘Ship’ an order in Magento after it was aded by Google Checkout, I see no messages in the logs, and no shipment is made in google checkout. I can’t find any function calls for addtrackingData() etc, that I think would be required to have Magento behave as advertised. I plan to manually ship in GC and Magento, until I can get the communication working.

Also when you tell GC not to charge immediately, then try to ‘Invoice’ from Magento, the invoice process causes Google Checkout to charge the card (great!), but it doesn’t include shipping in the charge it sends! I have just set GC to charge immediately for now.

Don’t get me wrong, I’m not complaining, it’s free after all. If someone can tell me where the relevant code is I can try to fix it up.

Also I was unable to get table rate shipping to work with Google Checkout. The merchant callbacks seemed to always prevent shipping to certain countres(despite them being in the tabe rate setup), or fail completely in some cases and just use the default.

I have fairly simple shipping requirements initially, I can add expedited and free later. For now I just need UK=5, EU countries=8 and Rest of world =19.

I have a work around for some situations for others facing this shipping rate calculation problem.

1) Set up table rates - do not include any ‘free shipping’ as it seems 0 priced shipping breaks table rates. One row for each country.
2) With table rates setup the ‘estimate shipping’ block on checkout page will work.
3) I have hacked the code that builds the GC request to behave as follows.

Split the name of the rate on a # symbol and use the second half as comma separated list of allowed countries.
For example:

NameStandard Shipping EU#AL,AT,BE,BA,HR,CY,CZ,DK,EE,FO,FI,FR,DE,GR,HU,IS,IE,IT,LV,LI,LT,LU,MK,NL,NO,PL,PT,RO,RU,SM,SK,SI,ES,SE,CH,TR,VA
Rate8
(the list of countries needs work, but you get the idea)

Code is around 305 of ./app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Checkout.php:

for ($xml=''$i=1$i<=3$i++) {
            $titleString 
Mage::getStoreConfig('google/checkout_shipping_flatrate/title_'.$i);
        
$tok strtok($titleString"#");
        
$title $tok;

        
$tok strtok("#");
        if(
$tok !== false{
                $countries 
explode(",",$tok);

        
}
            $price 
Mage::getStoreConfig('google/checkout_shipping_flatrate/price_'.$i);
            
$price number_format($price2'.','');
            
$price Mage::helper('tax')->getShippingPrice($pricefalsefalse);

            if (empty(
$title) || $price <= 0{
                
continue;
            
}

            $xml 
.= <<<EOT
<flat-rate-shipping name="{$title}">
<price currency="{
$this->getCurrency()}">{$price}</price>

EOT;

                if (!empty(
$countries)) {
                        $xml 
.= "<shipping-restrictions><allowed-areas>";
                        foreach (
$countries as $country{
                                 $xml 
.= <<<EOT
<postal-area><country-code>{$country}</country-code></postal-area>

EOT;
                        
}
                        $xml 
.= "</allowed-areas></shipping-restrictions>";
                
}

            $xml 
.= <<<EOT
                 </flat-rate-shipping>

EOT;
        
}

        $this
->_shippingCalculated true;
        return 
$xml;
    
}

This means people can only use a given flat rate from the specified countries - kind of simulates a simplified table rate. The callback just doesn’t seem reliable to me. This could be extended to also determine price from the table rate, and calculate it in Magento before handing to GC, so the callback is never used.

Cheers,
Ashley

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scott_TriState
Member
 
Total Posts:  35
Joined:  2008-06-06
 

Ashley,

Did you ever find out why your shipment was not registering with Google? We’re seeing the same thing and we’re not sure why. We don’t see anything shipping related in var/log/googleerror.log.

Let me know if you found anything. I would appreciate it.

Scott

 
Magento Community Magento Community
Magento Community
Magento Community
 
ASchroder
Member
 
Avatar
Total Posts:  49
Joined:  2008-10-09
New Zealand
 

Hi, Scott

I haven’t solved the problem yet, I’ve been busy on other things, but do plan on getting back to the GC integration. I noticed while working on some other code that there seems to be an observer that updates the shipment tracking number. It seemed to have a test that the shipping method was a google one. Maybe that test could be changed?

I’ll be sure to update this thread if I find a solution.

Cheers,
Ashley

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scott_TriState
Member
 
Total Posts:  35
Joined:  2008-06-06
 

Thanks Ashley. We are now actually updating the Google checkout API directly from our EDI processing files. I hate to do it outside Magento, but it will have to do for now. Let me know if you need any of the Google checkout API code.

Scott

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top