Custom module position in lisiting_div causes "500 - Layout listing_ not found."

  • Posts: 29
  • Thank you received: 1
7 years 7 months ago #279081

-- HikaShop version -- : 3.2.0
-- Joomla version -- : 3.7.5
-- PHP version -- : 7.0.23
-- Error-message(debug-mod must be tuned on) -- : 500 - Layout listing_ not found.

This is a strange one! I want to put a filter in a custom position on a product page.

The position is below the actual product so I customised the listing_div layout and used code like this to display a module"

			<?php
jimport( 'joomla.application.module.helper' );
$modules = JModuleHelper::getModules( 'productfilter' );
foreach ($modules as $module) {
echo JModuleHelper::renderModule( $module );
}
?>

This works in other places in my customisations, for example I use this code to display a filter on my product category page.

But for some reason it causes an error: 500 - Layout listing_ not found.

If I unpublish the module, but leave the code in the layout over-ride then the error goes.

If I publish the same module on the same page in a proper template module position then its fine, and the module will show.

So I am asking if there is something special about the listing_div.php code which might prevent a custom module position.

Many thanks!

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

  • Posts: 83746
  • Thank you received: 13549
  • MODERATOR
7 years 7 months ago #279085

Hi,

It's a reference issue. The rendering of the module must overwrite the $this->params array where all the display settings are stored for the view display.
Before your code, add:
$params = $this->params;
And after your code, add:
$this->params = $params;

That should save the params and circumvent the issue.

The following user(s) said Thank You: roojai

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

  • Posts: 29
  • Thank you received: 1
7 years 7 months ago #279118

Perfect - that worked!

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

Time to create page: 0.055 seconds
Powered by Kunena Forum