2

I'm working on a magento website that have hundreds of products with, each of them, having more than 5 thousands of options in a dropdownlist (in a custom attribute, using this plugin

I know that this is stupid to store that much data in the dropdownlist but I can't do a thing to change that (client, boss, wimey wibbly wobbly stuff, etc) [1]

Since I imported all my products with their respective DropDownList, the website is very slow to show the page mywebsite/any-category.

It seems that the view that is rendering the products for a cateogry get some products (first 9th for example) and all the attributes (even if each of them have a dropdown with 5K of options)

Does someone have ever encountered this kind of problem before ? Is there a way of getting a product collection with only certain attributes ? (or to exclude some ?)

Edited : Even if I have a dropdownlist of 5K elements, these element are for the "width and height" of the products with the following format 6x7.

When the products are showed at the screen, I hide this dropdownlist and show two other dropdown of MAXIMUM 72 values. The users won't even notice they dropdown of 5K elements.

I really just need to optimize the speed of the category page because the product page is already fast.

  • There must by another way to get products in magento without loading all the custom options ? – RPDeshaies Apr 6 '14 at 2:28
1

Just a few numbers.

Assume all your options have a value with 4 digits and every label is only five bytes long, so we have something like this:

<select>
    <option value="1234">label</option>

This is 35 characters. 35 characters * 5000 options * 9 products = 1,575,000 bytes

Calculating with 1000er steps because it is easier, this are 1.5MB(!!) of HTML. What do you think how long it takes for a browser to build a DOM with 1.5MB of text-data? :-) Here is your problem - I think.

I have no idea what you are selling, but I can't imagine a way where a customer selects something from a 5k long dropdown - NEVER.

  • This isn't helping me at all. I edited the question to add more detail but the user won't see this dropdownlist because I generate two other dropdown with JS and hide the other. I know that this is probably the wrong way of doing things but I don't have a choice, the only thing that I need is to raise the speed of the category page because, these dropdownlist aren't even showed on this page – RPDeshaies Mar 12 '14 at 12:42
  • If they are hidden, they are still parsed and created in the DOM. If you select an entry from the select, why you don't just use a hidden text field and write the value into this? – Fabian Blechschmidt Mar 12 '14 at 13:05
  • Because there's only some possible value that the user can select but what you are trying to resolve has nothing to do with the initial question. Do you know any way of getting products for a category but only certain attributes (I don't want to get my dropdownlist attribute in my category page) – RPDeshaies Mar 12 '14 at 13:54
  • Ok, now I got it. Yes: All the attributes are loaded which are marked as "show on product list" which means used_in_product_listing = 1 in catalog_eav_attribute, so just switching the attribute off (in backend or in setup script) changes this behaviour – Fabian Blechschmidt Mar 12 '14 at 14:00
  • Thanks for the heads up ! But since I needed my attribute to have a custom price, a weight and a quantity, I used the plugin cited above. Do you know it ? If yes, do you know where I could set the these two variables for my attribute ? – RPDeshaies Mar 12 '14 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.