本文整理汇总了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(' ', 3) . $this->escaper->escapeHtml($group['label']) . "<br/>";
foreach ($group['children'] as $store) {
$content .= str_repeat(' ', 6) . $this->escaper->escapeHtml($store['label']) . "<br/>";
}
}
}
return $content;
}
示例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);
}
示例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(' ', 3) . $group['label'] . '<br/>';
foreach ($group['children'] as $store) {
$visibility .= str_repeat(' ', 6) . $store['label'] . '<br/>';
}
}
}
return $visibility;
}