Spree : Multiple dropdowns for product options - ruby-on-rails

What is the current best practice to turn product options into multiple
dropdown lists?
For example a T-Shirt has a Size and a Color option.
How can I use 2 dropdown lists on product pages for them?
Is there a guide, or documentation about this?
The radio button based solution is not that user friendly, and can be quite
complex (and long) if there are many options.
So basically what I would like to do is display the options separately, and
not as a variant like Green color - S size but like this:
1st dropdown: Color: Green
2nd dropdown: Size: S
At the end of the day it doesn't have to be a dropdown, just would like to
display the options separately in the most user (buyer) friendly way.
github.com/tuxdapenguin/spree_variant_options
This plugin might work but it looks like it hadn't been updated in a while

Related

MVC 5 Filtered Lists with dynamic labels

I am relatively new to MVC and I'm looking to add a feature to my web application but I am in need of some advice to point me in the right direction.
I am looking to add filtered lists (Cascarding dropdown lists) that have a label associated with that particular list for example:
How are you Feeling today? <--- label with
Dropdown list:
Happy,
Sad
User selects Happy
Why are you happy? <-- label generates based on users feedback. This also has a dropdown list with options.
Any advice on how to achieve this would be greatly appreciated.
Thank you in advance.
Javascript. Either by creating new dropdown lists on the fly or by revealing previously hidden ones.

Dynamically Changing Simple Form Select on Another Select Change

I have a requirement to modify a select box based on changes made in a previous selection.
In this case I have a simple_form form with a country selection. If a user selects a particular country, a second select field will contain business entity types for the selected country.
For example, in Australia you'd have Sole Trader, Pty Ltd, etc. In the US, you have LLC, S Corp, C Corp, etc.
What I need is to be able to dynamically change the second selection box when the user chooses or changes the selected country.
I'd appreciate your suggestions on how to proceed. I'm using Rails 4 with jquery. Is JavaScript the best/only way to go here, or are their other options for doing this with Rails? Cheers.
Javascript/Jquery is the best way to do this. Bind a change event to your country select list and based on selected country, change the option tags of business entity
Hope this helps!

Spree Commerce: Multiple colors with its own SKU

This is example of what I need:
http://www.pruneshop.com/billeteras/fichero-de-cuero-p100602vg.html
http://demo.commerceguys.com/dc/catalog/coffee-holders/mug
What I need: In each post, it has multiple colors represented by the image of each color, each color has its own SKU.
In lots of Spree Commerce example, I cannot find any example that doing what I need
This example built on Spree Commerce. It looks similar to what I need:
http://onlinestore.thurley.com.au/products/velvet-maxi-dress-velvet-cinder
But even it looks similar, the "Color" is actually a link to other post. when clicking "black" from dropdown, it redirected to http://onlinestore.thurley.com.au/products/velvet-maxi-dress-velvet-black
apasajja,
This should be handled out of the box with OptionValues and Variants. Set up your optionType of "Color", your OptionValues for each color, and a variant for any of the relevant colors. Each Variant holds a SKU value.

Combo box that can open quickly with lots of items

I've got a custom combo box descended from DevExpress's TdxfCustomComboBox. It works really well in most cases... and then I got a report from a client that when they try to open it it takes 3 seconds for the popup to appear. After a bit of investigation, I found out that that's because their database has about 12000 items that it's trying to populate, and it recreates the popup window and populates it each time.
This means that StdCtrls.TListBoxStrings.Add, which contains this line, gets called 12000+ times, once for each string.
SendMessage(ListBox.Handle, LB_ADDSTRING, 0, Longint(PChar(S)));
Processing this line requires several trips through multiple layers of message handlers and really bogs things down. I find this kind of silly since only about a dozen or so items are actually displayed in the popup window at once anyway. Does anyone know of a combo box control that doesn't require this sort of pre-loading and can scale?
EDIT: Unfortunately, making it not load 12,000 items is not an option here. The number of items in the combo box is based on the number of items in the database, and they all have to be available. Neither is making it into something other than a combo box. Not enough screen real estate for that.
the best solution that I can think of is using a TButtonEdit and when you click on the button a TVirtualStringTree(which is lightning fast) will popup containing the items, whenever the user clicks on a item the popup will close and the selected item will be displayed in the TButtonEdit's text property -- this can be achieved in a matter of minutes(5-10)
Another possibility: can you create the combo box at start-up and keep it around, reparenting it when you need it on this form?
Failing that, could you load the strings into another string list and .Assign to the combo box as necessary? (I'm not familiar with TListBoxStrings.)
Some options.
1./ Do you really have to populate with 12,000 items? can you use some filtering scheme and only return a subset of that data?
2./ Do you have to use a Combo box? do you have the screen real estate to use a virtual list view instead? (handle the storage and paging yourself)
3./ Create your own Virtual combo box...model the virtualization techniques on the virtual list view.
4./ Cheat...rather than a combo box, use a edit box with a "browse" button that opens a list that you can fill dynamically.
As far as I know there is no mode that lets you do this already with the dev express (or native) combo boxes.
ComboBoxes and ListViews experience performance degradation on an exponential curve, becoming really bad with thousands of items. Use Virtual lists whenever possible, if you have more than a few thousand.
Maybe you can use a LookupComboBox (also from DevExpress). Here you can load the data into a single DataSet where the Comboboxs are refering to it.
Honestly, three seconds sounds pretty good for loading 12000 records into a control like that.
Does the drop-down have to descend from TdxfCustomComboBox? I think you'd be better off rolling your own combo-box-like control here that would page through an associated dataset as required rather than pre-loading all the strings. Ideally you could build filtering into it too.
This is just a foolish design! A better option is to add a button which the user can click on. When he clicks on it, a new form opens with a connection to the options table and it will display all the options in the way you prefer. The user then has to select one, could use pageUp/PageDown and all kinds of filters because -of course- you'd be using a DBGrid to display the options and then the user clicks the "Select" button which will return the selected option back.A new form would provide all the space you would need!
From a design viewpoint, anyone considering a dropdown list with 12.000 options will be considered a fool by the users of this software! It would definitely make it very unpopular, no matter how fast you make it! Why, you say? Because users can't find what they need in a list that big without additional search options!

Why would a SharePoint lookup menu require a double-click to select an item?

I have a SharePoint feature which programatically creates 3 lookups in a custom list, one from each of 3 different lists via extremely similar CAML markup.
The only differences in the CAML are the List, ID, Name, DisplayName and StaticName properties yet one of these lookups looks slightly different (has a slightly more "modern" drop-down arrow) than the other two and this same menu requires I double-click in order to select an item instead of single-clicking as I do with the other lookups.
Might anyone have seen this before and have an idea of what I might look into to make this lookup operate as a single-click menu?
The style of dropdown displayed is usually related to the number of items, although it also renders as a standard select element when viewed in firefox.
For any other field type it would make sense to create a custom field control, but due to code that expects things to be named "Lookup", lookup fields are next to impossible to extend.
The best way to customize a specific field is probably with javascript/jquery. When you click on the dropdown arrow, ShowDropdown (in core.js) is called. This creates a select element with options set from the pipe delimited list in the choices attribute of the textbox.
Add some code to the page so that on load EnsureSelect and FilterChoice or similar are called to create the select element. Set properties on the textbox and select elements so that the textbox as hidden and the select element is a visible dropdown. Have SetCtrlFromOpt called on change rather than on blur/double click so that the control that the server will read and save is properly updated.
The same approach could be used to keep the combo box but add a click event to set the value rather than requiring a double click.
How many items has the source list of every lookup field?
Lookup fields shows a "Combo" when the source list has 10 items (I'm not sure if 10 item is the exact limit). When the source list has more than 10 items the lookup field shows a "ListArea" control that works as you said.
I have exactly the same problem. One difference I have noticed is that the one listbox that requires a double-click is a lookup field, whereas the one that doesn't is a choice field with pre-populated choices. Don't know if that helps.

Resources