How to search Sitecore using Glass Mapper auto generated classes? - sitecore

I am trying to implement a faceted navigation search using Sitecore 7.5, Solr and Glass Mapper. Currently I am using code generation using TDS and Glass to auto-generate classes for every data template in my project. I have read tutorial 25 on the Glass Mapper site but I am very confused. The Glass tutorial seems to suggest that I need to create a completely new class to represent a search result. Let's say that I have a data template called Product. If I am building a Product Search page, ideally I would like to be able to have my search code return back a list of Product objects.
Is there any way of doing that? Or do I have to create a separate class that inherits from SearchResultItem? Seems strange that I can't use my auto-generated data classes for my search results.

You can either edit the T4 GlassV3Header.tt template to make the GlassBase inherits from SearchResultItem. Or you can follow the "Using custom result class" section in tutorial #25 to use the generated classes directly with the search.
Check out this link for more details:
https://stackoverflow.com/questions/28429752/sitecore-glass-mapper-tds-code-generation-and-searchresultitem

Related

How do you make a report template for a single Enterprise Architect diagram?

I have a package with about 25 diagrams in it. I have used EA templates to make a package report that gives the name and notes for each diagram. However I want make a more specific report that can generates the report for just one diagram containing the description from each element in the diagram. Is this possible? It does not seem like diagrams have anywhere I can generate reports from.
UPDATE: I am currently trying to figure out how to do this with Document Options>Except where Query excludes Package:>Custom SQL but cannot get it. Here is my SQL statement:
SELECT t_diagram.ea_guid & t_diagram.Name AS [DesiredService-Hyperlink]
FROM t_diagram
WHERE t_diagram.Name = 'Diagram_Name'
I tried putting this in the Report's Custom SQL, that didn't work. Then I tried putting it in a fragment's Custom SQL with the following in the template itself
custom >
{DesiredService-Hyperlink}
< custom
This also did not work. I have been trying to go off of various documentation and YouTube Videos. If anyone could point me in the right direction that would be great.
Enterprise Architect document generation is based more on the model structure then on the diagrams.
The easiest approach would be to put each diagram in a different package or nested under a specific element, even if only temporary to generate the document.

How can I boost a particular field using Sitecore 7.5 and Solr 4.7?

I have a field called "Page Title" that is part of a base template that I called "Base Titles". All of my content pages inherit this base template. I would like to boost the Page Title field in my search results so that if the search term is found in that field it is scored higher than other matches.
I can't figure out how to do this. I found this blog post by John West. However that seems to suggest that in order to boost a field I have to edit a config file?
Is that correct? So there is no way within the Sitecore UI to edit boosting values for a field? It has to be done by a programmer in a config file?
There is no in-built functionality for this. But off the top of my head I guess it's possible to approximate it.
For example. If your content editors have access to the Templates section of the Sitecore tree you could extend the "Template Field" template. Add a numeric field called Boost.
Then on any field in a template they could assign a numeric value
When you write your query you could look up the assigned value from of the associated field in the template and use the Boost method to apply it to the predicate.
Of course there's a bunch of different variations on this approach. This is really just the bare bones.
Sounds like you have the makings of a good marketplace module on your hands.

What is the alternative for sc:EditFrame in Sitecore MVC

The project I'm working on is a new Sitecore 8 site build using MVC and with a demand for page-editor support. The simple fields are being addressed with the FieldRenderer.render() method, but there are also some droplink and multilist fields that need to be available in page editor.
In webforms you could use the sc:editframe control for that, but how can I get the same functionality while using Sitecore MVC?
Just an FYI in Sitecore 8.2 there is support for edit frames:
#using Sitecore.Mvc.Extensions
Then
#using(Html.EditFrame(...)) {...}
If not already, I highly recommend using GlassMapper to map your Sitecoce object to strongly typed objects in your code.
With Glass, you can then use the BeginEditFrame concept to replace the sc:EditFrame functionality of WebForms.
To take it a step further, look to implement edit frame buttons (this link is not Sitecore 8 specific, but the method to implement edit frame buttons is the same) in the core database to allow a very-friendly Experience Editor experience.

How to use a QTreeView Model to display a list of files/folders get through mtp stack

I'm currently building an application which need to access to a device through the MTP stack.
I'm developping the code in c++ and Qt to easily be able to port the code on different platform.
I have based the Ui on TreeView to display the folder and ListView to display the list of files of the selected folder.
Most of example are using :
model->setRootPath("F:/Qt/GUI/files");
treeView->setModel(model);
treeView->setRootIndex(model->index("F:/Qt/GUI/files"));
All these models are based on model which accessing to the local HD but in my case, I need to do it through list of folders/files using MTP Api. The backend is working, I mean accessing to the device is ok but I'm still thinkin on how to display the tree of folder and create a model.
Thanks
Please, refer to the Qt Model/View tutorial and Model/View programming.
In general you shall create new model and in the bare minimum override a couple of pure virtual functions.
Since it's a Tree structure, you should subclass QAbstractItemModel.

OpenCart: Creating a standalone Ajax page

I'm working on an OpenCart project. I'm creating a "quick view" effect on the special products on the homepage where if people mouse over the item, a popover displays including a bigger image and an add to cart button.
I'm trying to create an Ajax page where I can use in my js to call and get the details of the product.
My ajax file works fine as far as looking at the passed query string and returning some data; I just don't know how I can include the opencart core files, or module files where I can use to get the details.
I hope I'm making sense.
The easiest and best method would be to use the framework itself and simply use the methods provided to get the data you want. You can read the basics about how to use the framework here assuming you are a php developer and have a basic grasp of OOP and MVC