Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
switcher.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
9 ?>
10 <p class="switcher"><label for="store_switcher"><?= /* @escapeNotVerified */ __('View Statistics For:') ?></label>
11 <?= $block->getHintHtml() ?>
12 <select name="store_switcher" id="store_switcher" class="left-col-block" onchange="return switchStore(this);">
13  <option value=""><?= /* @escapeNotVerified */ __('All Websites') ?></option>
14  <?php foreach ($block->getWebsiteCollection() as $_website): ?>
15  <?php $showWebsite = false; ?>
16  <?php foreach ($block->getGroupCollection($_website) as $_group): ?>
17  <?php $showGroup = false; ?>
18  <?php foreach ($block->getStoreCollection($_group) as $_store): ?>
19  <?php if ($showWebsite == false): ?>
20  <?php $showWebsite = true; ?>
21  <option website="true" value="<?= /* @escapeNotVerified */ $_website->getId() ?>"<?php if ($block->getRequest()->getParam('website') == $_website->getId()): ?> selected="selected"<?php endif; ?>><?= /* @escapeNotVerified */ $_website->getName() ?></option>
22  <?php endif; ?>
23  <?php if ($showGroup == false): ?>
24  <?php $showGroup = true; ?>
25  <!--optgroup label="&nbsp;&nbsp;&nbsp;<?= /* @escapeNotVerified */ $_group->getName() ?>"-->
26  <option group="true" value="<?= /* @escapeNotVerified */ $_group->getId() ?>"<?php if ($block->getRequest()->getParam('group') == $_group->getId()): ?> selected="selected"<?php endif; ?>>&nbsp;&nbsp;&nbsp;<?= /* @escapeNotVerified */ $_group->getName() ?></option>
27  <?php endif; ?>
28  <option value="<?= /* @escapeNotVerified */ $_store->getId() ?>"<?php if ($block->getStoreId() == $_store->getId()): ?> selected="selected"<?php endif; ?>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?= /* @escapeNotVerified */ $_store->getName() ?></option>
29  <?php endforeach; ?>
30  <?php if ($showGroup): ?>
31  <!--</optgroup>-->
32  <?php endif; ?>
33  <?php endforeach; ?>
34  <?php endforeach; ?>
35 </select>
36 </p>
37 <script>
38  require([
39  'prototype'
40  ], function () {
41 
42  window.switchStore = function (obj) {
43  if (obj.options[obj.selectedIndex].getAttribute('website') == 'true') {
44  var selectionType = 'website';
45  } else if (obj.options[obj.selectedIndex].getAttribute('group') == 'true') {
46  var selectionType = 'group';
47  } else {
48  var selectionType = 'store';
49  }
50  var storeParam = obj.value ? selectionType + '/' + obj.value + '/' : '';
51  if (obj.switchParams) {
52  storeParam += obj.switchParams;
53  }
54  if ($('diagram_tab_orders_content').style.display != 'none') {
55  var select = $('order_orders_period');
56  } else if ($('diagram_tab_amounts_content').style.display != 'none') {
57  var select = $('order_amounts_period');
58  }
59  var periodParam = select.value ? 'period/' + select.value + '/' : '';
60  setLocation('<?= /* @escapeNotVerified */ $block->getSwitchUrl() ?>' + storeParam + periodParam);
61  }
62  });
63 </script>
if( $websites=$block->getWebsites())(__( 'Choose Store View:')) ?></label >< div class $showWebsite
Definition: store.phtml:20
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
__()
Definition: __.php:13
$block
Definition: block.php:8
$_count $_index $_prevOptionId if($block->getOrderOptions()|| $_item->getDescription()) foreach( $items as $_item)( $_item) ?><?php $attributes if( $_item->getOrderItem() ->getParentItem())($_prevOptionId !=$attributes['option_id'])</td >< td > & nbsp
Definition: renderer.phtml:33
foreach($block->getWebsiteCollection() as $_website) foreach($block->getGroupCollection($_website) as $_group) foreach( $block->getStoreCollection( $_group) as $_store)($showWebsite==false) if($block->getRequest() ->getParam('website')==$_website->getId()) endif
Definition: switcher.phtml:21
if($block->getStoreId()==$_store->getId()) endforeach
Definition: switcher.phtml:28