- Posts: 240
- Thank you received: 13
Classes overrides
-- Joomla version -- : 4.2.8
-- PHP version -- : 8.1
Hi
i copied the file "filter.php" form "administrator/components/com_hikashop/classes" to here "templates/XXX/html/com_hikashop/administrator/classes" to create an override for filters but i get the error which is attached to this message.
what did i mistaked ?
Please Log in or Create an account to join the conversation.
You need to change the name of the class to add Override at the end.
For reference:
www.hikashop.com/support/documentation/6...ntation.html#classes
Please Log in or Create an account to join the conversation.
error is gone now but the system is not reading this file
all I want to do is to add a DIV before be <ul> element on line 2291
Please Log in or Create an account to join the conversation.
I suppose what you're saying is false. The system must be reading this file, otherwise, you wouldn't have had the error you reported in your first message in this thread. What I think is probably happening is that the modifications you want to make are in the secondary classes of this filter.override.php file.
Adding the "Override" suffix to the class name will only work for the main class in this file.
For the other classes, where you want to add your div, you also need to modify the methods of that main class which load the other classes.
Search for the line:
After all of them, add this code:
Please Log in or Create an account to join the conversation.
thank youuuuuu
Please Log in or Create an account to join the conversation.
can you help how can i edit my filter.override.php file to read the function from this file ?
Please Log in or Create an account to join the conversation.
Well, you should be able to access it by just calling the function.
I'm not sure what problem you have with that function ?
Where are you trying to call it from ?
Please provide more details.
Maybe a copy of the file would help (you can zip it to attach it here).
Please Log in or Create an account to join the conversation.
Please log in or register to see it.
Please Log in or Create an account to join the conversation.
I can see that you added a function titlePosition_netparsi which is a modified version of the titlePosition function in the default class.
Why did you change the name ?
If you keep the same name, it will automatically be taken into account.
If you change the name of the function, then you need to find all the places where titlePosition is called in your file and also change the call to titlePosition_netparsi
Please Log in or Create an account to join the conversation.
without changing anyname, this file doesnt shows my div
i attached the correct file again
Please log in or register to see it.
Please Log in or Create an account to join the conversation.
That's because you don't use the class where you made the changes.
For example, you have this:
class hikashopListClassOverride extends hikashopFilterTypeClass{
It means that your override class hikashopListClassOverride extends from the default hikashopFilterTypeClass
But you want it to use the override class. So you need to change this line to:
class hikashopListClassOverride extends hikashopFilterTypeClassOverride{
Please Log in or Create an account to join the conversation.
i thing there is a problem here
Please Log in or Create an account to join the conversation.
Well, it's not easy overridding all the filter classes, but it's definitely possible. You must still be missing something in your code.
Please Log in or Create an account to join the conversation.