Implementing SEO friendly URL's in uCommerce for Sitecore - sitecore

I'm wondering whether anyone has come across the following issue. We're currently working on a Sitecore website that uses integrated uCommerce to provide eCommerce functionalty.
Rather than passing category and product ids to a static url that maps directly to an item in the sitecore content tree e.g.
domain.com/category/?category=123
domain.com/category/product/?product=321
We want to be able to have URL's like follows:
domain.com/category-name/product-name
Generating this url shouldn't be too difficult if we use IUrlService provided by uCommerce.
Is there an easy solution to get these sort of URL's to map to a particular item in the Sitecore content tree and ensure the uCommerce context is updated accordingly?
Thanks in advance for any help received.

I am using the Sitecore Commerce Connect framework and am using wildcard URLs for my products and categories. Since my products often appear in several categories, I have kept the structure of having separate URLs for products and categories to make sure that the URL for the product is not repeated if it appears under several categories.
Home/product/* is my the wildcard item for products
Home/category/* is the wildcard item for my categories
The wildcard manager will then allow me to render the product and category pages based on those pages where I just resolve the item in Commerce connect by the information provided in the URL.
The custom LinkManager will then provide the references to the correct URL when fetching a link for and item and it will not risk having the URL changed if I do changes to the category structure or add it in several categories.

Related

How might one implement Site-specific Tags?

My code shop is developing a multi-tenant Wagtail site, and we'd like each Site to have its own set of tags. We want this so that tags defined by users of Site A don't appear in the autocompleter or the "popular tags" listing for users of Site B.
Would this be possible with a custom Tag model? I'm thinking that we could prefix the tag's slugs with the hostname of the current Site, then filter them based on that prefix when pulling tags for the "popular tags" listing or the autocompleter.
If this is not currently possible, could Wagtail be monkey-patched to support it? If so, what code might need to change?
A custom tag model would be the way to go, yes. One issue you'd currently have to work around (logged here: https://github.com/wagtail/wagtail/issues/3577) is that the autocomplete view is hard-coded to use the default tag model, so to use a custom one you'd need to duplicate that view in your own app, along with the AdminTagWidget that references it.

URLs of pages on which item appears in Sitecore

In Sitecore, how can I get a list of all pages on which an item appears? Thanks
Internally Sitecore maintains a database of references between Items called the Link Database. You can query this by using the "Links" dropdown on the "Navigate" tab on the Content Editor ribbon. That may give you the information you need.
(You can also query the Links Database via code - See example code on http://laubplusco.net/sitecore-item-extensions-get-referrers-as-items/ for one example of doing this - or the docs in SDN)
If the relations to your target Item are via selection field types (multilist, treeview etc) or via the DataSource property of Renderings/Sublayouts/etc then you should be able to select the item you're interested in and click the "Links" dropdown to see a list of the relationships Sitecore has recorded. This will list system relationships (which template does this item use) as well as the sort of relationships you're interested in where one item points at another item.
Note that this approach cannot tell you about some types of relationship: the most common sort being ones which are calculated at runtime. (EG API queries, or searches) because those relationships don't exist in the Links Database.
-- edited to add --
You ask about getting the URLs for these Items. In code you can get the URL for an item by calling LinkManager.GetItemUrl() and passing in the item you're interested in. That gives you the public website URL, rather than the Sitecore Item Path that you'd get directly from the Link Database.

Sitecore query filter issue

I am new to Sitecore and have come across a situation for which I haven't been able to find any documentation.
I have two blogs, Blog A and Blog B. Each Blog has various Categories.
Now, I am trying to create a template, where the user can select a Blog and then select Categories. For Bog Selection, I have used a Droptree and for Categories Selection, I have used a Multilist. I can fetch all the Categories using the following query :
query:../../..//*[##templatename= 'Category']
But, this fetches all the categories belonging to both the Blogs. What I want to do is - when the user has selected the Blog in the DropTree, I want to populate the Multilist only with the categories belonging to that particular blog.
Any ideas? Thanks!
I don't think Sitecore Query supports what you're after (basically using a field value from another item as a variable in a query, if I understand correctly).
There's a guide to the whole of query on SDN: http://sdn.sitecore.net/reference/using%20sitecore%20query/sitecore%20query%20syntax.aspx
I think I'd look at creating a custom field type that inherited from multilist and overriding the logic that pulls items based on the data source - then you can filter it programmatically however you want. There are various blog posts available on that subject, such as http://gettingtoknowsitecore.blogspot.com/2010/03/custom-fields-part-1.html
You could also consider putting categories as subitems under each blog to drastically simplify the whole thing - then you could simply use a relative query or an ancestor-or-self query without anything custom.

Django Admin Limiting results based on URL

I'm working a conference registration page. The system can allow multiple conferences to be registered for and used.
I'm using the admin to manage the conferences, but I need a way in the admin system to view only the people registered for a given conference. I know I can use list filters, but I was wondering if I can somehow use the URL.
For example, is it possible to do something like this? /admin/appname/modelname/SomeConference and only have that show the instances of that model associated with that confernece?
This is what filters are specifically for.
If you look at what happens when you activate a filter in the Admin, it just updates the URI to include a lookup value:
http://example.com/admin/core/model/?model_id__exact=1
So "technically", yes, there's a way to do this just using a URL.
Because that's how filters work in the first place.

Featured Products linking to different url

I have assigned some featured products in my homepage and somehow the link to product is different from that of my menu.
For example:
From menu:
http://www.example.com/store/products/littleshirt
From featured products section:
http://www.example.com/store/littleshirt
I am using opencart extension menu but I don't supposed that is the source of this problem.
I need the URL to point to same location as the url for featured product link to the product nicely but the side product menu only display parent categories.
Is there anyway to resolve this?
The "OpenCart Featured Products and News" Module is a jquery based open cart module which is shows the Selected Featured Products and/or News or relevant posts
OpenCart featured products and news is useful and has a nice plugin.
http://codecanyon.net/item/opencart-featured-products-and-news/4368564?ref=wpproducts
Known problem for me. Using canonicals referencing the desired URL for these duplicates is sort of a solution for this problem. For example:
http://www.example.com/store/littleshirt
contains a canonical to the desired URL:
http://www.example.com/store/products/littleshirt
This will prefent search engines from indexing/crawling the duplicate page and your correct/desired page from losing metrics.
p.s. I had to change the URL's to example.com for my post to get through.