magento assign which size chart to which product

Show which size chart you want to assign to which product?

For example:
- Size chart for Gloves
- Size chart for jackets ....
and you want to make the minimum code change possible to your magento core files.

Here is the solution.

Method 1:

Create new attribut called "size_chart_template":

Go to Admin->Attributes->Manage Attributes

Add new attribute with the following properties:

  • Attribute Code : size_chart_template
  • Scope&: Global
  • Catalog Input type  for Store Owner   : Dropdown
  • Unique Value : No
  • Required value : No
  • Input Validation for store owner: No
  • Apply to * : All Product Types
  • Use to create Configurable Product : No

For Frontend Properties: No everywhere and Position to 0

In Manage Label/Options:

Admin : Size Chart Template

add your options for example:

Helmets
Gloves
Jackets ...

Save your attribute.

Now go to Catalog->Attributes->Manage Attribute Sets

Select your set and add the attribut you have just created. (drag and drop)

 

Now we are going to assign for the product  Red Helmet the size chart Helmets.

Go to Red Helmet and select Helmets from your dropdown list (You should add this attribut before use it).

 


paste this code snippet to app/design/frontend/default/yourtemplate/template/catalog/product/view.phtml
<?php
       if($_product->getAttributeText('size_chart_template') != ""){ 
               $sizeChartURL=   $this->getSkinUrl('sizecharts/'.$_product->getAttributeText('size_chart_template').'.php');
               $sizeChartIcon= Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."size-charts/size-chart.gif";
               echo 'size chart';       
       }
          ?> 

Now create skin/frontend/default/yourtemplate/sizecharts/Helmets.php

 


<?php
 chdir ('../../../../../');
 require_once getcwd().'/app/Mage.php';
 umask(0);
 Mage::app();
 $mediaURL=  Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
?>
Your HTML code here. 
If you have any question do not hesitate to ask.

Method 2: Create Magento Size Charts Using Static Blocks and Javascript