Attribute relation to introduce manufacturer

This tutorial will demonstrate how to create pages to present your manufacturer in few steps.

1. Create your content type and your fields

In our example, we create a new content type called "Manufacturer" with identifier "manufacturer".
Then we add 3 fields: manufacturer title, description and manufacturer link.
This last one will be the link between our content and the attribute options (see screenshot).

2. Link your products to the manufacturer options

Now we are able to link products to manufacturer and contents to manufacturer.
Let's start with the easiest one and the most common: link your products to your manufacturer.

If you have added the attribute "manufacturer" in your products attributes sets, you can select it when editing or creating a new product.

3. Create your presentation page for your manufacturers

Create your content and select the corresponding manufacturer in the list.

4. Link your product page to your presentation pages

To link your products to your contents pages, a simple php helper method is available.
In our example, we write this code in template/catalog/product/view.phtml file.

  
   $contents = $this->helper('contentmanager')
   ->getContentsByOptionIds(
   $_product->getManufacturer(), //get the manufacturer option of the product
   'manufacturer_link', //field identifier
   'manufacturer' //content type identifier
   );
   
   foreach($contents as $content):
  ?>
   "getUrl(); ?>">
   echo $content->getManufacturerTitle(); ?>
   
  endforeach; ?>  

It results links to your contents (several links if you have several pages to presents your manufacturers).

loader
Loading...