看到很多使用opencart架设的商店仅使用单一语言和货币,目标应该是针对单一国家做销售,这时候语言和货币选单似乎就显得有点多于,只需要修改header.tpl就可以删掉,以下是以1.4.9.1版做范例且 模版为预设模版,其他版本请发挥想像力,大致上是相同的
-
开启catalog\view\theme\default\template\common\header.tpl
-
找到下列这段程式码(大约第110到151行),并删除它即可除去货币和语言选单
<div class="div7">
<?php if ($currencies) { ?>
<form action="<?php echo str_replace('&', '&', $action); ?>" method="post " enctype="multipart/form-data" id="currency_form">
<div>
<?php foreach ($currencies as $currency) { ?>
<?php if ($currency['code'] == $currency_code) { ?>
<div><a><?php echo $currency['title']; ?></a></div>
<?php } ?>
<?php } ?>
<div>
<?php foreach ($currencies as $currency) { ?>
<a onclick="$('input[name=\'currency_code\']').attr('value', '<?php echo $currency['code']; ?>'); $('#currency_form').submit();"><?php echo $currency['title']; ?></a>
<?php } ?>
</div>
</div >
<div style="display: inline;">
<input type="hidden" name="currency_code" value="" />
<input type="hidden" name="redirect" value="<?php echo $ redirect; ?>" />
</div>
</form>
<?php } ?>
<?php if ($languages) { ?>
<form action="<?php echo str_replace('&', '& ', $action); ?>" method="post" enctype="multipart/form-data" id="language_form">
<div>
<?php foreach ($languages as $language) { ?>
<?php if ($language['code'] == $language_code) { ?>
<div><a><img src="image/flags/<?php echo $language['image']; ?>" alt="< ?php echo $language['name']; ?>" /> <?php echo $language['name']; ?></a></div>
<?php } ?>
<? php } ?>
<div>
<?php foreach ($languages as $language) { ?>
<a onclick="$('input[name=\'language_code\']').attr('value', '< ?php echo $language['code']; ?>'); $('#language_form').submit();"><img src="image/flags/<?php echo $language['image'] ; ?>" alt="<?php echo $language['name']; ?>" /> <?php echo $language['name']; ?></a>
<?php } ?>
</div>
</div>
<div>
<input type="hidden" name="language_code" value="" />
<input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
</div>
</form>
<?php } ?>
</div>
以上是删除opencart前台语言和货币选单最快的方法,如有错误欢迎提出
(责任编辑:好模板) |