Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Size Chart
 
SwiftCol
Sr. Member
 
Total Posts:  85
Joined:  2008-05-22
 

Hello all,
I am faced with the task of creating a customizable size chart and adding it to Magento. Just adding an image of the size chart to the layout would be simple, but I need something more complex and customizable than that. Preferably I need my clients to be able to customize which of a given number of saved charts apply to a given product, as well as create, edit, and delete saved charts. (IE: The Shirts & Coats size chart v.s. the Pants size chart.)

I have looked through the Magneto Connect section of the site and I don’t see anything like what I need, nor do I see anything built into Magento that does this already. Do any of you already have something like this, or will I need to create my own? If I need to create my own, any tips or suggestions that you can provide would be very appreciated.

Thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

If I understand correctly, I think that there’s an easy solution. From what I gather, you need to let your client decide which size chart they want to assign to which product, all while allowing them to have multiple size charts for each product, just not necessarily the same across ALL products. So, the size chart(s) for pants might be one for inseam and another for waist, whereas you may need only one for shirts, albeit a different one. Am I getting close to your requirements?

If so, I’d proceed by making an attribute for each of of your size charts, called maybe pants_inseam, pants_waist, shirt and so on. If each individual size chart is an image, I would make this a media attribute. Then you can add those attributes to your dataflow excel sheet and populate across products just like you would for a regular product image, ie for your pants, in the column pants_inseam, you would use /pants_inseam.jpg (or whatever the name/type of your image file is).

Then on your product view template, you could easily put in a quick conditional statement that says if there are pant size charts, show them, otherwise if theres a shirt chart show that, or if there’s no size chart don’t show anything. Of course, if you wanted html/css size charts, this could just as easily be accomplished by changing attribute type from media to text box. If you need help, just let me know.

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
SwiftCol
Sr. Member
 
Total Posts:  85
Joined:  2008-05-22
 

Dan,
This sounds like a plan. I’m going to take a shot at this and get back to you when I run into the brick wall i’m sure to hit.
Thanks for your advice.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SwiftCol
Sr. Member
 
Total Posts:  85
Joined:  2008-05-22
 

Outdated, see below!

I think what i’m looking for might require a different method than what you mentioned above. Imagine that my client creates a new product (configurable or not) and denotes that it belongs to the T-Shirts Attribute Set, this will give them the gender, size, and color attributes to choose from. I would like the product view template (or a module that I create for it) to recognise that the product is a T-Shirt and that the gender is set to Male, so it then includes the Male T-Shirt size chart.

1) How do i access the information of what attribute set the product is in, and what the gender attribute is set to from either the product view template, or my own module. I have figured out how to overwrite modules (such as the breadcrumb module), but I do not know how to access other information outside the module I am overwriting.

Preferably I would have a way for the client to edit size charts in the Magento Control Panel, but I can make this static for now, I am mainly looking at how to read attribute sets and attribute settings from the product page or a module that I create for it.

Thank you for your help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SwiftCol
Sr. Member
 
Total Posts:  85
Joined:  2008-05-22
 

I have figured out (through tons of searching) how to access a products attributes and attribute set name, and I have come up with this: template\catalog\product\view\type\configurable.phtml

<?php
        $data 
= array();
        
$attributes $_product->getAttributes();
        foreach (
$attributes as $attribute{
            
//$attribute->getIsVisibleOnFront() && 
            
if ($attribute->getIsUserDefined()) {
                $value 
$attribute->getFrontend()->getValue($_product);
                if (
strlen($value) && $_product->hasData($attribute->getAttributeCode())) {
                    $data[$attribute
->getAttributeCode()= array(
                       
'label' => $attribute->getFrontend()->getLabel(),
                       
'value' => $value//$product->getData($attribute->getAttributeCode())
                    
);
                
}
            }
        }
        $attributes 
$data;    unset($data);
        
$attribute_set Mage::getModel('eav/entity_attribute_set')->load$_product->getAttributeSetId() );
        
        if(    isset(
$attribute_set->_data['attribute_set_id'])
            && isset(
$attribute_set->_data['attribute_set_name'])
            && (
$attribute_set->_data['attribute_set_id']==41 || $attribute_set->_data['attribute_set_name']=='T Shirts')
            && isset(
$attributes['gender']) ){
            
            
switch( $attributes['gender']['value'){
                
case 'Mens':
                    echo 
'Men\'s T-Shirt Size Chart';
                    break;
                case '
Womens':
                    echo '
Women\'s T-Shirt Size Chart';
                    break;
                case 
'Boys':
                    echo 
'Boy\'s T-Shirt Size Chart';
                    break;
                case '
Girls':
                    echo '
Girl\'s T-Shirt Size Chart';
                    break;
            
}
        }
    ?>

Now my next task is to come up with a good way to store the size charts, and preferably have them editable by my clients using the Magento Control Panel. I would love to have it totally dynamic, so that I can make new attribute sets, and even new gender groups (Toddler, Baby) and have charts available. Can anyone help?
Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

Are you trying to have the size chart change based on what value is chosen from a drop-down configurable value?

 
Magento Community Magento Community
Magento Community
Magento Community
 
SwiftCol
Sr. Member
 
Total Posts:  85
Joined:  2008-05-22
 

No, i’m not. I just want a Men’s TShirt size chart to show up on a Men’s TShirt product page, and a Women’s Pants size chart to show up for a Women’s Pants product page, etc.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SwiftCol
Sr. Member
 
Total Posts:  85
Joined:  2008-05-22
 

Anyone?

*bump*

 
Magento Community Magento Community
Magento Community
Magento Community
 
SwiftCol
Sr. Member
 
Total Posts:  85
Joined:  2008-05-22
 

Guys, my client really needs this, and i’m still unsure how to make this happen. Can anyone give me any adivce on this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
seudo
Guru
 
Avatar
Total Posts:  344
Joined:  2008-04-21
 
SwiftCol - 13 June 2008 06:08 PM

Now my next task is to come up with a good way to store the size charts, and preferably have them editable by my clients using the Magento Control Panel. I would love to have it totally dynamic, so that I can make new attribute sets, and even new gender groups (Toddler, Baby) and have charts available. Can anyone help?
Thank you!

Do you mean by Control Panel say a cms page?

Maybe create a link based on the attribute set name within the template file that links to a cms page.

The code can check to see if that particular cms page exists and generates the link.

For example,
Create a cms page with your toddler size chart which can include images and have the url identifier be like “toddler-size-chart” and set Layout to Empty.

Then have the template generate your url based on your code above like so

<a href="storeurlhere/<?php  echo $attributeset_name.'-size-chart'; ?>">Size Chart</a>

The url can open a popup, or blank page or how ever you want to that cms page.

Not sure if this what you’re looking for but maybe might help somehow as did your code for me.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top