Hikashop content module override

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 5 months ago #352691

-- HikaShop version -- : 4.7.4
-- Joomla version -- : 4

I need to show some info (link) before module layout, next to module title. But this info is specific for each module.
With joomla modules is easy to select custom layout in advanced tab. So you can have diferent module output.

In Hika modules there is no such option. I only can override inner layout of module. If I look at layout files, product / listing.php is the right one.
If I make an module override via template override, I cant select that override in module.

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 5 months ago #352693

Hi,

Try changing the code:

name="moduleclass_sfx"
					type="text"
					label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" />
to:
<field
					name="layout"
					type="modulelayout"
					label="JFIELD_ALT_LAYOUT_LABEL"
					class="form-select"
					description="JFIELD_ALT_MODULE_LAYOUT_DESC"
					validate="moduleLayout"
				/>
				<field
					name="moduleclass_sfx"
					type="textarea"
					label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
					description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
					rows="3"
					validate="CssIdentifier"
				/>
in the file modules/mod_hikashop/mod_hikashop.xml and it should add the setting.
Please let us know whether it works fine or not so that we can validate the change for the next release.

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 5 months ago #352704

Edit...file must be named without underline.
With added code I can see select field, but new layout can not be selected.


Attachments:
Last edit: 1 year 5 months ago by mojweb.

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 5 months ago #352705

With file name defaultnew.php I can select it, but changes are not in output.

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 5 months ago #352706

Hi,

Change the line:
require(JModuleHelper::getLayoutPath('mod_hikashop'));
to:
require(JModuleHelper::getLayoutPath('mod_hikashop', $params->get('layout', 'default')));
in modules/mod_hikashop/mod_hikashop.php and it should work.

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 5 months ago #352708

Now working. Thank you.

The following user(s) said Thank You: nicolas

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

  • Posts: 323
  • Thank you received: 18
  • Hikashop Business
1 year 4 months ago #354048

Please add to next release. Version 4.7.5 is without that.

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 4 months ago #354050

Hi,

Yes, HikaShop 4.7.5 was a bug fix release.
All new improvments and new features we've been working on in the previous month, including this modification have not been added to it.
Next version, in September, will include that change.

The following user(s) said Thank You: mojweb

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

  • Posts: 121
  • Thank you received: 18
  • Hikashop Business
1 year 4 days ago #357586

Hello,

I'm joining this conservation because I'm trying to override a HikaShop module (associated products). When I create the override I get in my template folder in the html\mod_hikashop folder with the default.php file. If I rename it I can choose this override for the module in the back office but I cannot customize it. There are just a few lines of code:

defined('_JEXEC') or die('Restricted access');
?><?php if(!empty($html)){ ?>
<div id="hikashop_module_<?php echo $module->id;?>" class="hikashop_module <?php echo (!empty($module->params) && is_array($module->params) ? @$module ->params['moduleclass_sfx']: ''); ?>">
<?php echo $html; ?>
</div>
<?php } ?>

with the $html variable which contains the rendering of the module but I don't see how to customize it.

How should it be done?

Thanks

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

  • Posts: 83007
  • Thank you received: 13399
  • MODERATOR
1 year 3 days ago #357591

Hi,

Customization of HikaShop modules can be done the same way you can customize the views of the main component, as explained here:
www.hikashop.com/support/documentation/1...-display.html#layout
So please follow the instructions there.
Note that products listing modules use the same view files as products listings menu items. So when you customize the views, if you want to affect only a particular module or menu item, you'll need to have some condition.

The following user(s) said Thank You: easyconnect83

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

  • Posts: 121
  • Thank you received: 18
  • Hikashop Business
1 year 3 days ago #357598

Thank you for the details. So I needed to make a condition in the product/listing_div.php file.

If anyone is interested, I put this code in the product / listing_div.php view

$id_mod = $this->params->get('id');
if($this->module) {
	$id_mod = $this->params->get('id');
}

to retrieve the id of the module called and make the condition accordingly below:

<?php if ($id_mod!=124 && $id_mod!=117) : ?>
...

124 and 117 are the module numbers in my back office for which I want a different display.

Have a good day

Last edit: 1 year 3 days ago by easyconnect83.
The following user(s) said Thank You: Philip, Valserine

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

Time to create page: 0.097 seconds
Powered by Kunena Forum