Make a custom field as a range - like "Price" is as default in Bigcommerce - bigcommerce

Hi I am new in Bigcommerce can I make any custom field or field as a Range and filter data base on that range.

Depending on what functionality you're needing from this custom field, you may be able to use it for the 'price range'. The value type is string, so this does not accept an array of multiple values, you can see this in our API reference documentation. If you're just needing to use custom fields to render the text on a template or so, this could work, but if you're needing more functionality from it, it'd be best to use something else.

Related

How do I make the properties of an anonymous type dynamically change from the user input?

If I Have The following code:
Dim L = From item in _list
Group item By item.Name
Select New With {.Property = Name}
The problem is:
I want to generate a grid based on this grouping, the grouping is specified by the user, so the .Property will be a column name that user specified as the grouping property already I made the Group By depend on the user in my original code, but I could not make the .Property dependent so if the user specify to group the list by Name I want the .Property to be .Name
So, I want to make the .Property determined, any help please?
The fields of anonymous types must be defined at compile-time, so there's not a way to dynamically add fields at run-time. Besides, you wouldn't know what fields are available at compile-time, so you wouldn't to be able to write any code against them.
I would say you should use a different structure to represent the data. A Dictionary is the first type that comes to mind.

dgrid sorting based on "get" function

I have grid with columns with get method (an optional function that, given a data item, will return the value to render in the cell). I want to use values of this function for sorting purpose. What is the right way to do that?
No, It is not possible. The sorting is done on the data in Store/Collection. whereas, the get method is related to the particular column of the grid and is called while rendering. Sorting is done before the rendering of grid.
You probably would want to add a new property to the data/store with the values in the get function. apply sort on that property.

How to add text to the _content field in a Solr index for a Sitecore implementation?

This is for a Sitecore 7.5 - Solr 4.7 implementation. I would like to be able to modify the text that is stored in the _content field in Solr. I believe that somehow that Sitecore aggregates all of the content fields for an item in the _content field in the index. (I think that is correct) At index time I would like to be able to write my own code that could potentially modify the text that is stored in the _content field in Solr. Is this possible? Any ideas how I would go about this?
_content is a computed field, which means the value is resolved at the point that the item is crawled. You'll see the computed field is defined in your config:
<field fieldName="_content" returnType="string" type="Sitecore.ContentSearch.ComputedFields.MediaItemContentExtractor,Sitecore.ContentSearch">
<mediaIndexing ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/mediaIndexing"/>
</field>
I recommend decompiling the class specified in the type attribute to see what it does. Then you can create your own computed field class (or inherit from that one), and replace the type attribute.
Computed fields are really quite simple to work with. They implement IComputedIndexField which requires a ComputeFieldValue method. The method accepts an argument of type IIndexable (in most cases the concrete class is an Item) and is called every time an item is crawled.
So in the ComputeFieldValue method you could cast the Iindexable to an Item, then return a concatenated string of all the field values you want to include from that item.
See here for more on computed fields:
http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/03/sitecore-7-computed-index-fields.aspx
From what I understand, you can add another (separate) _content field with your own IComputedIndexField implementation. The resulting values from all added fields with the same name are aggragated.
See also: https://kamsar.net/index.php/2014/05/indexing-subcontent/ and https://andrewwburns.com/2015/09/03/appending-to-the-_content-field-in-sitecore-search-7-2-and-7-5/

How do I use a GtkComboBox with objects, as opposed to strings?

The usual use for a combo box is to let it display options to the user, and then you get an OBJECT out of it. In Win32, you do it by using the CB_SETITEMDATA and CB_GETITEMDATA messages, casting between int and object pointers. In XAML, you set up a data template and the item in the list IS the object.
What is the Correct way to get this effect with a GtkComboBox?
GtkComboBox normally uses a GtkListStore as the underlaying model.
You need to create one with an extra column for the object you want to store and as you insert new items in the combo's model you also need to provide the object you want to associate with that row/item.

How to use GtkTreeView correctly

I am using a TreeView with a ListStore as model. When the user clicks on a row I want to take some action but not using the values in the cells, but using the data I created the row from...
Currently I have the TreeView, the TreeModel (ListStore) and my own data (which I ironically call model)..
So the Questions are:
Is it "right" to have a model - an object representation of the data I want to display and fill a ListStore with that data to display in a TreeView, or would it be better to implement an own version of TreeModel (wrapping my data-model) to display the data?
And also:
If someone double-clicks in a row I can get the RowActivated event (using C#/Gtk#) which provides a Path to the activated row. With that I can get a TreeIter and using that I can get the value of a cell. But what is the best practice to find the data object from which the row was constructed in the first place?\
(Somehow this question got me to the first one - by thinking would getting the data object more easy if I tried to implement my own TreeModel...)
It's quite awkward/difficult to implement TreeModel, so most people simply synch the data from their "real" model into a TreeStore or ListStore.
The columns in the store do not have to match the columns in the view in any way. For example, you can have a column that contains your real managed data objects.
When you add a cellrenderer to a TreeView (visual) column, you can add mappings between its properties and the columns of the store. For example, you could map one store column to the font of a text cellrenderer, and another store column to the text property of the same cellrenderer. Each time the cellrenderer is used to render a particular cell, the mappings will be used to retrieve the values from the store and apply them to the properties of the renderer before it renders.
Here's an example of a mapping:
treeView.AppendColumn ("Title", renderer, "text", 0, "editable", 4);
This maps store column 0 to the renderer's text GTK property and maps store column 4 to the editable property. For GTK property names you can check the GTK docs. Note that the example above uses a convenience method that adds a column, adds a renderer to it and add an arbitrary number of mapping via params. To add mappings directly to a column, for example a column with multiple renderers, pack the renderers into the column then use TreeViewColumn.AddAttribute or TreeViewColumn.SetAttributes.
You can also set up a custom data function that will be used instead of mappings. This allows you to set the properties of the renderer directly, given a TreeIter and the store - so, if all the data you want to display is trivially derived from your real data objects, you could even have your store only contain a single column of these objects, and use data funcs for all the view columns.
Here's an example of a data func that does exactly what the mapping example above does:
treeColumn.SetCellDataFunc (renderer, delegate (TreeViewColumn col,
CellRenderer cell, TreeModel model, TreeIter iter)
{
var textCell = (CellRendererText) cell;
textCell.Text = (string) model.GetValue (iter, 0);
textCell.Editable = (bool) model.GetValue (iter, 4);
});
Obviously data functions are much more powerful because they enable you not only to use properties of more complex GTK objects, but also to implement more complex display logic - for example, lazily processing derived values only when the cell is actually rendered.