Google checkout merchant shipping calculation doesn't make sense - google-checkout

Google checkout is having an issue with dynamic merchant shipping callback calculation.
When customer click on the checkout with google button, I pass in the shipping method called "default shipping" and shipping cost is $100.
This default value will only show to customer when he selected shipping address and google callback to merchant site to fetch shipping method fail.
When customer login to google account and entered the shipping address (country/city/state/postcode...) , google will do an instant callback to merchant script to fetch the latest shipping method available.
I able to have google callback to me successfully, but my shipping method to google is not accepted.
Example,
When customer selected to ship to US NC, then:
I will return FedEx Economy as shipping method (my system will retrive available shipping method based on address given)
I don't need to show default shipping at all
but google say error below:
Merchant Calculations: We were looking for data in your merchant-calculation-results, but were not able to find it: result: address-id:209802946439880shipping-name: default shipping when fail
XML received from google instant callback:
<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-callback xmlns="http://checkout.google.com/schema/2" serial-number="abd99db3-d3e3-485b-ba9c-75863d02ed65">
<shopping-cart>
<merchant-private-data>
<session-id>f199c97f7fa9b19ade6fa57a17ce79d61508aef4</session-id>
</merchant-private-data>
<items>
<item>
<item-weight value="0.0" unit="LB" />
<tax-table-selector>food</tax-table-selector>
<item-name>Test prod 3</item-name>
<item-description></item-description>
<unit-price currency="USD">1.0</unit-price>
<quantity>1</quantity>
<merchant-item-id>test11</merchant-item-id>
</item>
</items>
<cart-expiration>
<good-until-date>2011-05-20T23:59:59.000Z</good-until-date>
</cart-expiration>
</shopping-cart>
<buyer-id>119687448728341</buyer-id>
<calculate>
<addresses>
<anonymous-address id="209802946439880">
<country-code>US</country-code>
<city>Charlotte</city>
<region>NC</region>
<postal-code>28227</postal-code>
</anonymous-address>
</addresses>
<shipping>
<method name="default shipping" />
</shipping>
<tax>false</tax>
<merchant-code-strings />
</calculate>
<buyer-language>English</buyer-language>
</merchant-calculation-callback>
XML to post to google after merchant script custom shipping calculation done:
<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-results xmlns="http://checkout.google.com/schema/2">
<results>
<result shipping-name="Fedex Economy" address-id="209802946439880">
<shipping-rate currency="USD">15.20</shipping-rate>
<shippable>true</shippable>
</result>
</results>
</merchant-calculation-results>
So I suspect google must require me to return back the same default shipping name when I post back to google.
I tried it, if return the same default shipping name by modify the shipping amount, it works!
But when I return same default shipping name, at the same time an additional shipping method as FedEx Economy to google, google will reply error saying invalid extra data:
Merchant Calculations: You sent us invalid extra data in your merchant-calculation-results: [address-id: 209802946439880/shipping-name: Fedex Economy ]
<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-results xmlns="http://checkout.google.com/schema/2">
<results>
<result shipping-name="default shipping" address-id="209802946439880">
<shipping-rate currency="USD">8</shipping-rate>
<shippable>true</shippable>
</result>
<result shipping-name="Fedex Economy" address-id="209802946439880">
<shipping-rate currency="USD">15.20</shipping-rate>
<shippable>true</shippable>
</result>
</results>
</merchant-calculation-results>
How come! Isn't it not practical to have this kind of rules...
When google pass back shipping city/state/postcode/country to me, my system will calculate and return available shipping method(s) only
It means before google let me know the address, I don't even know there is how many shipping method available for the particular customer.

That is how merchant calculated shipping works:
REF: Merchant Calculations API -> Shipping
You must specify a unique name and a
default shipping cost for each
shipping option.
An alternative is for you to collect the zip code prior to sending your customer to Google Checkout. Your system can then pre-determine shipping availability and costs prior to redirecting your customer to Google and pass the shipping options/costs as "flat rate shipping" - this is just a Google Checkout specific term that means "here are the shipping costs for this order" (that you have already pre-calculated some way).
More reference:
Ok to ask for zip code
More forum discussions
Hope this helps...

Related

Orders with paypal not listing on user dashboard

I have a magento website and I have a problem.
In the user dashboard the orders via Paypal are not listing, it just show a message:"you don't have any order yet", but the orders via cc or other one works perfectly.
I've been exploring sales.xml but I haven't been able to find what can be the cause or how to fix it.
Thank you for your kind help.
It took me a while to figure that out. The problem is not with Paypal but with the order status "Pending Payment".
In the file ../Mage/Sales/etc/config.xml find the block that describes the Pending Payment order status and add this line:
<visible_on_front>1</visible_on_front>
If you are not sure where to put it just look the rest of the order statuses and see that all of them have the visible_on_front attribute set to 1.
Your code block should look like this:
<pending_payment translate="label">
<label>Pending Payment</label>
<statuses>
<pending_payment default="1"/>
</statuses>
<visible_on_front>1</visible_on_front>
</pending_payment>

magento ups shipping api

I want to calculate shipping rate using UPS api in magento.
I will pass lenght, width, height and zipcode the UPS api will return shipping rate for that product.
I got the UPS rating API that will calculate the shipping rate from the below url after you login.
https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US
The development guide shows we can implement this using xml or SOAP call.
Can anyone tell me how exactly can I implement this in magento if
possible explain it at coding level.
You dont need to code your own api access. Just use the ootb UPS core extension.
Goto class Mage_Usa_Model_Shipping_Carrier_Ups
Goto line 907 (something like that) and change the part from
<Package>
<PackagingType><Code>{$params['48_container']}</Code></PackagingType>
<PackageWeight>
<UnitOfMeasurement><Code>{$r->getUnitMeasure()}</Code></UnitOfMeasurement>
<Weight>{$params['23_weight']}</Weight>
</PackageWeight>
</Package>
to
<Package>
<PackagingType><Code>{$params['48_container']}</Code></PackagingType>
<Dimensions>
<UnitOfMeasurement>
<Code>CM</Code>
</UnitOfMeasurement>
<Length>30</Length>
<Width>30</Width>
<Height>30</Height>
</Dimensions>
<PackageWeight>
<UnitOfMeasurement><Code>{$r->getUnitMeasure()}</Code></UnitOfMeasurement>
<Weight>{$params['23_weight']}</Weight>
</PackageWeight>
</Package>
Just use some variables to change 30 to whatever you want. It works, i tried it!
Good luck!

Get "Use Billing Address" from shipping address section of Onepage checkout

I'm trying to get the gift option message to only show up when a customer is shipping to an address that's different from the billing address in the Onepage checkout flow. I can get the "Ship to same/different address" from the billing section with
$this->getQuote()->getShippingAddress()->getData('same_as_billing')
and it works great. However, if a customer makes it the shipping methods, and hits back to change the shipping address, that field doesn't seem to get updated. I tried checking
$this->getQuote()->getShippingAddress()->getData('use_billing_address')
But that data doesn't exist. In fact, when I have these two lines in additional.phtml:
Mage::log("Same as billing: ".$this->getQuote()->getShippingAddress()->getData('same_as_billing'));
Mage::log("Use billing: ".$this->getQuote()->getShippingAddress()->getData('use_billing_address'));
It doesn't trigger when I go from Shipping Address to Shipping methods. Can anyone give me some direction here?
I ended up using a javascript function instead of PHP, since it doesn't reload the page to get to each section.
In template/giftmessage/inline.phtml, I added the following:
function _showHideGift() {
var flag=document.getElementById('shipping:same_as_billing').checked;
if(!flag){
document.getElementById('gift-messages').style.display="block";
}else{
document.getElementById('gift-messages').style.display="none";
}}
And then called the function below the block inside of the CDATA, with the toogleVisilibityOnObjects calls.

Magento remove promotional code in customer transactional emails

My client does not want his customers to have a copy of the promotional code they used to minimize the chance they would create a new account and use it again. I am viewing the invoice and order receipt transactional emails, and there is only reference to order.getIsNotVirtual() which I assume inserts details about the order. How would I go about locating reference to the promotional code itself?
You have to edit the layout of email like this :
<sales_email_order_items>
<reference name="order_totals"><action method="setTemplate"><template>sales/mytotals.phtml</template></action></reference>
</sales_email_order_items>
Then duplicate sales/totals.phtml to mytotals.phtml and remove the discount code with something like :
if ($_code!='discount')
This is for the order template, look at the sales.xml layout to find information about other emails

Magento: set up FedEx shipping, but it's still now available for users

Have set up the FedEx account in Magento, but when trying to checkout I'm getting:
This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.
Found this: http://www.magentocommerce.com/boards/viewthread/6996/P0/
Currency is USD, ZIP is 10033 (looks fine)
They advice:
// find:
$responseBody = curl_exec($ch);
// add:
Mage::log($responseBody);
Tried that, but got no error! Here's the answer:
<?xml version="1.0" encoding="UTF-8"?>
<FDXRateAvailableServicesReply xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ReplyHeader></ReplyHeader>
<Entry>
<Service>GROUNDHOMEDELIVERY</Service>
<Packaging>YOURPACKAGING</Packaging>
<TimeInTransit>1</TimeInTransit>
<EstimatedCharges>
<DimWeightUsed>false</DimWeightUsed>
<BilledWeight>10.0</BilledWeight>
<DiscountedCharges>
<BaseCharge>6.86</BaseCharge>
<TotalDiscount>0.00</TotalDiscount>
<TotalSurcharge>3.24</TotalSurcharge>
<NetCharge>10.10</NetCharge>
<EarnedDiscount>0.00</EarnedDiscount>
</DiscountedCharges>
</EstimatedCharges>
<SignatureOption>NONE</SignatureOption>
</Entry>
<Entry>
<Service>FEDEXGROUND</Service>
<Packaging>YOURPACKAGING</Packaging>
<TimeInTransit>1</TimeInTransit>
<EstimatedCharges>
<DimWeightUsed>false</DimWeightUsed>
<BilledWeight>10.0</BilledWeight>
<DiscountedCharges>
<BaseCharge>6.86</BaseCharge>
<TotalDiscount>0.00</TotalDiscount>
<TotalSurcharge>3.56</TotalSurcharge>
<NetCharge>10.42</NetCharge>
<EarnedDiscount>0.00</EarnedDiscount>
</DiscountedCharges>
</EstimatedCharges>
<SignatureOption>NONE</SignatureOption>
</Entry>
</FDXRateAvailableServicesReply>
So, it gets the quotes, but still says "This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us." at frontend.
Where to look next?
Okay, was messing with this for hours, but answered my own question right after I posted it here.
That's what it was all about: FedEx gives me two entries (see XML in O-post).
Here are GROUNDHOMEDELIVERY and FEDEXGROUND.
There's a bunch of options at the backend:
Priority Overnight
Standard Overnight
First Overnight
2Day
Express Saver
International Priority
International Economy
International First
1 Day Freight
2 Day Freight
3 Day Freight
Ground
Home Delivery
Intl Priority Freight
Intl Economy Freight
Europe First Priority
Selected ones were only Priority Overnight and First Overnight. Thy're not listed in answer (remember, only GROUNDHOMEDELIVERY and FEDEXGROUND). I've chosen 'Home Delivery' and it showed the quotes at the frontend!
Why doesn't FedEx doesn't give all the specter (maybe it depends on zip code or something should be done at the FedEx account) - that's another question. This one is solved.
Magento log and report directory. Might be FedEx data format changed or magento sends wrong data.

Resources