Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 获取具有相同区域设置的所有magento存储的列表_Php_Magento - Fatal编程技术网

Php 获取具有相同区域设置的所有magento存储的列表

Php 获取具有相同区域设置的所有magento存储的列表,php,magento,Php,Magento,如何获取phtml文件上所有Magento存储的列表,这些存储具有相同的区域设置对于获取此类需求,没有直接查询。但是,我找到了另一种解决方案。如下所示 $Stores=array(); $storeCollection=Mage::getModel('core/store')->getCollection(); foreach($storeCollection as $store) { $storelang= Mage::getStoreConfig('general/lo

如何获取phtml文件上所有Magento存储的列表,这些存储具有相同的区域设置对于获取此类需求,没有直接查询。但是,我找到了另一种解决方案。如下所示

$Stores=array();
 $storeCollection=Mage::getModel('core/store')->getCollection();
 foreach($storeCollection as $store)
 {

    $storelang= Mage::getStoreConfig('general/locale/code', $store->getId());
     if(!isset($Stores[$storelang])){
            $Stores[$storelang]=array();
            $Stores[$storelang]['store']=array();


         }
         $Stores[$storelang]['lang']=$storelang;
         $Stores[$storelang]['store'][]=$store->getData();
     }
     foreach($Stores as $eachstore)
     {
      echo '<pre>';
     print_r($eachstore);
     echo '<pre>';
     }
$Stores=array();
$storeCollection=Mage::getModel('core/store')->getCollection();
foreach($storeCollection作为$store)
{
$storelang=Mage::getStoreConfig('general/locale/code',$store->getId());
如果(!isset($Stores[$storelang])){
$Stores[$storelang]=array();
$Stores[$storelang]['store']=array();
}
$Stores[$storelang]['lang']=$storelang;
$Stores[$storelang]['store'][=$store->getData();
}
foreach($eachstore存储为$eachstore)
{
回声';
打印(每家店);
回声';
}

如果您有任何问题,请告诉我。

对于获取此类需求,没有直接的查询。但是,我找到了另一种解决方案。下面是

$Stores=array();
 $storeCollection=Mage::getModel('core/store')->getCollection();
 foreach($storeCollection as $store)
 {

    $storelang= Mage::getStoreConfig('general/locale/code', $store->getId());
     if(!isset($Stores[$storelang])){
            $Stores[$storelang]=array();
            $Stores[$storelang]['store']=array();


         }
         $Stores[$storelang]['lang']=$storelang;
         $Stores[$storelang]['store'][]=$store->getData();
     }
     foreach($Stores as $eachstore)
     {
      echo '<pre>';
     print_r($eachstore);
     echo '<pre>';
     }
$Stores=array();
$storeCollection=Mage::getModel('core/store')->getCollection();
foreach($storeCollection作为$store)
{
$storelang=Mage::getStoreConfig('general/locale/code',$store->getId());
如果(!isset($Stores[$storelang])){
$Stores[$storelang]=array();
$Stores[$storelang]['store']=array();
}
$Stores[$storelang]['lang']=$storelang;
$Stores[$storelang]['store'][=$store->getData();
}
foreach($eachstore存储为$eachstore)
{
回声';
打印(每家店);
回声';
}

如果您有任何问题,请告诉我

@MahmoodRehman,如果网站上有5家店铺,2家店铺使用英语,其他店铺使用法语。那么我如何才能获得选择了en_US语言的店铺id。我认为你可以在网站上获得店铺,而不是基于语言。每个店铺都有单独的视图,这取决于语言/视图。你应该获取网站上的所有店铺,然后过滤你想要的内容。@MahmoodRehman,如果网站上有5家店铺,2家店铺使用英语,另一家店铺使用法语。那么我如何才能获得选择了en_US语言的店铺id。我认为你可以在网站上获得店铺,而不是在语言的基础上。每个店铺都有单独的视图,这取决于语言/视图。你应该获取网站上的所有店铺,然后过滤你想要的。谢谢!(但缩进不太漂亮..对不起)谢谢!(但缩进不太漂亮..对不起)