Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Clean urls 5.2.3

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 04-15-2015, 04:00 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Clean urls 5.2.3

I'm wanting to change my product clean urls. I want to use "/" instead of "html". It would be nice instead of having the locked html box at the end of the clean url line if you could just change it right there. Does anyone know how to change the extension that the cart uses for products away from the default html?
__________________
Ver 5.2.6
Reply With Quote
  #2  
Old 04-15-2015, 06:06 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Clean urls 5.2.3

Could you please let me know the reason why you want your product URLs be example.com/test-product/ ? Such URLs do look like category page and it might confuse your users.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #3  
Old 04-15-2015, 06:50 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: Clean urls 5.2.3

We are bringing existing pages over from another cart and we want all of the page names to stay the same. The existing pages are already cached and well ranked with the search engines. This was easily accomplished with xcart 4 and even xcart 5.1 with some slight modifications.
__________________
Ver 5.2.6
Reply With Quote
  #4  
Old 04-15-2015, 12:15 PM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: Clean urls 5.2.3

I'm trying to decorate the \XLite\Model\Repo\CleanURL class. From looking in the var/run it doesn't look my code is being included. I am adding this into my custom skin mod. My namespace is XLite\Model\Pmall\PmallSkin\Repo; and my class is class CleanURL extends \XLite\Model\Repo\CleanURL implements \XLite\Base\IDecorator

Not sure what I'm doing wrong. Any help would be greatly appreciated.
__________________
Ver 5.2.6
Reply With Quote
  #5  
Old 04-16-2015, 04:00 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Clean urls 5.2.3

@Phil,

\XLite\Model\Repo\CleanURL is the right class to decorate. Basically, you need to change the value of the CLEAN_URL_DEFAULT_EXTENSION constant and change it to '' (empty line).
You would also need to change the postProcessURLProduct() method there, so it would reflect right product URL structure.

Please, let me know if it helps.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #6  
Old 04-16-2015, 04:42 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: Clean urls 5.2.3

Quote:
Originally Posted by tony_sologubov
@Phil,

\XLite\Model\Repo\CleanURL is the right class to decorate. Basically, you need to change the value of the CLEAN_URL_DEFAULT_EXTENSION constant and change it to '' (empty line).
You would also need to change the postProcessURLProduct() method there, so it would reflect right product URL structure.

Please, let me know if it helps.

Tony
Do you see a problem with my namespace? For some reason it doesn't look my code is being used. I have changed the CLEAN_URL_DEFAULT_EXTENSION constant. When I check in the var/run folder my code isn't there just the stock code.
__________________
Ver 5.2.6
Reply With Quote
  #7  
Old 04-16-2015, 05:38 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Clean urls 5.2.3

Oh, yes, right.

Your namespace should be \XLite\Module\Pmall\PmallSkin\Model\Repo and the file should be located in the <X-Cart>/classes/XLite/Module/Pmall/PmallSkin/Model/Repo folder.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #8  
Old 04-16-2015, 09:35 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: Clean urls 5.2.3

Tony thanks for your help. With your suggestions I have got it to work partially, but with problems. The product shows the url with out the .html, but when you go to it you get a 404. If you want the page to show up you have to add the .html in the address bar. Honestly I think the clean urls worked better before the upgrade. I was able to get the clean urls to display the way I wanted with some minor tweaking to the /XLite/Core/Converter and the htaccess.


I would like for all the urls to appear directly from the root. For example rather than example.com/category/subcategory/product I want to see example.com/product or example.com/subcategory. Can this all be accomplished from \XLite\Model\Repo\CleanURL or do I also need to make changes to /XLite/Core/Converter.php ?

Do you have any further suggestions or advice to help me out?
__________________
Ver 5.2.6
Reply With Quote
  #9  
Old 04-17-2015, 12:37 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Clean urls 5.2.3

Quote:
Originally Posted by Phil Richman
Tony thanks for your help. With your suggestions I have got it to work partially, but with problems. The product shows the url with out the .html, but when you go to it you get a 404. If you want the page to show up you have to add the .html in the address bar. Honestly I think the clean urls worked better before the upgrade. I was able to get the clean urls to display the way I wanted with some minor tweaking to the /XLite/Core/Converter and the htaccess.

Right. In case X-Cart does not recognize the clean URL as product URL, you should dig into the getTargetByCleanURL() method of \XLite object. Most likely you will need to decorate the parseCleanUrl() method of \XLite\Core\Converter class in order to overcome the problem.

Quote:
I would like for all the urls to appear directly from the root. For example rather than example.com/category/subcategory/product I want to see example.com/product or example.com/subcategory. Can this all be accomplished from \XLite\Model\Repo\CleanURL or do I also need to make changes to /XLite/Core/Converter.php ?

Do you have any further suggestions or advice to help me out?

This change is planned for the core as per discussion here:
http://forum.x-cart.com/showthread.php?p=385163#post385163

So, if you can wait, we will ship it in 5.2.5 or 5.2.6.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #10  
Old 04-17-2015, 05:55 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: Clean urls 5.2.3

Quote:
Originally Posted by tony_sologubov
Right. In case X-Cart does not recognize the clean URL as product URL, you should dig into the getTargetByCleanURL() method of \XLite object. Most likely you will need to decorate the parseCleanUrl() method of \XLite\Core\Converter class in order to overcome the problem.



This change is planned for the core as per discussion here:
http://forum.x-cart.com/showthread.php?p=385163#post385163

So, if you can wait, we will ship it in 5.2.5 or 5.2.6.


I can't seem to figure out how to decorate the parseCleanUrl method so that xcart will recognize the product urls without the html. Do you know how this needs modified to make this work?
__________________
Ver 5.2.6
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:36 AM.

   

 
X-Cart forums © 2001-2020