Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento - How to get the store country?

Tags:

magento

how to get the store country, to show it in the transsactional E-mails?

Thanks a lot.

like image 468
Ahmed Ala Dali Avatar asked Dec 10 '22 09:12

Ahmed Ala Dali


1 Answers

To achieve country object first you have to get country code for current store

$countryCode = Mage::getStoreConfig('general/country/default');

then get country Object

$country = Mage::getModel('directory/country')->loadByCode($countryCode);

When you have the object, there is no problem to assign it to variable in email template

$mailer = Mage::getModel('core/email_template_mailer');
$mailer->setTemplateParams(array(
    'country' => $country
));
like image 161
Sergey Avatar answered Jan 12 '23 01:01

Sergey