| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Can't get a custom page to load | ||||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() Help!
I need to create a page that I can put some HTML in, but I can't seem to get the page to load. It just redirects back to the homepage. Here's what I'm trying: 1) I run the following macro from the SDK: php.exe ../next-sdk/devkit/macros/create-module.php --module=MyDevID\TestMod --version=5.2 2) Then I run: php.exe ../next-sdk/devkit/macros/create-page.php --module=MyDevID\TestMod --target=testmod --interface=Customer --version=5.2 3) Next I edit <xcart_dir>/skins/default/en/modules/MyDevID/TestMod/page/testmod/body.tpl and add <p>Hello World</p> 4) I redeploy the site and then enable the "TestMod" module 5) Finally I go to http://<mycarturl>/cart.php?target=testmod and it just redirects me to the store's homepage. Am I skipping a step on setting this up or is there something wrong with the cart installation? Thank you!
__________________
X-Cart 5.3 |
|||||||
#2
|
|||||||
|
|||||||
![]() Turns out it's the Clean URL feature causing the problem. If I turn it off, it directs me to my module. How can I create a clean url for my module so it works?
__________________
X-Cart 5.3 |
|||||||
#3
|
|||||||||
|
|||||||||
![]() It's not that. One of the functions returning redirect url for Clean URL changed with recent versions. The SDK is old, it hasn't been updated for like 2 years. You can use it as starter but do not rely on it. It looks like QT abandoned it.
I believe the one changed was \XLite:getTargetByCleanURL() or similar
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
#4
|
|||||||
|
|||||||
![]() It look the solution was more straight forward, I just changed the URL from the URL suggested in the documentation (which was http://<mycarturl>/cart.php?target=testmod) to http://<mycarturl>/?target=testmod.
Ugh, what a waste of precious development time. But thanks for replying Steve!! Without the handful of dev guys on this forum, XC5 would be dead in the water!
__________________
X-Cart 5.3 |
|||||||
#5
|
|||||||||
|
|||||||||
![]() Thse 2 urls are essentially the same so this is not really a solution. The problem with this is it will add the parameter to the clean url so in general will look like
www.domain.com/this-is-test-pahe.html?target=testmod Not pretty or easy to remember and it sort of defeats the purpose of having clean urls.
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
#6
|
|||||||
|
|||||||
![]() Bizarre! But thanks, it works!
![]()
__________________
X-Cart 5.3 |
|||||||
#7
|
|||||||||
|
|||||||||
![]() Hello!
I've just tested it on my local X-Cart 5 installation and both the links (http://<mycarturl>/cart.php?target=testmod and http://<mycarturl>/?target=testmod) display the test page when Clean URLs are enabled. Did you enter the links in your browser's address bar? Or did you use some kind of a menu link to that page?
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful ![]() Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#8
|
|||||||
|
|||||||
![]() I tried both typing in the URL and creating a menu link.
It was working, but now it has mysteriously stopped working regardless if the Clean URL's are enabled or not. Any suggestions on how I can debug this? How can I confirm that the target loading my module?
__________________
X-Cart 5.3 |
|||||||
#9
|
|||||||||
|
|||||||||
![]() Can you send me your module? You can use this method to pack it into a single archive file.
As for debugging - you can use this code to log data to a custom log file: Code:
Log the result of the getTarget() method in the first line of the handleRequest() method in the var/run/classes/XLite/Controller/AControllerAbstract.php file - this should give you the idea what "targets" are being triggered. Also, you can add "protected function doNoAction()" method in your controller class (classes/XLite/Module/MyDevID/TestMod/Controller/TestModController.php) and add logging there. Just remember that "var/run/classes/" contains the actual PHP files that are run when you browse the site, and "classes/" is the directory that stores "original" versions of these files (every time you redeploy the store X-Cart 5 takes these files, "compiles" them and put inside the var/run/classes/ directory).
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful ![]() Click here to learn how to apply patches X-Cart Extensions Last edited by qualiteam : 05-04-2016 at 10:37 PM. |
|||||||||
|
#10
|
|||||||
|
|||||||
![]() Thank you for the logging code, I will try it out.
I was able to fix my issue by changing the target tag in the code from testmod to test_mod. I am not sure why I had to change it, I'm guessing it's a bug in the deployment process, but it did allow the module to load when I request it with http://<mycarturl>/placeholder.html?target=test_mod
__________________
X-Cart 5.3 |
|||||||
|
|||
X-Cart forums © 2001-2020
|