- Posts: 14
- Thank you received: 0
Can't override pagination.php
5 years 4 days ago #335840
by kriptonus
Can't override pagination.php was created by kriptonus
-- url of the page with the problem -- : vanillashop23.ru
-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.10.0
-- PHP version -- : 8.0.3
-- Error-message(debug-mod must be tuned on) -- : Fatal error: Cannot declare class hikashopPaginationHelper, because the name is already in use in /home/r/rmmoto/vanillashop23.ru/public_html/templates/vanillashop/html/com_hikashop/administrator/helpers/pagination.override.php on line 371
Hi!
I've tried to override pagination.php file, but I couldn't do it.
For the first time, I had created pagination.override.php in my_template/html/com_hikashop/administrator/ , next, I added original code from pagination.php and some changes to override class hikashopBridgePaginationHelper:
I have an error message now:
-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.10.0
-- PHP version -- : 8.0.3
-- Error-message(debug-mod must be tuned on) -- : Fatal error: Cannot declare class hikashopPaginationHelper, because the name is already in use in /home/r/rmmoto/vanillashop23.ru/public_html/templates/vanillashop/html/com_hikashop/administrator/helpers/pagination.override.php on line 371
Hi!
I've tried to override pagination.php file, but I couldn't do it.
For the first time, I had created pagination.override.php in my_template/html/com_hikashop/administrator/ , next, I added original code from pagination.php and some changes to override class hikashopBridgePaginationHelper:
Code:
<?php
/**
* @package HikaShop for Joomla!
* @version 4.4.3
* @author hikashop.com
* @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
//jimport('joomla.html.pagination');
//include_once $originalFile;
include_once(JPATH_ADMINISTRATOR . '/components/com_hikashop/helpers/pagination.php');
class hikashopBridgePaginationHelperOverride extends hikashopBridgePaginationHelper {
var $hikaSuffix = '';
var $form = '';
function getPagesLinks() {
$app = JFactory::getApplication();
$lang = JFactory::getLanguage();
$lang->load('lib_joomla');
What have I made wrong and how could I fix it?Fatal error: Cannot declare class hikashopPaginationHelper, because the name is already in use in /home/r/rmmoto/vanillashop23.ru/public_html/templates/vanillashop/html/com_hikashop/administrator/helpers/pagination.override.php on line 371
Please Log in or Create an account to join the conversation.
5 years 4 days ago #335841
by nicolas
Replied by nicolas on topic Can't override pagination.php
Hi,
Look at the bottom of your copy of pagination.php
You can see you have a second class hikashopPaginationHelper defined which extends from hikashopBridgePaginationHelper
So you need to change hikashopPaginationHelper to hikashopPaginationHelperOverride there.
Also, instead of extending from hikashopBridgePaginationHelper, you could either extend from hikashopBridgePaginationHelperOverride or from hikashopPaginationHelper (which will extend from hikashopBridgePaginationHelper)
It depends what you need to override in your pagination.php
Look at the bottom of your copy of pagination.php
You can see you have a second class hikashopPaginationHelper defined which extends from hikashopBridgePaginationHelper
So you need to change hikashopPaginationHelper to hikashopPaginationHelperOverride there.
Also, instead of extending from hikashopBridgePaginationHelper, you could either extend from hikashopBridgePaginationHelperOverride or from hikashopPaginationHelper (which will extend from hikashopBridgePaginationHelper)
It depends what you need to override in your pagination.php
Please Log in or Create an account to join the conversation.
5 years 4 days ago #335846
by kriptonus
Replied by kriptonus on topic Can't override pagination.php
I need to override pagination from native to bootstrap 4. So, I have to modify function _list_render as I see it.
Please Log in or Create an account to join the conversation.
5 years 4 days ago #335848
by nicolas
Replied by nicolas on topic Can't override pagination.php
Hi,
Then, that's not how you want to do it.
You want to use the normal pagination override system of Joomla by creating a file templates/yourtemplate/html/pagination.php and then filling it with code like this:
www.web-eau.net/blog/pagination-bootstrap-4
If you check the code of the pagination helper class of HikaShop, you can see it has such code:
so that the pagination template override can be used instead of the default pagination.
Then, that's not how you want to do it.
You want to use the normal pagination override system of Joomla by creating a file templates/yourtemplate/html/pagination.php and then filling it with code like this:
www.web-eau.net/blog/pagination-bootstrap-4
If you check the code of the pagination helper class of HikaShop, you can see it has such code:
Code:
return ($listOverride) ? pagination_list_render($list) : $this->_list_render($list);
Please Log in or Create an account to join the conversation.
Time to create page: 0.150 seconds