| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | Mark Forums Read | User manuals | Login |
Problem with custom module | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Problem with custom module
Hi there
I am using the Loyalty Program module, and I am using a static page to describe how it works rather than the standard blurb. The static page has it's own page heading, but if I use the '?target=loyalty_program_details' method reference the loyalty program, the page heading is hardcoded as 'Loyalty Program Details'. My page heading is ignored. I thought the page heading might be a label, but it isn't. It seems to be defined in the file classes/XLite/Module/QSL/LoyaltyProgram/Controller/Customer/LoyaltyProgramDetails.php in the getTitle() function. I can edit this file and change the heading, and I will do if I have to, but I think the correct method would be to create a custom module, and replace this function with my own version. Unfortunately, even though I am fairly sure I have done this correctly (I have created other simple modules which seem to work fine), I just can't get this one to do what I want. So, I created my customer module with a copy of the LoyaltyProgramDetails.php file, which now contains the following: ----------------------------- <?php namespace XLite\Module\<mydevdir>\LoyaltyProgram\Module\QSL\ LoyaltyProgram\Controller\Customer; /** * Controller for the "Loyalty Program Details" page. */ abstract class LoyaltyProgramDetails extends \XLite\Controller\Customer\ACustomer implements \XLite\Base\IDecorator { /** * Return the current page title (for the content area). * * @return string */ public function getTitle() { return 'Earn as you shop with our Loyalty Programme'; } } ----------------------------- The module is visible/available on the admin side and is switched on, and the differences between my version and the original are the namespace declaration, the class declaration (was 'class LoyaltyProgramDetails extends \XLite\Controller\Customer\ACustomer'), and the function's return line (was 'return 'Loyalty Program Details';'). I also removed the only other function, getLocation(), but not surprisingly it makes no difference whether it is in my php file or not. My understanding is that the class declaration with 'implements \XLite\Base\IDecorator' means that I am replacing something in the class and not extending it, but for whatever reason, my changes aren't having any effect. Is there anything I'm missing? Am I making a simple schoolboy error that I just can't see for looking? I'm not sure how to go about diagnosing it or where to look to see what is going on, and although it isn't a major problem and I can edit the original file to achieve what I want, I feel that this is the right way to do it and that I must surely be close to getting it right! I'm hoping it will be easy to put track down. Many thanks Welly |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Problem with custom module
I think you should extend XLite\Module\QSL\LoyaltyProgram\Controller\Custome r\LoyaltyProgramDetails class instead of XLite\Controller\Customer\ACustomer in your module.
I would try that out first.
__________________
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 |
|||||||||
#3
|
|||||||
|
|||||||
Re: Problem with custom module
Hi Alex
I think you are right, but I have changed my class line as follows, and it still doesn't work: abstract class LoyaltyProgramDetails extends \XLite\Module\QSL\LoyaltyProgram\Controller\Custom er\LoyaltyProgramDetails implements \XLite\Base\IDecorator Is that what you had in mind? Many thanks for the suggestion. Welly |
|||||||
#4
|
|||||||||
|
|||||||||
Re: Problem with custom module
Hi @welly,
The problem is likely to be caused by wrong namespace. Could you please let me know what namespace of your custom class? And what path it is at? Thanks. Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
#5
|
|||||||
|
|||||||
Re: Problem with custom module
Hi Tony
It seems that the problem was more simple than that. As I was copying and pasting the relevant lines from the original and my version of the php file into this reply, I noticed that I had added a comment with the previous version of the class declaration in it. I assume I had not formatted it correctly because now I have removed it, the module works as intended. Many thanks for your help. Welly |
|||||||
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|