Get current store id in opencart
opencart, php
Solution
The current `store_id` of Your store is in `$this->config->get('config_store_id')`.
That means if You need it in the template, edit header controller (`catalog/controller/common/header.php`) - some in the `index()` function add this code (id it is not present already):
$this->data['store_id'] = $this->config->get('config_store_id');
Then in Your `header.tpl` of Your template (`catalog/view/theme/<YOUR_THEME>/template/common/header.tpl`) use it this way:
<?php if ($tore_id == 0) { ?>
<div>Main store</div>
<?php } else { ?>
<div>Subdomain store</div>
<?php } ?>
or this way:
<div class="container-<?php echo $store_id; ?>"> ... </div>
It is upon You.
EDIT: Also consider moving on with newer OpenCart (latest is 1.5.4.1 as of 15th December, 2012) - it is worth the redesign and the functions and gadgets it has.
Problem
i try to show different header image in frontend based on `store id` mean every store has different header image . the problem is how to echo current store_id in frontend (in `header`) so i can proceed with my code something like below : ``` <?php if($store_id == '1') { // 1 is default store //echo image here } else { //if not default show different image //echo image here } ?> ``` Opencart version : 1.4.9.6