| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Using Extra Resources in XC5 | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Using Extra Resources in XC5
Hi Everyone,
I'm working on an API integration that requires me to reference a wsdl file in my module. However, XC5 does not seem to cache unrecognized files from my module so I end up with "File not found" errors. I assume this is the same with any other file resource. How do I add such file resources and reference them from my PHP code?
__________________
X-Cart 5.1.10 X-Cart Next 5.2.1 Beta |
|||||||||
#2
|
|||||||||
|
|||||||||
Re: Using Extra Resources in XC5
Hi @zychen!
Could you please give me a little more details about when you are getting "File not found" error? X-Cart does not cache unrecognized, so I do feel this is a problem with something else. Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
#3
|
|||||||||
|
|||||||||
Re: Using Extra Resources in XC5
Hi Tony,
It shouldn't be an X-Cart problem. It's just that I'm not sure what the proper way is to get the path of my extra file for my module. Since the files are executed in the cached run folder instead, a relative path isn't going to work but I don't want to hardcode my absolute directory paths to get the extra file. Basically, where would you suggest I place such files and how should I access them in code?
__________________
X-Cart 5.1.10 X-Cart Next 5.2.1 Beta |
|||||||||
#4
|
|||||||||
|
|||||||||
Re: Using Extra Resources in XC5
Hello Yong,
Please could you explain what you want to achieve? Do you want to bundle your X-Cart 5 module with some non-PHP files which will be loaded from your PHP scripts later? Should these files be "bundled", or will/can you create them from your scripts on the fly?
__________________
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 |
|||||||||
#5
|
|||||||||
|
|||||||||
Re: Using Extra Resources in XC5
Hi Alex,
Thanks for replying. Quote:
Yes, that is what I want - to bundle an existing non-PHP file to my module.
__________________
X-Cart 5.1.10 X-Cart Next 5.2.1 Beta |
|||||||||
#6
|
|||||||||
|
|||||||||
Re: Using Extra Resources in XC5
Quote:
Do you mean files like images? If so, you can put them into skins/ folder and then use them from there.
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
#7
|
|||||||||
|
|||||||||
Re: Using Extra Resources in XC5
Hi Yong,
It depends on how your scripts retrieve these files: 1. If the script are a part of your module, I believe you can use something like __DIR__ . '/../../../../../../../classes/XLite/Module/[YOUR_ID]/[MODULE_ID]' 2. If the script is an external service loading the files via an HTTP request, you can put these files into the "[XC5]/skins/en/customer/modules/[YOUR_ID]/[MODULE_ID]" directory as Tony suggested. How will you reference the files? If there is another script that should retrieve the files via an HTTP request,
__________________
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
|
|||||||||
|
|||||||||
Re: Using Extra Resources in XC5
My file is a .wsdl (or .xml) file accessed by my local module code.
I might have found the best way to do this if there isn't a dedicated folder for such files. I have found some handy directory constants leftover from LiteCommerce in /top.inc.PHP53.php so I have used one of those. Here's what I used: PHP Code:
Do you think this is a good way? Thanks Tony and Alex!
__________________
X-Cart 5.1.10 X-Cart Next 5.2.1 Beta |
|||||||||
|
#9
|
|||||||||
|
|||||||||
Re: Using Extra Resources in XC5
Yes, that is OK approach.
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
|
|
|||
X-Cart forums © 2001-2020
|