Product Catalog

(You need the plugins I18N, I18N Search and I18N Special Pages)

If you want to create a product catalog, create a special page type product for your products:

  • add the appropriate fields like picture, weight, size, price
  • add the appropriate code to show the product on a page and with I18N Search

Create the specific product pages and make sure to add keywords like 'kitchen', 'garden', 'furniture', 'wood'. Depending on the number of products you might add them to your navigation or not.

Create an additional special page type list as follows:

  • one additional field searchtags

  • HTML code for the display similar to the following:

<?php get_special_field('content'); ?>

(% searchresults tags='<?php get_special_field('searchtags','-',false);?>' lang=en HEADER='' %)

Create pages of this type list to your navigation, in the content add a general description of the products in this category and specify the appropriate search tags, e.g.

  • Furniture with search tags _special_product furniture
  • Garden products with search tags _special_product garden
  • Wood products with search tags _special_product wood

This way you can have a catalog of overview pages that will display all the matching products. A product can be displayed on multiple catalog pages.

If you want to display the number of available products for each catalog page in the navigation,

  • create a component nav as follows (make sure to make the call to return_i18n_search_results only for the catalog pages - here tested with the parent slug - otherwise the navigation might take a long time to display)
<li class="<?php echo $item->classes; ?>">
  <a href="<?php echo htmlspecialchars($item->link); ?>">
    <?php echo htmlspecialchars($item->text); ?>
  </a>
  <?php
    if ($item->parent == 'catalog') {
      $results = return_i18n_search_results((string) $item->searchtags, null, 0, 1000, null, 'en');
      echo ' ('.count($results['results']).')';
    }
  ?>
  <?php if ($item->isOpen) { ?>
    <ul><?php $item->outputChildren(); ?></ul>
  <?php } ?>
</li>
  • and add the component parameter to your call of get_i18n_navigation in the template, e.g. (last parameter)
<?php get_i18n_navigation(return_page_slug(), 0, 100, I18N_FILTER_MENU | I18N_FILTER_CURRENT, 'nav'); ?>

Alternative

If all your products are in the menu and you just want to show the number of child menu items in the navigation, you don't need a special page type for the catalog lists, but can use the following component nav instead:

<li class="<?php echo $item->classes; ?>">
  <a href="<?php echo htmlspecialchars($item->link); ?>">
    <?php echo htmlspecialchars($item->text); ?>
  </a>
  <?php
    if ($item->parent == 'catalog') {
      $results = return_i18n_search_results('_menu _parent_'.$item->id, null, 0, 1000, null, 'en');
      echo ' ('.count($results['results']).')';
    }
  ?>
  <?php if ($item->isOpen) { ?>
    <ul><?php $item->outputChildren(); ?></ul>
  <?php } ?>
</li>

(A more efficient implementation would only use the I18N navigation without I18N Search, but it would be much more complex)

Make sure to use I18N Search version 2.11.1+.

Demonstration

This page itself is an example of the described setup. You see the number of software products in the navigation and below you see the products themselves:

  • en jEasyORM

    jEasyORM is a Java-based ORM/DAO tool with the following features: Use of POJOs as domain objects, no need to inherit from a base class, Mapping POJOs to database tables without
  • en phpEasyVCS

    phpEasyVCS is a simple version control system (VCS) with minimal hosting requirements, namely PHP 5.2+. No database is needed. Files can be viewed and uploaded with a browser or by