Magento-如何获得商店国家/地区? [英] Magento - How to get the store country?

查看:65
本文介绍了Magento-如何获得商店国家/地区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取商店国家/地区,以在交易电子邮件中显示该国家/地区?

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

非常感谢.

推荐答案

要首先实现国家/地区对象,您必须获取当前商店的国家/地区代码

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
));

这篇关于Magento-如何获得商店国家/地区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆