LemonStand Documentation

Manufacturer List page

To create a page displaying a list of all manufacturers, you should use the shop:manufacturers action. This action creates the $manufacturers PHP variable, which is a collection of manufacturers. Each element in the collection is an instance of the Shop_Manufacturer class.

Start with creating a new page and assign it some name and URL. On the Actions page select the shop:manufacturers action. For the page code you can use the following content:

<ul>
  <? foreach ($manufacturers as $manufacturer): ?>
    <li>
      <a href="/manufacturer/<?= $manufacturer->url_name ?>"><?= h($manufacturer->name) ?></a>
    </li>
  <? endforeach ?>
</ul>

Please note that the code creates a link for each manufacturer. The link refers to a page with the /manufacturer URL. On this page you can display manufacturer details and a list of manufacturer products. As any page in LemonStand the manufacturer details page URL is not fixed. In the example we used the /manufacturer URL, but you can use any other URL.

The process of creating a manufacturer details page is described in the next article.

Next: Implementing customer payment profiles
Previous: Implementing the Compare Products feature
Return to Building your online store

Comments

darren

Friday, October 22, 2010

If you want to place this code in a partial instead of an entire page, you can put the line:

<? $manufacturers = Shop_Manufacturer::create()->order('name')->find_all(); ?>

right above the list instead of using the shop:manufacturers action.

Add your comment

Loading form...