Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9290857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:30:57+00:00 2026-06-18T20:30:57+00:00

I have a question about formatting the friendly URL for category and subcategory and

  • 0

I have a question about formatting the friendly URL for category and subcategory and getting the matching products. I am using PrestaShop 1.5.2.0

Let’s say we have a structure like this:

Category 1

  • Spare Parts
  • Accessories

Category 2

  • Chips
  • Accessories

I want to display the link like this: /category-1/accessories and to display the products from category 1->accessories. How can I achieve this?

The current behavior is when I click on accessories, being in category 1, the link is /accessories and the products that are displayed belong from both /category-1/accessories and /category-2/accessories

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T20:30:58+00:00Added an answer on June 18, 2026 at 8:30 pm

    This question was answered on the PrestaShop forum.
    You can find it here http://www.prestashop.com/forums/topic/220017-category-subcategory-url/

    The solution – add this changes to the fallowing classes

    CLASSES/Dispatcher.php

    'rule' => '{categories:/}{id}-{rewrite}/',
    'categories' => array('regexp' => '[/_a-zA-Z0-9-\pL]*'),
    

    CLASSES/Link.php

    $cats = array();    
    foreach ($category->getParentsCategories() as $cat)    
    if (!in_array($cat['id_category'], array(1, 2, $category->id)))//remove root, home and current category from the URL    
    $cats[] = $cat['link_rewrite'];    
    $params['categories'] = implode('/', array_reverse($cats));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a question about formatting the URL parameters in php page 1 can
I have a question about formatting the Rupee currency (Indian Rupee - INR). For
Okay guys I have a question about positioning tables within DIV's using CSS. I
I have a question about formatting the output of the sum() function in XQuery/XSLT/XPath.
I'm building a super simple PHP CMS, and have a question about formatting text...
I have a question about formatting a decimal number to a certain QString format.
I have a question about formatting the Rupee currency (Indian Rupee - INR). Typically
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.