Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option Selector Types #73

Closed
bhsmither opened this issue Jan 15, 2015 · 18 comments
Closed

Option Selector Types #73

bhsmither opened this issue Jan 15, 2015 · 18 comments

Comments

@bhsmither
Copy link
Contributor

bhsmither commented Jan 15, 2015

With respect to #62, I am working (actually on CC5216 and have yet to check if this applies to the CC6 codebase) to eliminate the hard-coded enumeration of option selector types. These types are located in the Catalogue class and every effort should be made to use them as they stand.

The code I am experimenting with is near line 270 (CC5216) in the file product.options.inc.php (as well as the template code in products.options.php).

PHP's get_defined_constants() seemed like the perfect solution, but it does not actually collect constants declared (as opposed to defined) in classes. So, using this suggestion:
http://us1.php.net/manual/en/function.get-defined-constants.php#84975
(be careful of the syntax error on line 5) placed in the Catalogue class, I can get this:

var_dump(array_flip($GLOBALS['catalogue']->get_class_constants()));
array (size=9)
  0 => string 'OPTION_SELECT' (length=13)
  1 => string 'OPTION_TEXTBOX' (length=14)
  2 => string 'OPTION_TEXTAREA' (length=15)
  3 => string 'OPTION_PASSWORD' (length=15)
  4 => string 'OPTION_RADIO' (length=12)
  5 => string 'OPTION_CHECKBOX' (length=15)
  6 => string 'OPTION_DATEPICKER' (length=17)
  7 => string 'OPTION_HIDDEN' (length=13)
  8 => string 'OPTION_FILE' (length=11)

From that, it is trivial to get the language phrases and populate the Smarty variables.

This brings up the issue that there is no code, as yet, to deal with the option selector types other than 0,1, and 2. So, prior to assigning the data to Smarty, it will be necessary to tweak the array.

Also to add the appropriate language strings for the rest of the selector types.

@abrookbanks
Copy link
Member

👍

@SemperFiWS
Copy link
Contributor

@hairy-dog
Copy link

Please can I add a request for radio-button option selections to be available. These are by far the most user-friendly,and experience shows that they do generate more sales and fewer order errors.

@bhsmither
Copy link
Contributor Author

I have emailed to CubeCart a diff file of what I have done so far in enabling more of the other types of form input types (radio buttons so far).

Maybe the file will show up here shortly.

@abrookbanks
Copy link
Member

Thanks for this. Just for my reference (sales ticket 101285).

@abrookbanks
Copy link
Member

Radio checkboxes have been implemented:
See commit: 6d2e7f8

@hairy-dog
Copy link

I'd like to use these but I really can't use the Foundation skin. What changes would I need to make to enable them in a v5 skin? Is it a big task?

@abrookbanks
Copy link
Member

It's fairly big. All code changes to the skin can be found in this repo. Please note that Foundation skin uses a recent jQuery. v5 is stuck on v1.7 so it may not be compatible.

@abrookbanks
Copy link
Member

I think the only one left to integrate may be "OPTION_FILE". I can't see a use for password, checkbox. The date picker could be useful but it would probably be dumb (as in allowing any date to be picked).

@hairy-dog
Copy link

A standard html5 date picker is easily good enough, future proof and easy to do.
Going down the jquery route makes no sense, even if you are already using reams of jquery.

I can see a lot of uses for checkboxes - they allow multiselect in a much more user-friendly way than a multi-select dropdown.

Password does seem unlikely to be useful

@abrookbanks
Copy link
Member

I agree about HTML5 to an extent. According to this site there should be 85% compatibility globally. http://caniuse.com/#search=date%20pickers is that good enough?

.. it depends on the merchant.

Personally I don't like the UX, browsers such as Chrome work with required fields for example. The jQuery Validation plugin in the Foundation skin is much friendlier and much more flexible.

Checkboxes would allow multiple options to be selected. CubeCart has no support for that right now so it would take more than just GUI changes unless only one checkbox was allowed per option.

@hairy-dog
Copy link

I don't understand. CubeCart DOES support multiple options. You can choose large, medium or small AND pink, green or blue. So you are choosing "large pink" or "medium green" - surely that's multiple options!

I accept that it doesn't support multiple option values, (large, pink and green) but there are lots of places where it would be good to be able to select one or more single-value options using checkboxes.

After all, that's how you select single-value options in the admin - for good reason!

@abrookbanks
Copy link
Member

Multiple selections per option. So for example:

Color: Green, red & Blue

As a drop down this would three options with one selectable.
As a radio this has three options one selectable.
As a check box it would have three options ALL selectable.

I'm sure it can be done but its not immediately simple.

@hairy-dog
Copy link

Yes, it'd need to only allow single-value (on or off) options to be set up as checkboxes.That would be really good if it can be done.

@abrookbanks
Copy link
Member

Agreed. :) 👍

@bhsmither
Copy link
Contributor Author

I can think of some example situations:

Bag of Fifty Party Balloons: Color choices []Red,[]Green,[]Blue,[]Silver,[]Black,etc
"Your favorite football team colors! Wedding colors! (Equal distribution not guaranteed).
CubeCart v6: Add'l Module Choices []Kurouto, []Mican, []Mobile, []PayPal, []FedEx, []UPS, etc
Chosen modules auto included in the download package

Mixed Nuts, Mixed Chocolates, that kind of thing.

@abrookbanks
Copy link
Member

Nice! Thanks Brian.

@Rob-Tea
Copy link

Rob-Tea commented Apr 7, 2016

Just wondering if "OPTION_FILE" is still on the cards (longer term). Its an option i really miss from zencart, i'm curently using a www.powr.io form to get round this (example here http://laserlab.co.uk/create-parts/wood/plywood-6mm-p10.html [bottom of page]), its clunky and looses the association to an order number. It would be nice to be core code rather that an extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants