刪除語言和貨幣選單

看到很多使用opencart架設的商店僅使用單一語言和貨幣,目標應該是針對單一國家做銷售,這時候語言和貨幣選單似乎就顯得有點多於,只需要修改header.tpl就可以刪掉,以下是以1.4.9.1版做範例且模版為預設模版,其他版本請發揮想像力,大致上是相同的

  1. 開啟catalog\view\theme\default\template\common\header.tpl
  2. 找到下列這段程式碼(大約第110到151行),並刪除它即可除去貨幣和語言選單

<div class="div7">
<?php if ($currencies) { ?>
<form action="<?php echo str_replace('&', '&amp;', $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('&', '&amp;', $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']; ?>" />&nbsp;&nbsp;<?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']; ?>" />&nbsp;&nbsp;<?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前台語言和貨幣選單最快的方法,如有錯誤歡迎提出

發佈留言