當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Store::getStoresStructure方法代碼示例

本文整理匯總了PHP中Magento\Store\Model\System\Store::getStoresStructure方法的典型用法代碼示例。如果您正苦於以下問題:PHP Store::getStoresStructure方法的具體用法?PHP Store::getStoresStructure怎麽用?PHP Store::getStoresStructure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Store\Model\System\Store的用法示例。


在下文中一共展示了Store::getStoresStructure方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: prepareItem

 /**
  * Get data
  *
  * @param array $item
  * @return string
  */
 protected function prepareItem(array $item)
 {
     $content = '';
     $origStores = $item['store_id'];
     if (empty($origStores)) {
         return '';
     }
     if (!is_array($origStores)) {
         $origStores = [$origStores];
     }
     if (in_array(0, $origStores) && count($origStores) == 1) {
         return __('All Store Views');
     }
     $data = $this->systemStore->getStoresStructure(false, $origStores);
     foreach ($data as $website) {
         $content .= $website['label'] . "<br/>";
         foreach ($website['children'] as $group) {
             $content .= str_repeat('&nbsp;', 3) . $this->escaper->escapeHtml($group['label']) . "<br/>";
             foreach ($group['children'] as $store) {
                 $content .= str_repeat('&nbsp;', 6) . $this->escaper->escapeHtml($store['label']) . "<br/>";
             }
         }
     }
     return $content;
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:31,代碼來源:Store.php

示例2: testGetStoresStructure

 /**
  * @dataProvider getStoresStructureDataProvider
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function testGetStoresStructure($isAll, $storeId, $groupId, $websiteId, $storeName, $groupName, $websiteName, $storeIds, $groupIds, $websiteIds, $expectedResult)
 {
     $this->websiteMock->expects($this->any())->method('getId')->willReturn($websiteId);
     $this->websiteMock->expects($this->any())->method('getName')->willReturn($websiteName);
     $this->groupMock->expects($this->any())->method('getId')->willReturn($groupId);
     $this->groupMock->expects($this->any())->method('getName')->willReturn($groupName);
     $this->storeMock->expects($this->any())->method('getId')->willReturn($storeId);
     $this->storeMock->expects($this->any())->method('getName')->willReturn($storeName);
     $this->assertEquals($this->model->getStoresStructure($isAll, $storeIds, $groupIds, $websiteIds), $expectedResult);
 }
開發者ID:hientruong90,項目名稱:magento2_installer,代碼行數:14,代碼來源:StoreTest.php

示例3: renderVisibilityStructure

 /**
  * Rendering store visibility structure
  *
  * @param array $storeIds
  * @return string
  */
 protected function renderVisibilityStructure(array $storeIds)
 {
     $visibility = '';
     foreach ($this->store->getStoresStructure(false, $storeIds) as $website) {
         $visibility .= $website['label'] . '<br/>';
         foreach ($website['children'] as $group) {
             $visibility .= str_repeat('&nbsp;', 3) . $group['label'] . '<br/>';
             foreach ($group['children'] as $store) {
                 $visibility .= str_repeat('&nbsp;', 6) . $store['label'] . '<br/>';
             }
         }
     }
     return $visibility;
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:20,代碼來源:Visibility.php


注:本文中的Magento\Store\Model\System\Store::getStoresStructure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。