Spartacus Global Breadcrumbs Nested Hierarchy - spartacus-storefront

We have a requirement to show nested breadcrumbs for product category pages. In the standard Spartacus template we have observed that the breadcrumb data is populated by the Search API.
How would we best approach adding a nested hierarchy of breadcrumbs by extending the standard API and/or Spartacus?

The breadcrumbs on the product listing page are data-driven, specifically by the active facets from the search data. There are various approaches to influence the data or resolve additional breadcrumbs:
Introduce breadcrumbs in the backend, either by indexing an alternative SOLR index, or populate additional data. This would make it transparent in Spartacus. We're in the wrong channel to discuss this in more detail, but this might be in your comfort zone.
Inject a custom converter in the Spartacus adapter layer, where you add additional breadcrumbs to the ProductSearchPage.breadcrumbs model.
Customise the CategoryPageMetaResolver.resolveBreadcrumbs and resolve additional breadcrumbs.

Related

What is the best way to code a full Dojo web application?

I am trying to code a medium sized full web application based off dojo.
I have a basic BorderContainer that is placed at the document.body.
In order to make code maintainable and easy to read, I want to put fully contained widgets/modules in each of the sections. That can be simply added by a couple lines such as...
var topTabs = new TopTabs();
top.addChild(topTabs);
And then I want to stitch them all together so that they can invoke work in each of the other widgets, in order to follow the MVC model.
So for instance, one example that I would like to insert the following widget that is fully contained into the top section that looks something like...
So my question is....
What is the best way to create these fully defined and encapsulated widgets/modules?
Since my widgets will also contain other Dijits, then are template based widgets the route to go? Or is it better to create widgets/modules that are purely programmatically defined?
Thanks
Depends how much you are familiar / comfortable with declarative/html (templated) versus programmatic/javascript. You can definitely go both routes;
I seldom use templates, which are static by nature and mean two set of entities in two languages, usually two files, to account for. Besides, with dojo/dom-construct & dojo/dom-style, I have an effective dynamic replacement to html templates, allowing to build self-contained complex widgets
jc
Your going to want to read about making custom dijits (widgets) - https://dojotoolkit.org/documentation/tutorials/1.9/recipes/custom_widget/
templates vs programmatic is more of a personal choice. templates are much easier for a UX (non dev) to work with. i like to use templates as it reduces the clutter in my js files i prefer to keep things separate logic (js), style (css), and structure/layout (html).

Are there any specific scenarios to use Liferay search container over Dandelion datatables framework?

Are there any specific scenarios to use Liferay search container over Dandelion data tables framework,when Data tables provide far better collection of features(such as multi column sorting,filtering,searching,i18,etc) and is easy to integrate too.To rephrase my question,should data tables be preferred over search container for all scenarios.
It's 100% your choice. Search Container is styled as every built-in list of entities within Liferay (because Liferay uses Search Container). If you use it or choose any other method/framework/technology is strictly your choice.
Make your choice based on
appearance and level of visual integration you'd like to have
familiarity with the framework
suitability for the job
maintainability of the solution for whoever is going to maintain your code
assumed stability (or level of maintenance) for your solution of choice
If you end up using either one of the proposed solutions or yet another one: So be it. For your future maintainers sake, just make sure to choose one and standardize on it.
If you're customizing Liferay's UI, you might still need to understand Search Container, but that's a different story.

Best way to get data from Rails 3 to Kendo UI

What is the best way to get data from Rails 3 to some of Kendo UI's data intensive widgets (mostly grid and graphs)?
Lets say I have a Rails model which has data I want to show in Kendo's grid. I imagine I will be passing that data via json. But there seems to be many approaches to passing json data (gon, backbone.js,etc). There is also the rails api approach (but I need the full rails for the other pages).
I was about to sit down and learn backbone.js. Is this a good approach?
Thank You
You just need to create an action that will serve your data as JSON. You do not need to use other JavaScript libraries. Take a look at this project, I think you might find it useful.

The correct way to manage data for display in the YII framework?

If I have a shop that displays a bunch of products and I get these products returned from the database as an array, is there a specific way that you can display this data using YII templates or is it sufficient to simply loop through the array and print it out in "divs" as needed?
I know if I just spit it out in DIVs, it would work, but is it the "correct" way to do it according to the framework?
For this there are zii widgets, and also many extensions.
I think for a store CListView will be a good start. There are many wikis that explain a lot about CListView.
You can easily extend it and add functionality.
Zii widgets provide pagination, sorting, and custom styling too, when used alongwith a data provider.

Knockoutjs and Selenium testing

Looking at Knockout examples, there is no real need for adding IDs to HTML elements. Creating a large form without the IDs seems to make it easy to maintain.
Though, this creates a problem with Selenium HQ. There is no way to uniquely identify elements on the form.
What are the choices? Is there another method for Selenium to select elements created by Knockout?
or will I have to assign IDs to elements?
I have reviewed other knockout and selenium questions. All of them had IDs defined for the HTML elements, when they started.
Thanks
Abhi
Short answer: Add ID's to your HTML elements.
Although you do not need these attributes in order for your website to function, you will make the life of your testers so much easier.
I've encountered the exact same problem in a project where a large ASP.NET MVC 4 application was created, that uses Knockout.js and Selenium extensively. For form elements, I relied on ASP.NET MVC utility methods to generate the output HTML in combination with data-bind expressions. ASP.NET MVC automatically generates unique NAME and ID attributes based on the backing model.
However, in all other cases where I had to render tables, display forms or dialogs, I ended up adding ID attributes to these HTML elements. If you think about it, this is a logical consequence of your requirements. Knockout is awesome because you longer need ID's and NAME's to wire your layout (HTML) and behavior (JS) together. However, other frameworks, such as Selenium, require these ID's to be present.
Yes, you could work your way around it with complicated and bloated XPATH expressions. But this will dramatically decrease the maintainability of your tests. In my experience, adding ID's to hundreds of HTML elements took less than a day and increased productivity of our testers by a manifold.
Remember, it may be nice to develop functional websites with as little HTML as possible. But if this makes your website untestable, you will lose more than you gain. Testability is non-functional requirement, but this does not mean it is not important!
You should add Ids to your html elements. your application will become more complicated and probably you'll need to bind multiple view models to different section on the same page, you'll need Ids. For example in ASP.NET MVC, you'll want to build a partial view to display all products you ordered, and you want to share this partial view all the way through the ordering process, you'll want your binding to this specific partial view section