Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Templates, Stylesheets, Page Layout / Is there a way to create a "select all" option at top of dropdown list?

Is there a way to create a "select all" option at top of dropdown list?

10 Aug 2012, 4:15 PM
#1
doktorfroyd avatar

doktorfroyd

New Zenner

Join Date:
Aug 2010
Posts:
14
Plugin Contributions:
0

Post #1 by doktorfroyd

I want to have dowloadable .iso files on my website. I use winrar to create downloadable parts that are 100mb each. Since some of my .iso files are 3 - 4 gigabytes in size, so this would result in more than 15 checkboxes for the customer to select one by one. It also looks a little sloppy and unprofessional to have a big cluster of boxes at the bottom of the product description. Does anyone know a way to create a "select all" option at the top of a dropdown list? As in, the customer checks off the top box, and the rest below get automatically selected also. Using the existing "Option Name Manager", "Option Valued Manager", and "Attributes Controler" tools, I could not figure out a way to do this. I want to bundle the values "download part 1, download part 2, download part 3 etc. so that one click selects them all. Is there a line of code that I could enter in my Zen Cart files that would accomodate this? If so, where would it go?

If anyone could help me with this, it would be greatly appreciated

16 Aug 2012, 4:46 PM
#2
doktorfroyd avatar

doktorfroyd

New Zenner

Join Date:
Aug 2010
Posts:
14
Plugin Contributions:
0

Post #2 by doktorfroyd

Somebody? Anybody?

16 Aug 2012, 6:52 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #3 by drbyte

If you link each file to a SEPARATE optionName+optionValue pair, then you can set the attribute to be pre-checked

If I recall correctly, that's explained here: http://www.zen-cart.com/content.php?113-how-do-i-make-products-downloadable or here http://www.zen-cart.com/content.php?99-how-do-i-add-attributes-to-my-products

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

17 Aug 2012, 4:50 AM
#4
joneshopes avatar

joneshopes

New Zenner

Join Date:
Aug 2012
Posts:
2
Plugin Contributions:
0

Post #4 by joneshopes

i have not understood the technique.
please explain i wanted to make birthday card maker software where i need that

17 Aug 2012, 6:40 PM
#5
doktorfroyd avatar

doktorfroyd

New Zenner

Join Date:
Aug 2010
Posts:
14
Plugin Contributions:
0

Post #5 by doktorfroyd

Thanks DrByte! I have in fact figured out how to make options/values pre-selected before they're added to the cart. I think I need to re-word my initial question though. I put "select all option from a dropdown list" but I think checkboxes are probably the only way to go for what I'm trying to do.

If I have a product called "monkeybuscuits", I want to have an option - let's call it "monkeybuscuitsDivX" - that has fifteen .rar file parts, which means fifteen checkboxes involved "part1.rar", "part2.rar, "part3.rar" and so on and so on. Why not just make them all required and therefore preselected so that all the customer has to do is click "add this to my cart"? Because there will also be another option "monkeybuscuits.iso" that's going to have twenty .rar file parts, therefore twenty checkboxes of it's own. If I make them all preselected, the customer's not going to be able to choose only one of the options unless he manually unchecks a whole bunch of boxes.

There must be a way to modify one of the Zen cart .php files on my server so that I can create a "select all" checkbox. Probably a very basic code for those who know how to write it, and I think I'm going to educate myself in .php, but I'm hoping someone could help me with this one specific request as I'd like to impliment it asap.

18 Aug 2012, 12:35 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #6 by drbyte

As the system is architected right now, I think you'd still need to have all the 15 and 20 separate checkboxes (actually radio buttons are better, because they technically can't be deselected) for each "file".
But then you might be able to use some custom jQuery or other fancy javascript stuff to insert some buttons onto the page that invite the user to click to auto-select all the buttons for one file-format vs the other.
But that's all pretty much outside actual Zen Cart core code, and more just custom templating and javascripting. And actually fairly complex because all the attributes on each product are built dynamically and so the javascript will need to take all that into account in order to know what items to "check" etc. Not something you're gonna write overnight.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.