I have a bit of code that sits in a folder next to Magento. I’m pulling in Mage.php to do some stuff. I want to be able to grab some kind of shipping quote into my code. I have been looking around the web and I’m struggling to get anywhere sensible with it.
Please can someone show me the most efficient way to achieve this?
I only have this info available to pass in to get the rates:
Product ID eg, 123
Quantity eg, 1020
Country Code eg, GB
Zip code if needed eg, SY12 6AX
And I want to get out the following info:
Rate eg, £2.50
Title eg, Royal Mail Special Delivery
ID eg, 6
I want then to populate a radio list with the options on my code so that they can be selected.
Many thanks
OK, I got it working. This is the final code to programmatically get a shipping quote from magento.
The function will return all available shipping rates for a particular product, quantity, country, postcode. The code excludes free shipping, this can be undone by removing
if($_rate->getPrice() > 0) { ...This could be put into a dropdown list like this: