A
A
azaza2019-10-15 13:50:32
opencart
azaza, 2019-10-15 13:50:32

opencart 2 manufacturers list?

Who fumbles in php, tell me how to correctly display the manufacturers in a single list
now the list is displayed alphabetically
here is the template

<div id="content" >
      <h1><?php echo $heading_title; ?></h1>
        <?php if ($categories) { ?>
          <?php foreach ($categories as $category) { ?>
            <div class="manufaklist">
              <?php foreach (array_chunk($category['manufacturer'], 4) as $manufacturers) { ?>
                <?php foreach ($manufacturers as $manufacturer) { ?>
                  <div class="item">
                  <a href="<?php echo $manufacturer['href']; ?>"><?php echo $manufacturer['name']; ?></a>
                  </div>
              <?php } ?>
            </div>
            <?php } ?> 
            <?php } ?>
          <?php } else { ?>
        <?php } ?>
    </div>

That is, now it is displayed, for example. by letter 1 - a list, then by B, etc.
, that is, the container goes to the letter A, closes, then the same block to the letter B, then closes again
<div class="manufaklist">
  <div class="item"><a href="">AIC</a></div>
  <div class="item"><a href="">Airdog</a></div>
  <div class="item"><a href="">AirFree</a></div>
</div>
<!--тут контейнер закрывается, и открывается такой же блок на другую букву-->
<div class="manufaklist">
  <div class="item"><a href="">Boneco</a></div>
  <div class="item"><a href="">Brune</a></div>
</div>
<!--Не могу понять как сделать что бы выводилось единым списком так--->

<div class="manufaklist">
  <div class="item"><a href="">AIC</a></div>
  <div class="item"><a href="">Airdog</a></div>
  <div class="item"><a href="">AirFree</a></div>
  <div class="item"><a href="">Boneco</a></div>
  <div class="item"><a href="">Brune</a></div>
</div>

Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Vesnin, 2019-10-17
@natojezlo

По идее сделать так:

<div id="content" >
      <h1><?php echo $heading_title; ?></h1>
        <?php if ($categories) { ?>
          <div class="manufaklist">
            <?php foreach ($categories as $category) { ?>
              <?php foreach (array_chunk($category['manufacturer'], 4) as $manufacturers) { ?>
                <?php foreach ($manufacturers as $manufacturer) { ?>
                    <div class="item">
                        <a href="<?php echo $manufacturer['href']; ?>"><?php echo $manufacturer['name']; ?></a>
                    </div>
                <?php } ?>
              <?php } ?> 
            <?php } ?>
          </div>
          <?php } else { ?>
    </div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question