我试图在前端显示不同的标题图像基于store id每个商店有不同的标题图像的意思.
问题是如何在前端(in header)中回显当前store_id
所以我可以继续使用下面的代码:
<?php
if($store_id == '1') { // 1 is default store
//echo image here
}
else { //if not default show different image
//echo image here
}
?>
Run Code Online (Sandbox Code Playgroud)
Opencart版本:1.4.9.6
sha*_*yyx 12
store_id你店的潮流在$this->config->get('config_store_id').
这意味着如果你需要在模板中,编辑头控制器(catalog/controller/common/header.php) - index()函数中的一些添加此代码(id已经不存在):
$this->data['store_id'] = $this->config->get('config_store_id');
Run Code Online (Sandbox Code Playgroud)
然后在Your header.tplof Your template(catalog/view/theme/<YOUR_THEME>/template/common/header.tpl)中使用它:
<?php if ($tore_id == 0) { ?>
<div>Main store</div>
<?php } else { ?>
<div>Subdomain store</div>
<?php } ?>
Run Code Online (Sandbox Code Playgroud)
或者这样:
<div class="container-<?php echo $store_id; ?>"> ... </div>
Run Code Online (Sandbox Code Playgroud)
它在你身上.
编辑:还考虑继续使用更新的OpenCart(截至2012年12月15 日最新版本为1.5.4.1 ) - 值得重新设计以及它具有的功能和小工具.