Add custom property in attributes magento

In magento, in my page product, I have all my products and I can filters them. I display about 10 filters and I want to show only 5 and hide 5, I can do that in jQuery with .show()/.hide(). Display is not the problem, th problem is how I can know if the filter is visible or not.

I think I need to add a custom property to attributes, but I don't know how do that ?


Not entirely sure this is what you are asking, but if you want to give a product a new attribute, you first

  • Go to catalog - attributes - manage attributes.
  • Click "Add new attribute"
  • Fill in the details for the type of attribute you want. You probably just want a dropdown with the values of "show" and "hide"
  • For the sake of this example, we will assume you have filled in the attribute code as "newattribute"
  • Now, you can add this to your products by

  • Go to catalog - attributes - manage attributes sets and clicking the product type you want to add it to
  • Drag and drop the new attribute from "unassigned attributes" area to the list of used attributes
  • Click "Save Attribute Set"
  • Your new fields will now appear when you add a product.

    To retrieve this information in your template, you should use the function along the lines of

    $_newattribute=$_product->getNewattribute();
    

    Newattribute will be the name of your attribute's code.

    ( Note that the $_product object will have to have been defined first - it should have been so on any page displaying a product )

    Alternatively, if you mean you just want to use jquery to know if something is visible or not, there is a solution here: Detect if an element is visible

    链接地址: http://www.djcxy.com/p/83546.html

    上一篇: 如何在下拉菜单功能onclick中包含<a>标记同级?

    下一篇: 在属性magento中添加自定义属性