Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevin 35 posts 159 karma points
    Mar 27, 2017 @ 12:25
    Kevin
    0

    URL slug not an exact match

    Let's say I have two products with the url slugs:

    Product 1: /my-product

    and

    Product 2: /my-product-extra

    If I browse to www.mymerchello.com/my-product I cannot be certain which product will actually be displayed. This seems to be an issue in

    Merchello.Web.Search.CachedProductQuery.GetBySlug(string slug)
    

    This code searches for the slug in the index but does not do an exact match. This appears to be a limitation/feature of Lucene I believe, not a Merchello issue. The index returns all matches (even partial as its Lucene) and the Merchello code does a FirstOrDefault so you get the product that is first in the index.

    So...is this now a problem for Merchello users? It was certainly an issue for me. I have solved the issue by creating my own IContentFinder which is based on GetBySlug but gets all Lucene matches. I then iterate through them manually looking for the exact match and then get that product from Merchello using it's SKU.

    I would be a happy to add this logic to Merchello.Web.Search.CachedProductQuery.GetBySlug(string slug) and do a pull request. It's only a few lines. But before I do, is this a required change or is the current partial match acceptable by design?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 28, 2017 @ 19:58
    Rusty Swayne
    100

    Hey Kevin,

    I think you may be encountering this issue http://issues.merchello.com/youtrack/issue/M-1279 ... what version of Merchello are you running?

  • Kevin 35 posts 159 karma points
    Mar 29, 2017 @ 07:54
    Kevin
    1

    I am using Merchello 2.3.0. I have looked at your fix. It is the same as mine except I have implemented a new class. Thanks Rusty.

  • Jcr 20 posts 130 karma points
    Apr 21, 2017 @ 17:07
    Jcr
    0

    Hey,

    I'm receiving a very similar issue as that to the OP.

    Within our umbraco solution, we are using the special umbraco property alias 'umbracoUrlAlias' to allow the content editor's to provide multiple Urls for a given node/page (not a merchello product node)

    Say for example we have a product with the Url slug:

    this-is-very-unique

    this product will be accessible on the following Urls:

    • site.com/this-is-very-unique
    • site.com/this-is-very
    • site.com/this-is
    • site.com/this
    • site.com/this-very-unique
    • site.com/this-unique
    • site.com/unique
    • basically, any combination you can think of using the above Url slug

    now say for example a content node with a value of 'unique' is entered for the umbracoUrlAlias property.

    Instead of getting the content node, you're getting the product. I'm presuming this is due to the merchello content finder / url finder are being called before the umbraco's.

    Basically, is this an error, or by design?

    Merchello version: 2.1.0 Umbraco version: 7.4.3

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Apr 24, 2017 @ 16:15
    Rusty Swayne
    0

    This was an issue http://issues.merchello.com/youtrack/issue/M-1279 - fixed in Merchello 2.4.0

  • Pete 213 posts 285 karma points
    May 17, 2018 @ 11:43
    Pete
    0

    Hey rusty/kevin

    I'm running multi language, and links to the product in a alternate language don't seem to work for me.

    I've tried a different render (url slug) value for a product in both of the two languages e.g: "myproducten" And I get a 404 error.

    But if I don't use that method of showing the alternate language product, how can I show the alternate language product details on a page? when the link to it was eg. /en/myproduct/ or for german(swiss) /ch/myproduct/

    So /ch/myproduct/ works fine. /en/myproduct/ gets a 404.

    In merchello.config I have:

    <route cultureName="de-CH" productSlugPrefix="ch" />
    <route cultureName="en-US" productSlugPrefix="en" />
    

    Any code examples would help a lot.

    Thanks Peter

  • Edgar Rasquin 326 posts 925 karma points
    May 26, 2020 @ 14:26
    Edgar Rasquin
    0

    Hi Pete,

    did you find a solution for this? I am experiencing the same problem.

    Thanks a lot

Please Sign in or register to post replies

Write your reply to:

Draft