No Results Page for Search Filter

  • Posts: 214
  • Thank you received: 1
11 years 1 month ago #127896

Hi There,

I'm using the Hikashop filter module, but I've got one small issue. If I do a search and there are no products found, it just takes me to a blank page.

For example, if you use my site www.craftkeg.com/ and tick EcoKeg and do the search it'll go to hikashop-menu-for-products-listing/product/listing which is not very helpful as it's blank, a customer might think the search is broken.

Is there a way to edit this page to insert some text to say "No products found, try again", or is there another way of handling search results?

Regards,

Matthew

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #127953

Hi,

You probably can edit the view "product / listing_div" via the menu display > views and if "$this->rows" is empty display your message.

Please Log in or Create an account to join the conversation.

  • Posts: 214
  • Thank you received: 1
11 years 1 month ago #127964

Hi There, thanks for your response.

I'm looking at the view and I can see all the PHP code, but I'm afraid I know it enough to understand some of it, but not nearly enough to write my own!

Could you give me a clue on what the PHP code would look like if I wanted to add a 'No Results Found' found message if "$this->rows" is empty?

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 1 month ago #127977

Using some php code like this will probably do the job :

if(empty($this->rows)){
echo 'No Results Found';
}

The following user(s) said Thank You: milesreid

Please Log in or Create an account to join the conversation.

  • Posts: 214
  • Thank you received: 1
11 years 1 month ago #127985

Hi Again Mohamed,

That did the trick, however it displays the message twice. Is there a certain place I put the code or is there another reason that is happening?

Please Log in or Create an account to join the conversation.

  • Posts: 214
  • Thank you received: 1
11 years 1 month ago #127986

If you look at this page www.craftkeg.com/index.php/all-products/view-by-brewer you can see the text appearing on the buttom. I assume this is because of the assosicated module (hikashop_category_information_module_199 according to Firebug), is there a way to hide this module appearing on the page without having to delete it, as I assume that will affect the category listings?

Last edit: 11 years 1 month ago by matps.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #128092

Hi,

The easiest way seems to be to change the code given by Mohamed by this one:

if(empty($this->rows) && !$this->module){
echo 'No Results Found';
}
This will check if you are in a module, if it is, the text is not displayed.

The following user(s) said Thank You: matps

Please Log in or Create an account to join the conversation.

  • Posts: 214
  • Thank you received: 1
11 years 1 month ago #128140

Thanks Xavier, that worked a treat!

I've actually got something else to ask that I'm struggling with.

Under show_deafult view I'm using the following code to show the products brand (which I'm calling 'container') on a product page, like so www.craftkeg.com/index.php/hikashop-menu...ng/product/263-mocha

<p><strong>Container: </strong><?php $class = hikashop_get('class.category');
$manufacturer = $class->get($this->element->product_manufacturer_id);
echo $manufacturer->category_name; ?></p>
<span id="hikashop_product_price_main" class="hikashop_product_price_main">

If I wanted to add the brand to a product listing page ( www.craftkeg.com/index.php/hikashop-menu...ting/product/listing ) would I be able to use that same code into a different view to get the 'brand' displaying on this page as well?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #128202

Yes you can, you will maybe have to replace "element" by "row" but that should work.
The view to edit is probably "product / listing_img_title".

The following user(s) said Thank You: matps

Please Log in or Create an account to join the conversation.

  • Posts: 37
  • Thank you received: 1
8 years 7 months ago #236454

Hi Xavier,

I have added this code to.. and it worked.
If have two questions about this :

  1. Can i add an image ?
  2. Can i show random products below these row ?

Thank you very much !

Kind regards,

Danny Kunst

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 7 months ago #236496

Hi,

Sure.
1. Instead of :

echo 'No Results Found';
you can use:
echo '<img src="http://www.yourwebite.com/your/image.jpg"/>';

2. You can create a module of the type "HikaShop content module" via the Joomla modules manager, and then use the extension "modules anywhere" to add the tag of the display of the module :
extensions.joomla.org/extension/modules-anywhere

Please Log in or Create an account to join the conversation.

  • Posts: 17
  • Thank you received: 0
8 years 1 week ago #255444

This still works in 2.6.4 - three years later !
thx
Miles

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 1 week ago #255462

Hi,

Yes. However, you don't need any code modification anymore.
You can now simply add a translation override like that:
HIKASHOP_NO_RESULT="No results found"

www.hikashop.com/download/languages.html#modify

The following user(s) said Thank You: milesreid

Please Log in or Create an account to join the conversation.

  • Posts: 17
  • Thank you received: 0
8 years 1 week ago #255480

Silly me!
Thanks Nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.088 seconds
Powered by Kunena Forum