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

Display shipping rates for all countries
 
PitchOu
Member
 
Total Posts:  39
Joined:  2008-02-04
Villeneuve d'Ascq, France
 

Hi guys,

I’d like to display the shipping costs for all countries on the cart page.

So I inserted this code in my template/checkout/cart/shipping.phtml file :

<?php foreach(Mage::getBlockSingleton('directory/data')->getCountryCollection()->getItems() as $country): ?>
  <?php $this
->getQuote()->getShippingAddress()
                                              ->
setCountryId($country->getId())
                                              ->
setCity('')
                                              ->
setPostcode('')
                                              ->
setRegionId('')
                                              ->
setRegion('')
                                              ->
setCollectShippingRates(true);?>
  <?php $this
->getQuote()->save();?>
  <?php 
foreach($this->getQuote()->getShippingAddress()->getShippingRatesCollection() as $rate):?>
     <?php 
echo $rate->getPrice().' '.$rate->getMethodDescription();?>
  <?php endforeach?>
<?php endforeach?>

Unfortunately all displayed prices are the prices from the rates of country selected in the combobox !

I spent 10 hours on this issue and I really can’t figure out why my code doesn’t work :-(((

Any idea ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
PitchOu
Member
 
Total Posts:  39
Joined:  2008-02-04
Villeneuve d'Ascq, France
 

No idea ?

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