X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Clean URLs in 5.2.5 (https://forum.x-cart.com/showthread.php?t=72271)

Phil Richman 09-23-2015 06:13 PM

Re: Clean URLs in 5.2.5
 
1 Attachment(s)
Quote:

Originally Posted by Vanaja
Hi,

Do we have any other alternate solution to remove the HTML extension from the clean URLs (like .haccess or any other changes) instead of creating a new custom module?



I had the same problem when upgrading from 5.1.11 to 5.2.6 I made a real simple mod that should do what you are looking to do. Just go to modules and select upload add-on. Upload and install the attached mod. You will have to unzip the Clean_URL_Mod.zip. In that zip is the file Pmall-CleanURL-v5_2_6.tar That is the file to upload. I had to stick the .tar file in a zip because the forum allows zip files but not tars. Hopefully that isn't to confusing. Then you will need to go into the xc_clean_urls table and make sure that all urls have the .html removed. After that you should be ready to go. Let me know if any of that is unclear or if you have any problems.

razortw 09-23-2015 10:37 PM

Re: Clean URLs in 5.2.5
 
2 Attachment(s)
Quote:

Originally Posted by mjlepp
No, we do not have custom code.
See attached screenshot of the field in the XCart Admin for products from 5.1.11 vs 5.2.25.

That is correct, you are free to specify the clean url for an item without any extension.
But it will be automatically appended to product urls after you save the changes.
See attached screenshots.

razortw 09-23-2015 10:40 PM

Re: Clean URLs in 5.2.5
 
Quote:

Originally Posted by Phil Richman
I had the same problem when upgrading from 5.1.11 to 5.2.6 I made a real simple mod that should do what you are looking to do. Just go to modules and select upload add-on. Upload and install the attached mod. You will have to unzip the Clean_URL_Mod.zip. In that zip is the file Pmall-CleanURL-v5_2_6.tar That is the file to upload. I had to stick the .tar file in a zip because the forum allows zip files but not tars. Hopefully that isn't to confusing. Then you will need to go into the xc_clean_urls table and make sure that all urls have the .html removed. After that you should be ready to go. Let me know if any of that is unclear or if you have any problems.

Thanks for sharing your mod!
But it doesn't seem to be working on X-Cart 5.2.6.
I installed and activated the module, but all product URLs still do have HTML extensions.
Also, extensions are in the database.
Are there any additional action required to make it work?
Thanks!

Phil Richman 09-24-2015 05:18 AM

Re: Clean URLs in 5.2.5
 
Quote:

Originally Posted by razortw
Thanks for sharing your mod!
But it doesn't seem to be working on X-Cart 5.2.6.
I installed and activated the module, but all product URLs still do have HTML extensions.
Also, extensions are in the database.
Are there any additional action required to make it work?
Thanks!



The mod won't remove the .html extension. You have to manually remove the .html from the xc_clean_urls. After you remove those extensions from the table. You should be able to redeploy the store, and they should be working. If the .html extensions are still in the table you will get a 404 error. The following sql command should do the trick:

UPDATE `xc_clean_urls` SET `cleanURL`=SUBSTRING(`cleanURL`,1,LENGTH(`cleanURL `) - 5) WHERE SUBSTRING(`cleanURL`,-5) = '.html'

I assume there is a way to run a sql command during installation of the mod, but I have to admit I'm unsure how to do it.

Let me know if this works for you, or if you still have problems.

razortw 09-24-2015 09:11 AM

Re: Clean URLs in 5.2.5
 
Quote:

Originally Posted by Phil Richman
The mod won't remove the .html extension. You have to manually remove the .html from the xc_clean_urls. After you remove those extensions from the table. You should be able to redeploy the store, and they should be working. If the .html extensions are still in the table you will get a 404 error. The following sql command should do the trick:

UPDATE `xc_clean_urls` SET `cleanURL`=SUBSTRING(`cleanURL`,1,LENGTH(`cleanURL `) - 5) WHERE SUBSTRING(`cleanURL`,-5) = '.html'

I assume there is a way to run a sql command during installation of the mod, but I have to admit I'm unsure how to do it.

Let me know if this works for you, or if you still have problems.

I will definitely try it tomorrow.
I'll keep you posted.
Thanks!

Phil Richman 09-29-2015 04:22 AM

Re: Clean URLs in 5.2.5
 
Quote:

Originally Posted by razortw
I will definitely try it tomorrow.
I'll keep you posted.
Thanks!


Did this work for you?

razortw 09-29-2015 10:44 AM

Re: Clean URLs in 5.2.5
 
Quote:

Originally Posted by Phil Richman
Did this work for you?

Sorry, I forgot to post an update.
Unfortunately, it didn't work. All pages throw the 'Page not found' error.

Phil Richman 10-01-2015 03:27 AM

Re: Clean URLs in 5.2.5
 
Quote:

Originally Posted by razortw
Sorry, I forgot to post an update.
Unfortunately, it didn't work. All pages throw the 'Page not found' error.



Did you remove all extensions from the database? If the extensions are there in the clean url table it throws the 404 error. I'm using it on my live 5.2.6 store and it works fine for me.

razortw 10-01-2015 05:50 AM

Re: Clean URLs in 5.2.5
 
Quote:

Originally Posted by Phil Richman
Did you remove all extensions from the database? If the extensions are there in the clean url table it throws the 404 error. I'm using it on my live 5.2.6 store and it works fine for me.

Thanks for the reply.
Yes, I removed extenstions from the database.
Here is what my clean url table looks like
Code:

mysql> select * from xc_clean_urls;
+----+-----------------+---------+------------+-------------+------------------------------------------+
| id | news_message_id | page_id | product_id | category_id | cleanURL                                |
+----+-----------------+---------+------------+-------------+------------------------------------------+
|  1 |            NULL |      1 |      NULL |        NULL | terms-and-conditions                    |
|  2 |            NULL |      2 |      NULL |        NULL | shipping                                |
|  3 |            NULL |    NULL |          1 |        NULL | planet-express-babydoll                  |
|  4 |            NULL |    NULL |          2 |        NULL | digital-angel                            |
|  5 |            NULL |    NULL |          3 |        NULL | electronic-drum-kit-shirt                |
|  6 |            NULL |    NULL |          4 |        NULL | collector                                |
|  7 |            NULL |    NULL |          5 |        NULL | acrobots                                |
|  8 |            NULL |    NULL |          6 |        NULL | mini-solar-powered-car                  |
|  9 |            NULL |    NULL |          7 |        NULL | pyramid-brain-twist                      |
| 10 |            NULL |    NULL |          8 |        NULL | heart-hand-warmer                        |
| 11 |            NULL |    NULL |          9 |        NULL | robo-q-tiny-r-c-robot                    |
| 12 |            NULL |    NULL |        10 |        NULL | thumb-size-r-c-mini-cooper              |
| 13 |            NULL |    NULL |        11 |        NULL | self-rescuing-princess                  |
| 14 |            NULL |    NULL |        12 |        NULL | planet-express                          |
| 15 |            NULL |    NULL |        13 |        NULL | wi-fi-detector-shirt                    |
| 16 |            NULL |    NULL |        14 |        NULL | caffeine-molecule                        |
| 17 |            NULL |    NULL |        15 |        NULL | nanotechnology-is-huge                  |
| 18 |            NULL |    NULL |        16 |        NULL | binary-mom                              |
| 19 |            NULL |    NULL |        17 |        NULL | ducati-r-c-motorcycle-with-leaning-rider |
| 20 |            NULL |    NULL |        18 |        NULL | dark-blade-3-channel-r-c-helicopter      |
| 21 |            NULL |    NULL |        19 |        NULL | palmsize-battle-tanks                    |
| 22 |            NULL |    NULL |        20 |        NULL | r-c-desktop-forklift                    |
| 23 |            NULL |    NULL |        21 |        NULL | edge-robotic-arm-kit                    |
| 24 |            NULL |    NULL |        22 |        NULL | choroq-qsteer-mario-kart-r-c-racers      |
| 25 |            NULL |    NULL |        23 |        NULL | r-c-airsoft-battle-tanks                |
| 26 |            NULL |    NULL |        24 |        NULL | srv-1-blackfin-mobile-surveillance-robot |
| 27 |            NULL |    NULL |        25 |        NULL | microfly-tiny-r-c-hovering-ufo          |
| 28 |            NULL |    NULL |        26 |        NULL | pentago                                  |
| 29 |            NULL |    NULL |        27 |        NULL | rubik-s-cube                            |
| 30 |            NULL |    NULL |        28 |        NULL | rubik-s-mirror-blocks-cube              |
| 31 |            NULL |    NULL |        29 |        NULL | crystal-growing-kit                      |
| 32 |            NULL |    NULL |        30 |        NULL | laq-japanese-building-set                |
| 33 |            NULL |    NULL |        31 |        NULL | game-of-life-kit                        |
| 34 |            NULL |    NULL |        32 |        NULL | classic-video-table-tennis-kit          |
| 35 |            NULL |    NULL |        33 |        NULL | diy-music-box-kit                        |
| 36 |            NULL |    NULL |        34 |        NULL | the-amazing-desktop-dinosaur-plant      |
| 37 |            NULL |    NULL |        35 |        NULL | levitron-anti-gravity-top                |
| 38 |            NULL |    NULL |        36 |        NULL | bare-metal-bender-wind-up                |
| 39 |            NULL |    NULL |        37 |        NULL | smart-mass-thinking-putty                |
| 40 |            NULL |    NULL |        38 |        NULL | albert-einstein-action-figure            |
| 41 |            NULL |    NULL |        39 |        NULL | yoda-plush-backpack                      |
| 42 |            NULL |    NULL |      NULL |          2 | apparel                                  |
| 43 |            NULL |    NULL |      NULL |          3 | toys                                    |
| 44 |            NULL |    NULL |      NULL |          4 | rc-toys                                  |
| 45 |            NULL |    NULL |      NULL |          5 | science-toys                            |
| 46 |            NULL |    NULL |      NULL |          6 | puzzles                                  |
| 47 |            NULL |    NULL |        40 |        NULL | pants                                    |
| 48 |            NULL |    NULL |        41 |        NULL | key                                      |
+----+-----------------+---------+------------+-------------+------------------------------------------+
48 rows in set (0.00 sec)


Phil Richman 10-01-2015 04:17 PM

Re: Clean URLs in 5.2.5
 
Quote:

Originally Posted by razortw
Thanks for the reply.
Yes, I removed extenstions from the database.
Here is what my clean url table looks like
Code:

mysql> select * from xc_clean_urls;
+----+-----------------+---------+------------+-------------+------------------------------------------+
| id | news_message_id | page_id | product_id | category_id | cleanURL                                |
+----+-----------------+---------+------------+-------------+------------------------------------------+
|  1 |            NULL |      1 |      NULL |        NULL | terms-and-conditions                    |
|  2 |            NULL |      2 |      NULL |        NULL | shipping                                |
|  3 |            NULL |    NULL |          1 |        NULL | planet-express-babydoll                  |
|  4 |            NULL |    NULL |          2 |        NULL | digital-angel                            |
|  5 |            NULL |    NULL |          3 |        NULL | electronic-drum-kit-shirt                |
|  6 |            NULL |    NULL |          4 |        NULL | collector                                |
|  7 |            NULL |    NULL |          5 |        NULL | acrobots                                |
|  8 |            NULL |    NULL |          6 |        NULL | mini-solar-powered-car                  |
|  9 |            NULL |    NULL |          7 |        NULL | pyramid-brain-twist                      |
| 10 |            NULL |    NULL |          8 |        NULL | heart-hand-warmer                        |
| 11 |            NULL |    NULL |          9 |        NULL | robo-q-tiny-r-c-robot                    |
| 12 |            NULL |    NULL |        10 |        NULL | thumb-size-r-c-mini-cooper              |
| 13 |            NULL |    NULL |        11 |        NULL | self-rescuing-princess                  |
| 14 |            NULL |    NULL |        12 |        NULL | planet-express                          |
| 15 |            NULL |    NULL |        13 |        NULL | wi-fi-detector-shirt                    |
| 16 |            NULL |    NULL |        14 |        NULL | caffeine-molecule                        |
| 17 |            NULL |    NULL |        15 |        NULL | nanotechnology-is-huge                  |
| 18 |            NULL |    NULL |        16 |        NULL | binary-mom                              |
| 19 |            NULL |    NULL |        17 |        NULL | ducati-r-c-motorcycle-with-leaning-rider |
| 20 |            NULL |    NULL |        18 |        NULL | dark-blade-3-channel-r-c-helicopter      |
| 21 |            NULL |    NULL |        19 |        NULL | palmsize-battle-tanks                    |
| 22 |            NULL |    NULL |        20 |        NULL | r-c-desktop-forklift                    |
| 23 |            NULL |    NULL |        21 |        NULL | edge-robotic-arm-kit                    |
| 24 |            NULL |    NULL |        22 |        NULL | choroq-qsteer-mario-kart-r-c-racers      |
| 25 |            NULL |    NULL |        23 |        NULL | r-c-airsoft-battle-tanks                |
| 26 |            NULL |    NULL |        24 |        NULL | srv-1-blackfin-mobile-surveillance-robot |
| 27 |            NULL |    NULL |        25 |        NULL | microfly-tiny-r-c-hovering-ufo          |
| 28 |            NULL |    NULL |        26 |        NULL | pentago                                  |
| 29 |            NULL |    NULL |        27 |        NULL | rubik-s-cube                            |
| 30 |            NULL |    NULL |        28 |        NULL | rubik-s-mirror-blocks-cube              |
| 31 |            NULL |    NULL |        29 |        NULL | crystal-growing-kit                      |
| 32 |            NULL |    NULL |        30 |        NULL | laq-japanese-building-set                |
| 33 |            NULL |    NULL |        31 |        NULL | game-of-life-kit                        |
| 34 |            NULL |    NULL |        32 |        NULL | classic-video-table-tennis-kit          |
| 35 |            NULL |    NULL |        33 |        NULL | diy-music-box-kit                        |
| 36 |            NULL |    NULL |        34 |        NULL | the-amazing-desktop-dinosaur-plant      |
| 37 |            NULL |    NULL |        35 |        NULL | levitron-anti-gravity-top                |
| 38 |            NULL |    NULL |        36 |        NULL | bare-metal-bender-wind-up                |
| 39 |            NULL |    NULL |        37 |        NULL | smart-mass-thinking-putty                |
| 40 |            NULL |    NULL |        38 |        NULL | albert-einstein-action-figure            |
| 41 |            NULL |    NULL |        39 |        NULL | yoda-plush-backpack                      |
| 42 |            NULL |    NULL |      NULL |          2 | apparel                                  |
| 43 |            NULL |    NULL |      NULL |          3 | toys                                    |
| 44 |            NULL |    NULL |      NULL |          4 | rc-toys                                  |
| 45 |            NULL |    NULL |      NULL |          5 | science-toys                            |
| 46 |            NULL |    NULL |      NULL |          6 | puzzles                                  |
| 47 |            NULL |    NULL |        40 |        NULL | pants                                    |
| 48 |            NULL |    NULL |        41 |        NULL | key                                      |
+----+-----------------+---------+------------+-------------+------------------------------------------+
48 rows in set (0.00 sec)




Did you go under "look & feel" - "Performance" and clear the cache?


All times are GMT -8. The time now is 05:02 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.