В index.phpПодскажите пожалуйста, как добавить условие,чтобы на главной странице в блоке акций показывались только товары в наличии ?
<!-- sales - start -->
<?php if (!empty($data['saleProducts'])): ?>
<div class="l-col min-0--12">
<div class="c-carousel">
<div class="c-carousel__title">
<a href="<?php echo SITE; ?>/group?type=sale">
<span class="c-carousel__title--span">
<?php echo lang('indexSale'); ?> <span class="c-carousel__title--more"><?php echo lang('indexViewAll'); ?></span>
</span>
</a>
</div>
<div class="<?php echo count($data['saleProducts']) > 0 ? "c-carousel__content" : "" ?>">
<?php foreach ($data['saleProducts'] as $item) {
$data['item'] = $item;
if ($item['count']!=0){
layout('mini_product', $data);
}
} ?>
</div>
</div>
</div>
<?php endif; ?>
<!-- sales - end -->
Спасибо,работает!!!В index.php
Перед выводом layout('mini_product', $data);
Нужно добавить условие if ($item['count']!=0)
У меня это выглядит так
PHP:<!-- sales - start --> <?php if (!empty($data['saleProducts'])): ?> <div class="l-col min-0--12"> <div class="c-carousel"> <div class="c-carousel__title"> <a href="<?php echo SITE; ?>/group?type=sale"> <span class="c-carousel__title--span"> <?php echo lang('indexSale'); ?> <span class="c-carousel__title--more"><?php echo lang('indexViewAll'); ?></span> </span> </a> </div> <div class="<?php echo count($data['saleProducts']) > 0 ? "c-carousel__content" : "" ?>"> <?php foreach ($data['saleProducts'] as $item) { $data['item'] = $item; if ($item['count']!=0){ layout('mini_product', $data); } } ?> </div> </div> </div> <?php endif; ?> <!-- sales - end -->