【问题标题】:How to get magento store?如何获得magento商店?
【发布时间】:2017-03-23 15:42:02
【问题描述】:

我想检查 Magento 中的商店类型并运行查询,如果商店 EN else 另一个查询,我的代码如下,但它不起作用:

$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' "; }

【问题讨论】:

    标签: php magento


    【解决方案1】:

    试试这个:

    $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' "; }
    

    【讨论】:

      猜你喜欢
      • 2012-07-17
      • 1970-01-01
      • 1970-01-01
      • 2011-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-29
      • 1970-01-01
      相关资源
      最近更新 更多