Product Insertion plugin throws JResponse error in Joomla 4

  • Posts: 144
  • Thank you received: 4
  • Hikashop Business
3 years 7 months ago #331544

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 4.0 beta 7

The Product Insertion Plugin loads /viiews/product/viiew.html.php which uses JResponse which is gone in Joomla 4. All the JResponse usages seem to test for the Class until the final one which replaces the Body of the Response object. Documentation for JResponse suggests using JApplicationWeb, but a straightforward find and replace throws an error regarding a $this reference within that class.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 7 months ago #331548

Hi,

You need to replace:
if(!strpos($body, $modal)){
by:
if(!empty($modal) && !strpos($body, $modal)){
in that file since $modal will be null on Joomla 4.
I've tested the change on my end and it fixes the problem. We'll add that patch for the next version.

The following user(s) said Thank You: icomex

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

  • Posts: 144
  • Thank you received: 4
  • Hikashop Business
3 years 7 months ago #331562

That works beautifully! Thank you very much - that solves a big challenge for me.

A very minor thing to check on - in the JCE Editor, HikaShop's product insertion button appears while you are editing an article, however, in the editor interface shown while you are editing a Custom Content Module instance, the insert button doesn't appear at all. I believe the insertion code still swaps out properly if you copy paste into the content box, there's just no insertion tool.

Last edit: 3 years 7 months ago by icomex.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 7 months ago #331563

Hi,

Thanks for the feedback. That's because in the file plugins/editors-xtd/hikashopproduct/hikashopproduct.php we have a check to only display the button for a specific list of components:

if(!in_array($extension, array('com_content', 'com_tz_portfolio', 'com_k2', 'com_jevents')))
			return;
We do that to avoid incompatibilities with some 3rd party extensions.
You can change that code to:
if(!in_array($extension, array('com_content', 'com_tz_portfolio', 'com_k2', 'com_jevents', 'com_modules')))
			return;
and it will display on the modules manager. We'll add that change on our end.

The following user(s) said Thank You: icomex

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

Time to create page: 0.109 seconds
Powered by Kunena Forum