Advertisement:

Author Topic: [SOLVED] Category sorting does not work when Friendly URL's are enabled  (Read 2567 times)

denver42

  • Newbie
  • *
  • Posts: 37
Modern Theme
OSclass 3.3.2

When friendly URL's are enabled and a Category is clicked the results are listed for that category. When sorting is clicked in the results page, the sort displays all of the items posted in every category and not just that selected category. Example: For Sale is clicked. Results are displayed. User clicks on a sort function. Results are displayed from all categories available and not just 'For Sale'

Is there a way to fix this?

To reproduce:
1. Enable Friendly URLS
2. Click on category from the main page.
3. Try to sort and see if sorting is ONLY for that category.

This issue does not happen when friendly URL's are disabled. Please help. Thanx!!
« Last Edit: March 05, 2014, 07:28:32 pm by denver42 »

denver42

  • Newbie
  • *
  • Posts: 37
Re: Category sorting does not work when Friendly URL's are enabled
« Reply #1 on: February 27, 2014, 12:36:29 am »
Don't know if this will help but I noticed the following:

When a category is selected and sorting is clicked on, the URL shows:

http://www.websitename.com/search/category,for-sale/sOrder,i_price/iOrderType,asc

When a subcategory is selected and sorting is clicked on, the URL shows:

http://www.websitename.com/search/category,for-sale/electronics-computers/sOrder,i_price/iOrderType,asc/sOrder,i_price

When I remove "for-sale/" in the URL as follows:

http://www.websitename.com/search/category,electronics-computers/sOrder,i_price/iOrderType,asc/sOrder,i_price

Sorting works perfect. How can I stop it from displaying the category when sorting and just display the sub-category?

denver42

  • Newbie
  • *
  • Posts: 37
Re: Category sorting does not work when Friendly URL's are enabled
« Reply #2 on: February 27, 2014, 11:35:26 pm »
Can anyone help with this?  :(

denver42

  • Newbie
  • *
  • Posts: 37
Re: Category sorting does not work when Friendly URL's are enabled
« Reply #3 on: March 03, 2014, 11:04:28 pm »
Ok I had to consult with an Apache person for this who stated that it's a .htaccess issue... this fixes the sorting problem but there's a small PHP problem now that I'm hoping someone can help with...

To Fix, replace the current .HTACCESS with the following:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/search/category,(for-sale|jobs|real-estate|personals|services|community|vehicles|classes)/sOrder,dt_pub_date/iOrderType,desc$
RewriteRule ^search/category,(for-sale/|jobs/|real-estate/|personals/|services/|community/|vehicles/|classes/)(.*)$ http://%{HTTP_HOST}/search/category,$2 [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Now, whenever you add a new category to your site, You should append that new Category name to above two Lines.

Example : If you add a new Category "electronics"

The above Rewrite Lines will be modified as below:

1. RewriteCond %{REQUEST_UR I} !^/search/category,(for-sale|jobs|real-estate|personals|services|community|vehicles|classes|electronics)/sOrder,dt_pub_date/iOrderType,desc$

2. RewriteRule ^search/category,(for-sale/|jobs/|real-estate/|personals/|services/|community/|vehicles/|classes/|electronics/)(.*)$ http://%{HTTP_HOST}/search/category,$2 [L]


In the First Line i have added "|electronics"In the Second Line i have added "|electronics/". This solves the sorting issue.

Problem now is that the Category name disappears when you click on any sorting function after the results are displayed. I was told that this could be solved using PHP.

Can anyone help?

Klenkes

  • Newbie
  • *
  • Posts: 36
Re: Category sorting does not work when Friendly URL's are enabled
« Reply #4 on: March 05, 2014, 07:15:42 pm »
Thanks a lot! This bothers me a long time now.

I extended your solution to take care of lowest price, highest price and ASC sorting of pub_date as well:
...(categories|categories...)/sOrder,(dt_pub_date|i_price)/iOrderType,(asc|desc)$


denver42

  • Newbie
  • *
  • Posts: 37
EXCELLENT! I THINK THIS IS RESOLVED! Great Work!

Even the category names appear now. No need for a PHP fix! Perfect!

adv2sell

  • Jr. Member
  • **
  • Posts: 84
How to do this in Modern theme 3.0.3 osclass version 3.2.2?

Thanks

adv2sell

  • Jr. Member
  • **
  • Posts: 84
How to do this in Modern theme 3.0.3 osclass version 3.2.2?

Thanks

 ::)

what to do for showing clean urls ?

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
it's handled in your .htaccess file - -in this version of the fix

Quote
To Fix, replace the current .HTACCESS with the following: