Jump to content

Description text for each attribute


mrbinarydigit

Recommended Posts

If you won´t change db structure, you can work with jQuery. Edit product.tpl, add a <script> section where you put an attribute onchange function. Use the description field to add different descriptions for example

 

[attr_0]Default text[/attr_0][attr_14]Description text for color = black[/attr_14][attr_15]Description text for disk space = 16Go[/attr_15]

 

The attribute onchange function parses all descriptions and shows only the description text for specific attribute.

Link to comment
Share on other sites

  • 5 years later...

You could use the hide / show use of css, by adding div elements directly into your product description like this

 

<div class="attribute1">This is the description for attribute 1</div>
<div class="attribute2">This is the description for attribute 2</div>

 

and then find out the value of the attribute and add some javascript like this

 

 $('.attribute_fieldset.quality select').on('change',function(){
           if ($('.attribute_fieldset.quality select').val() == 59) {
            $('.attribute1').css({'display':'block'});
            $('.attribute2').css({'display':'none'});
        } else if ($('.attribute_fieldset.quality select').val() == 58) {
            $('.attribute1').css({'display':'none'});
            $('.attribute2').css({'display':'block'});
        }
    });

 

That will then only show the description of 1 attribute

 

Regards

 

David

Edited by ecentury (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...