Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Sign Up

Recommended Posts

Здравствуйте, подскажите пожалуйста как перенести список производителей в header, вот вывод во view файле 

<?php if ($categories) { ?>
				<?php foreach ($categories as $category) { ?>
				<?php if ($category['manufacturer']) { ?>
				<?php foreach (array_chunk($category['manufacturer'], 4) as $manufacturers) { ?>
				<ul>
        <?php foreach ($manufacturers as $manufacturer) { ?>
        <li><a href="<?php echo $manufacturer['href']; ?>"><?php echo $manufacturer['name']; ?></a></li>
        <?php } ?>
      </ul>
      <?php } ?>
      <?php } ?>
      <?php } ?>
      <?php } else { ?>
      <p><?php echo $text_empty; ?></p>
      <div class="buttons clearfix">
        <div class="pull-right"><a href="<?php echo $continue; ?>" class="btn btn-primary"><?php echo $button_continue; ?></a></div>
      </div>
      <?php } ?>

В контроллере производителей много кода, я не понимаю что именно  нужно вытащить в шапку, пробовал перенести весь код из функции index, так же пробовал отдельно подключать модель , языковые файлы и массивы связанных с выводом, ничего не получается

Link to post
Share on other sites

Можете закрывать тему, нашел решение, добавил в контроллер шапки

		$this->load->model('catalog/manufacturer');
		$this->load->model('tool/image');

		$this->load->language('product/manufacturer');

		$data['manufacturers'] = array();

		$manufacturers = $this->model_catalog_manufacturer->getManufacturers();

		foreach ($manufacturers as $manufacturer) {
  if ($manufacturer['meta_h1']) {
    $name = $manufacturer['meta_h1'];
  } else {
    $name = $manufacturer['name'];
  }

  if ($manufacturer['image']) {
    $image = $this->model_tool_image->resize($manufacturer['image'], 270, 170 );
  } else {
    $image = '';
  }

  $data['manufacturers'][] = array(
    'name'  => $name,
    'image' => $image,
    'href'  => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id'])
  );
}

И изменил вывод 

<ul>
<?php foreach ($manufacturers as $manufacturer) { ?>
<li><a href="<?php echo $manufacturer['href']; ?>"><?php echo $manufacturer['name']; ?></a></li>
<?php } ?>  
</ul>

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.