- Posts: 220
- Thank you received: 8
Empty search text displays below category listing
9 years 10 months ago #255492
by Udo
Empty search text displays below category listing was created by Udo
-- HikaShop version -- : 2.6.4
-- Joomla version -- : 2.5.28
-- PHP version -- : 5.6.20
Hi,
After updating Hikashop 2.3.3 to version 2.6.4 the language string HIKASHOP_NO_RESULT is displayed on the main page of the shop below the category listing, when there are no associated products.
Before the NO_RESULTS text only was displayed on the page with an empty result of the search filter. This was realized by adding this code to the view product/listing.php.
However in the 2.6.4 view of product/listing.php this code has changed into:
Apparently this new code results in showing the NO RESULT text in categories with no products too.
But that situation needs a diferent text (like ''Sorry, no products in this category') instead of 'Sorry, no results found, try another search'.
Anyway, I don't want this text on the main page with the category listing.
I solved my problem by replacing the relevant code in the 2.6.4 version by the code in the 2.3.3 override. Now it works fine,
I don't know if this is a correct solution. Perhaps it's a configuration issue?
Regards,
Udo
-- Joomla version -- : 2.5.28
-- PHP version -- : 5.6.20
Hi,
After updating Hikashop 2.3.3 to version 2.6.4 the language string HIKASHOP_NO_RESULT is displayed on the main page of the shop below the category listing, when there are no associated products.
Before the NO_RESULTS text only was displayed on the page with an empty result of the search filter. This was realized by adding this code to the view product/listing.php.
Code:
}elseif(( !$this->module || JRequest::getVar('hikashop_front_end_main',0) ) && (@$_REQUEST['ctrl']=='product' || @$_REQUEST['view']=='product') && (@$_REQUEST['task']=='listing' || @$_REQUEST['layout']=='listing') && !empty($this->filters) && count($this->filters)){
echo JText::_('HIKASHOP_NO_RESULT');
}
However in the 2.6.4 view of product/listing.php this code has changed into:
Code:
}elseif(( !$this->module || JRequest::getVar('hikashop_front_end_main',0) ) && ((@$_REQUEST['ctrl']=='product' || @$_REQUEST['view']=='product') || (@$_REQUEST['ctrl']=='category' || @$_REQUEST['view']=='category')) && (@$_REQUEST['task']=='listing' || @$_REQUEST['layout']=='listing') && !empty($this->filters) && count($this->filters)){
echo JText::_('HIKASHOP_NO_RESULT');
}
But that situation needs a diferent text (like ''Sorry, no products in this category') instead of 'Sorry, no results found, try another search'.
Anyway, I don't want this text on the main page with the category listing.
I solved my problem by replacing the relevant code in the 2.6.4 version by the code in the 2.3.3 override. Now it works fine,
I don't know if this is a correct solution. Perhaps it's a configuration issue?
Regards,
Udo
Please Log in or Create an account to join the conversation.
9 years 10 months ago #255499
by nicolas
Replied by nicolas on topic Empty search text displays below category listing
Hi,
Yes, this was added as a fix because otherwise, people wouldn't get no results message on categories listing with filters.
So if you don't want that, reverting to the previous version of the code is the solution yes.
Yes, this was added as a fix because otherwise, people wouldn't get no results message on categories listing with filters.
So if you don't want that, reverting to the previous version of the code is the solution yes.
Please Log in or Create an account to join the conversation.
9 years 10 months ago #255786
by Udo
Replied by Udo on topic Empty search text displays below category listing
Hi,
Well, it's not so that I don't want the no result message on a categories listing with filter.
I don't want it on the main page with the categories overview. And I don't want it on any page showing an empty subcategory.
On my website this message does display on those pages.
It's caused by the search filter. The search module links to a menu with a listing of all products and works fine.
But after updating Hikashop the no results message is displayed on the categories overview because there are no products in the main category (only in subcategories).
After depublishing the filter this message is gone.
In the search filter in the Hikashop configuration I changed the field Category to Root and selected No subcategories. Then the no result mesage in the categories listing is gone too. But of course the filter does not work anymore so that's not the solution.
Where should I look to get the right solution?
regards,
Udo
Well, it's not so that I don't want the no result message on a categories listing with filter.
I don't want it on the main page with the categories overview. And I don't want it on any page showing an empty subcategory.
On my website this message does display on those pages.
It's caused by the search filter. The search module links to a menu with a listing of all products and works fine.
But after updating Hikashop the no results message is displayed on the categories overview because there are no products in the main category (only in subcategories).
After depublishing the filter this message is gone.
In the search filter in the Hikashop configuration I changed the field Category to Root and selected No subcategories. Then the no result mesage in the categories listing is gone too. But of course the filter does not work anymore so that's not the solution.
Where should I look to get the right solution?
regards,
Udo
Please Log in or Create an account to join the conversation.
9 years 10 months ago #255787
by nicolas
Replied by nicolas on topic Empty search text displays below category listing
Hi,
The display of the "no result message" is done if:
- There are filters for the current products listing
- The current product listing doesn't have any product found
And a category listing without products attached to the category matches these two criteria.
The ideal solution would be to add another condition that the message would only display if a filter has been used. However, on the view where that error message, there is no information on whether a filter is being used or not. And that's why it's done like that.
Change the line:
to:
in the "listing" file of the "product" view, and add the line:
$parent->filter_set = true;
before the line:
in administrator/components/com_hikashop/classes/filter.php and that should do just that.
The display of the "no result message" is done if:
- There are filters for the current products listing
- The current product listing doesn't have any product found
And a category listing without products attached to the category matches these two criteria.
The ideal solution would be to add another condition that the message would only display if a filter has been used. However, on the view where that error message, there is no information on whether a filter is being used or not. And that's why it's done like that.
Change the line:
Code:
} elseif(( !$this->module || JRequest::getVar('hikashop_front_end_main',0) ) && ((@$_REQUEST['ctrl']=='product' || @$_REQUEST['view']=='product') || (@$_REQUEST['ctrl']=='category' || @$_REQUEST['view']=='category')) && (@$_REQUEST['task']=='listing' || @$_REQUEST['layout']=='listing') && !empty($this->filters) && count($this->filters)){
Code:
} elseif(( !$this->module || JRequest::getVar('hikashop_front_end_main',0) ) && ((@$_REQUEST['ctrl']=='product' || @$_REQUEST['view']=='product') || (@$_REQUEST['ctrl']=='category' || @$_REQUEST['view']=='category')) && (@$_REQUEST['task']=='listing' || @$_REQUEST['layout']=='listing') && !empty($this->filters) && count($this->filters) && !empty($this->filter_set)){
$parent->filter_set = true;
before the line:
Code:
if($filter->filter_type=='instockcheckbox' && $infoGet[0]=='in_stock'){
Please Log in or Create an account to join the conversation.
9 years 10 months ago #255849
by Udo
Replied by Udo on topic Empty search text displays below category listing
Hi,
Thanks for your code. I applied your override and hack.
It works, This results in a no result message displayed only if the search results page is empty.
It's not displayed in an (sub)category with no products and in a (sub)category listing with no products
However on my website the same result is also achieved (without a hack) in the way described in my first post of this topic.
Perhaps because my (sub)category listings have no extra filters.
regards,
Udo
Thanks for your code. I applied your override and hack.
It works, This results in a no result message displayed only if the search results page is empty.
It's not displayed in an (sub)category with no products and in a (sub)category listing with no products
However on my website the same result is also achieved (without a hack) in the way described in my first post of this topic.
Perhaps because my (sub)category listings have no extra filters.
regards,
Udo
Please Log in or Create an account to join the conversation.
9 years 10 months ago #255850
by nicolas
Replied by nicolas on topic Empty search text displays below category listing
Hi,
The problem is that the change you mentioned in your first post was made especially to fix another problem.
The fix I proposed in my last message will allow to take into account all the different cases properly and thus we'll be able to include it on our end for the next version.
The problem is that the change you mentioned in your first post was made especially to fix another problem.
The fix I proposed in my last message will allow to take into account all the different cases properly and thus we'll be able to include it on our end for the next version.
Please Log in or Create an account to join the conversation.
Time to create page: 0.189 seconds