+ Reply to Thread
Results 1 to 2 of 2

Thread: Control Panel: Reduce html burden of Options list for Ediot Product pages

  1. #1
    Client coastalrugs's Avatar
    Join Date
    Dec 2007
    Posts
    171
    Squirrelcart version
    v3.2.0

    Control Panel: Reduce html burden of Options list for Ediot Product pages

    This is more so a long-term observation than an immediate request. Please take note of the following when you focus your attention on revamping the CP:

    My store currently has 800+ Options. As the CP works now, ALL of those options are added to every Edit Product page in the Control Panel.The Edit Product pages have ballooned to 1.2MB in just the single html file.

    **It is not too bad when Categories, Options, Option Choices, etc.. are listed inside a menu, as the html is only:
    Code:
    <option value="294">Some Text Here</option>
    That repeated 800 times really can't be condensed much more.

    Balloon that to this code 800 times:
    Code:
    <li><a class="valign_middle" href="#" id="opt_134_link_134"
                        onclick="
                            // set var equal to the field that controls the state of this option
                            var optFld = document.getElementById('options[134][state]');
    
                            // if option is currently off
                            if (optFld.value == 'off') {
                                // track state
                                optFld.value = 'on';
    
                                // this adds the option table row via AJAX
                                addProdOption(134);
                                
                                // toggle image visibility
                                getFirstChildElement(this).style.visibility = 'visible';
    
                            } else {
                                // track state
                                optFld.value = 'off';
    
                                // this removes the option table row via AJAX
                                delProdOption(134);
                                
                                // toggle image visibility
                                getFirstChildElement(this).style.visibility = 'hidden';
                            }
                            
                            event.cancelBubble=true;
                        " 
                        opt_value="off"
                    >
                        <img src="https://www.example.com/squirrelcart/images/cart/tiny_check.gif" style="visibility: hidden" border="0" /><span title="Option Title">Option Name</span>
                    </a>
                    <input id="options[134][state]" name="options[134][state]" type="hidden" value="off"/>
                </li>
    Perhaps this could be reduced to a single function in the onclick event of something like:
    Code:
    ...onclick="optionListView(134); event.cancelBubble=true;"...
    With of course the appropriate singular function definition in the <head>

    This would immediately reduce the html burden by about 60% for each Option; dropping the example above from 1.2mb to 500-600kb.

    If you find time to integrate this into the current CP, great. If not, I will tweak my own installation to suit my needs in the meantime. (Again, nothing is broken - just not optimal). But please make a note of this situation and others like it where repetition is involved; i.e. the comments are nice, but they are similarly repeated for each Option.

    Thanks.

    PS: I think this is partly to blame for some last few rare form posting issues that I had been experiencing, as the page was not even fully loaded before I had finished my edits and tried to commit changes. And when trying to submit before the page fully loaded, I think severing the partial download and switching to POST the page somehow causes a stalemate and eventual timeout.

  2. #2
    Squirrelcart Staff Jamie's Avatar
    Join Date
    May 2002
    Posts
    6,719
    Squirrelcart version
    v3.3.7
    Thanks for the suggestion. Honestly though, if you see anything else like this that is strictly a performance based issue for the control panel, it may be a waste of your time to report it (at least until after v4). I certainly appreciate the feedback, but we will be going over the entire control panel with a fine toothed comb so to speak to address this type of thing.

    Much of the control panel code is old, or based on pre-existing old code that could benefit greatly from a rewrite.

    Version 4 is a ways off, but if you are interested when the time comes please sign up for our beta program for v4 when we announce it. We would love to have your feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts