Skip to content

Commit

Permalink
Add multi store support.
Browse files Browse the repository at this point in the history
  • Loading branch information
michelpl committed Jan 26, 2018
1 parent 9b557a7 commit 42e6a61
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
16 changes: 15 additions & 1 deletion injected.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
<?php
$data['frontlinkUrl'] = $data['frontlinkUrl'] = HTTPS_CATALOG;
$data['stores'][] = [
'name' => $this->config->get('config_name'),
'href' => HTTP_CATALOG
];

$this->load->model('setting/store');

$results = $this->model_setting_store->getStores();

foreach ($results as $result) {
$data['stores'][] = [
'name' => $result['name'],
'href' => $result['url']
];
}
29 changes: 23 additions & 6 deletions install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,23 @@
<![CDATA[return $this->load->view('common/column_left', $data);]]>
</search>
<add position="before">
<![CDATA[$data['frontlinkUrl'] = $data['frontlinkUrl'] = HTTPS_CATALOG;]]>
<![CDATA[
$data['stores'][] = [
'name' => $this->config->get('config_name'),
'href' => HTTP_CATALOG
];
$this->load->model('setting/store');
$results = $this->model_setting_store->getStores();
foreach ($results as $result) {
$data['stores'][] = [
'name' => $result['name'],
'href' => $result['url']
];
}
]]>
</add>
</operation>
</file>
Expand All @@ -20,12 +36,13 @@
</search>
<add position="after">
<![CDATA[
<li id="frontLink">
<a href="{{ frontlinkUrl }}" target="_blank">
<i class="fa fa-home"></i>
Your store
{% for store in stores %}
<li class="frontLink">
<a href="{{ store.href }}" target="_blank">
<i class="fa fa-home"></i>{{ store.name }}
</a>
</li>
</li>
{% endfor %}
]]>
</add>
</operation>
Expand Down

0 comments on commit 42e6a61

Please sign in to comment.