OFBiz
  1. OFBiz
  2. OFBIZ-2361

Category URL conflicts with product URL

    Details

    • Type: Bug Bug
    • Status: Patch Available
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Trunk
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      red hat, postgres

      Description

      Hi,

      I just found out a potential bug in the new URL structure for category links in the ecommerce page.

      The new URL's for a category link reads as http://demo.ofbiz.org/ecommerce/products/100/100

      here 100 is the category ID, this URL should ideally list all products in the category with ID 100. However if we create a product with ID 100 ie. product_id=100, there arise the bug. Instead of all item being shown in the category, the product page for product_id 100 is displayed, irrespective of the category/catalog/store that product ID belongs to.

      I think this is a unusual behavior, and may cause problems for people wanting to move on to newer code.

      Please let me know if should open a jira issue for it.

      Rohit

        Activity

        Hide
        Ashish Vijaywargiya added a comment -

        >> Please let me know if should open a jira issue for it.

        Are you planning to create another JIRA issue for the same problem ?

        Don't worry we should handle it here in this issue only.
        Thanks !


        Ashish

        Show
        Ashish Vijaywargiya added a comment - >> Please let me know if should open a jira issue for it. Are you planning to create another JIRA issue for the same problem ? Don't worry we should handle it here in this issue only. Thanks ! – Ashish
        Hide
        Wickersheimer Jeremy added a comment -

        Just noticed the same problem, it is confusing and it will probably hit a lot of people since the default IDs (when creating categories and products from the catalog) are sure to conflict. As a result the category navigation menu (left column) in ecommerce is broken.

        Perhaps a quick fix is for the `CatalogUrlServlet` to only consider products when using the p_ prefix syntax ? Anyway there seems to be no way to be ''smart'' since /ecommerce/products/10000/10001 could be either sub category 10001 in category 10000 or product 10001 in category 10000.

        Show
        Wickersheimer Jeremy added a comment - Just noticed the same problem, it is confusing and it will probably hit a lot of people since the default IDs (when creating categories and products from the catalog) are sure to conflict. As a result the category navigation menu (left column) in ecommerce is broken. Perhaps a quick fix is for the `CatalogUrlServlet` to only consider products when using the p_ prefix syntax ? Anyway there seems to be no way to be ''smart'' since /ecommerce/products/10000/10001 could be either sub category 10001 in category 10000 or product 10001 in category 10000.
        Hide
        Wasun Sriwichai added a comment -

        This patch will solve the problem when the category_id and product_id URLs are the same, It can identify which id belong to the category or product.

        The process is URL checking, suppose that category_id = 100 as same as product_id and first the category URL is "URL = ecommerce/products/100", the process will check that the first ID in the URL always be the category_id so the category page will display. Secondly, the category URL is "URL = ecommerce/products/100/100", the process will check that the first ID is always the category_id and it cannot be duplicate in the URL so the next ID have to be the product_id and product page will be displayed.

        Show
        Wasun Sriwichai added a comment - This patch will solve the problem when the category_id and product_id URLs are the same, It can identify which id belong to the category or product. The process is URL checking, suppose that category_id = 100 as same as product_id and first the category URL is "URL = ecommerce/products/100", the process will check that the first ID in the URL always be the category_id so the category page will display. Secondly, the category URL is "URL = ecommerce/products/100/100", the process will check that the first ID is always the category_id and it cannot be duplicate in the URL so the next ID have to be the product_id and product page will be displayed.
        Hide
        Jacques Le Roux added a comment -

        Hi Wasun,

        Did you test your change following the use case above (create a product with Id 100 then URL http://localhost:8080/ecommerce/products/100/100)? Because it does not seem to fix the issue... Could I have missed something (I did not look at the code in detail - it looked good at 1st glance - but just tested)?

        Thanks

        Show
        Jacques Le Roux added a comment - Hi Wasun, Did you test your change following the use case above (create a product with Id 100 then URL http://localhost:8080/ecommerce/products/100/100)? Because it does not seem to fix the issue... Could I have missed something (I did not look at the code in detail - it looked good at 1st glance - but just tested)? Thanks
        Hide
        Wasun Sriwichai added a comment -

        Hi Jacques Le Roux,

        I have tested the use case above (create a product with Id 100 then URL http://localhost:8080/ecommerce/products/100/100)? already and it's working.

        if you not patch file when create product_id same category_id then URL http://localhost:8080/ecommerce/products/100 it will show the product page.

        Thanks

        Show
        Wasun Sriwichai added a comment - Hi Jacques Le Roux, I have tested the use case above (create a product with Id 100 then URL http://localhost:8080/ecommerce/products/100/100)? already and it's working. if you not patch file when create product_id same category_id then URL http://localhost:8080/ecommerce/products/100 it will show the product page. Thanks
        Hide
        Jacques Le Roux added a comment -

        Wasun,

        Could you please explain what "it's working" for you means?

        My understanding is that, if you don't create a product with 100 Id, with http://localhost:8080/ecommerce/products/100/100 you get the list of the products in the category 100. But if you create a product with Id 100 then with the same URL you get to the product page when you should really still get the products list in categ 100.

        Thanks

        Show
        Jacques Le Roux added a comment - Wasun, Could you please explain what "it's working" for you means? My understanding is that, if you don't create a product with 100 Id, with http://localhost:8080/ecommerce/products/100/100 you get the list of the products in the category 100. But if you create a product with Id 100 then with the same URL you get to the product page when you should really still get the products list in categ 100. Thanks

          People

          • Assignee:
            Unassigned
            Reporter:
            Rohit Sureka
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development