Loading

Invisible properties. Adding the custom product tabs.

Category:

Due the some issues in Axis 0.7.1.1, this tutorial cannot be fully applied with Axis 0.7.1.1 and earlier. The parts that is impossible or hard to implement with Axis 0.7.1.1 will be marked with notes on how to deal with current version

Axis has a buit-in support for product specifications. Usually specifications are used to shortly describe the product features like screen size, color, isbn etc.

Properties listing on the frontend
Image 1. Properties listing on the frontend
Editing the properties of the product on the backend
Image 2. Editing the properties of the product on the backend

In some cases you need to output the property as a link, image or video. And sometimes you’ll be needed to output the property in the separate location (custom product tab, for example). In the next steps I will tell you how to solve this two problems.

Creating the video and driver properties

Navigate to admin/catalog_product-attributes and fill the new attribute form with following values, and save the attribute.

Adding new attribute
Image 3. Adding new attribute

After the attributes are created I can attach them to the product at the admin/catalog_index. This can be done at the Properties tab in the product window (see the image 2).

Fill the video property value with the html from youtube:

<object style="height: 390px; width: 640px">
  <param name="movie" value="http://www.youtube.com/v/YMok4yGluhE?version=3">
  <param name="allowFullScreen" value="true">
  <param name="allowScriptAccess" value="always">
  <embed src="http://www.youtube.com/v/YMok4yGluhE?version=3" 
    type="application/x-shockwave-flash" 
    allowfullscreen="true" 
    allowScriptAccess="always" 
    width="640" height="390">
</object>

For the driver property I will set the url to the file as value, to show how to use custom render for property

http://example.com/driver/file.zip

For the Axis 0.7.1.1 I’ll set the value to html link, because I will not be able to apply another rendering method by attribute code:

<a href="http://example.com/driver/file.zip">Download driver</a>

Rendering property with the custom template

If you are using the default theme for the store, It's highly recommended you to create your own theme, and override only files you need to override. This will make your store ready for applying the next Axis upgrades, and your changes in the templates will not be rewritten with the new Axis version.

To make property rendered as link or flash object I will override the properties.phtml template.

Copy the /axis/app/design/front/default/templates/catalog/index/product/proporties.phtml file to your theme /axis/app/design/front/MYTHEME/templates/catalog/index/product/proporties.phtml

Change the lines 28-31 to (only for Axis 0.7.2):

<?php
   if (!empty($property['value']) || 0 == $property['value']) :
       if ('driver' === $property['code']) :
           echo "<a href='{$property['value']}'>Download driver</a>";
       else:
           echo $property['value'];
       endif;
   else:
       echo $this->translate('catalog')->__('Empty');
   endif;
?>

For Axis 0.7.1.1 and older change this lines to:

<?php
   if (!empty($property['value']) || 0 == $property['value']) :
       echo $property['value'];
   else:
       echo $this->translate('catalog')->__('Empty');
   endif;
?>

The result on the frontend:

Properties list with video and driver attributes<br />
Image 4. Properties list with video and driver attributes

Moving the video property to the separate tab

This part is problematic on Axis 0.7.1.1 due the lack of available attribute information on frontend.

Now I want to hide the video from the property list and show it in the separate tab called ‘Expert Review’. To do this I will make the video attribute hidden and create tabbed block that will render the video property.

  1. Hide video attribute
    Navigate to admin/catalog_product-attributes, open the video attribute and remove the checkbox from the ‘Visible on Frontend’ field (see the Image 3).
  2. Create tabbed block on the product page
    Navigate to admin/template_index and add the box with the following parameters:
    • Box: Axis_Catalog_Product
    • Layout block: content
    • Show on: catalog/index/product
    • Sort order: 110
    • Status: checked

    Save.
    After saving the box you need to open the detailed properties and fill the values:

    • Config: title:Expert Review
    • Tab container for the catalog/product/index row: product-info
    • Template: box/video.phtml

    (To open the detailed view window, double click on the box id column, or click the edit icon in the last column)

    Editing the box details<br />
    Image 5. Editing the box details
  3. Create the template video.phtml for the ‘Expert Review’ block
    Create the file at /axis/app/design/front/[fallback or MYTHEME]/templates/catalog/box/video.phtml with following content:
    <?php
    foreach ($this->product['properties'] as $property) :
    if ('video' === $property['code']) :
       echo $property['value'];
       break;
    endif;
    endforeach;
    

    In Axis 0.7.1.1 $property has only name and value information. I could use the $property['name'] instead of $property['code'], but the name is depends on current language, so I need to check all possible values of property name:

    <?php
    foreach ($this->product['properties'] as $property) :
    if ('Video' === $property['name'] || 'Video2' === $property['name']) :
       echo $property['value'];
       break;
    endif;
    endforeach;
    

That’s all. Final result is illustrated on the picture below.

Final result
#

А у меня не получается скрыть в отдельный таб видеообзор. Axis 0.8.1

#

У меня тоже в табе не выводиться ((( Axis 0.8.1

#

would really like to try this out, it looks great! I am also happy it's somewhat a new application and not a fork of magento/osC or any famous ecarts out on the net
purchase term paper

Explore the Blog