OpenCart Hide special offers title if no special offers available

烂漫一生 提交于 2020-01-26 03:47:25

问题


I want to make a relatively simple modification to OpenCart so that if there are no Special Offers available, or applicable, that the title Special Offers does not display.

If none are available or applicable, currently it will display the heading title on a coloured background which looks odd if there are no special offers to show.

I am guessing the modification needs to be made to /catalog/controller/module/special.php and would be something like.

If special offers > 0 then do this
  else
Don't do anything

But I am not sure how to implement this.

I'd be grateful if someone could advise.


回答1:


Not entirely sure what you are referring to here, but you would be best editing the template not the controller file and using

<?php if($products) { echo $heading_title; } ?>

in place of what is there currently - something like just <?php echo $heading_title; ?>

Also you may find the title is surrounded by <h1> or <h2> tags. If so, just do the same but around the tags, something like

<?php if($products): ?>
<h2><?php echo $heading_title; ?></h2>
<?php endif; ?>


来源:https://stackoverflow.com/questions/14536473/opencart-hide-special-offers-title-if-no-special-offers-available

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!