我想检查 Magento 中的商店类型并运行查询,如果商店EN另有查询,我的代码如下,但它不起作用:
$name = $store->getName();
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
if($name=='EN')
{
$sql= "SELECT * FROM directory_country_region_EN WHERE name='$region' ";
}
else
{
$sql = "SELECT * FROM directory_country_region_SU WHERE name='$region' "; }
答案 0 :(得分:0)
试试这个:
$name = Mage::app()->getStore()->getCode();
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
if($name=='EN')
{
$sql= "SELECT * FROM directory_country_region_EN WHERE name='$region' ";
}
else
{
$sql = "SELECT * FROM directory_country_region_SU WHERE name='$region' "; }