[Skip to main content](#vessel-content)

#   Product Insertion plugin throws JResponse error in Joomla 4

##

- **[icomex](/forum/user/4967-icomex "View icomex's Profile")**
- [![icomex's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4967.png)](/forum/user/4967-icomex "View icomex's Profile") Topic Author
- [ Offline](/forum/user/4967-icomex)

Less More

- Posts: 149
- Thank you received: 6
-
-

5 years 7 months ago [\#331544](#331544) by [icomex](/forum/user/4967-icomex "View icomex's Profile")  *[Product Insertion plugin throws JResponse error in Joomla 4](/forum/3-bug-report/902337-product-insertion-plugin-throws-jresponse-error-in-joomla-4#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.")* was created by *[icomex](/forum/user/4967-icomex "View icomex's Profile")*

-- 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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC85MDIzMzctcHJvZHVjdC1pbnNlcnRpb24tcGx1Z2luLXRocm93cy1qcmVzcG9uc2UtZXJyb3ItaW4tam9vbWxhLTQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

5 years 7 months ago [\#331548](#331548) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Product Insertion plugin throws JResponse error in Joomla 4](/forum/3-bug-report/902337-product-insertion-plugin-throws-jresponse-error-in-joomla-4#331548 "-- 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.")*

Hi,

You need to replace:
if(!strpos($body, $modal)){
by:
if(!empty($modal) &amp;&amp; !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](/forum/user/4967-icomex "View icomex's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC85MDIzMzctcHJvZHVjdC1pbnNlcnRpb24tcGx1Z2luLXRocm93cy1qcmVzcG9uc2UtZXJyb3ItaW4tam9vbWxhLTQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[icomex](/forum/user/4967-icomex "View icomex's Profile")**
- [![icomex's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4967.png)](/forum/user/4967-icomex "View icomex's Profile") Topic Author
- [ Offline](/forum/user/4967-icomex)

Less More

- Posts: 149
- Thank you received: 6
-
-

5 years 7 months ago -  5 years 7 months ago [\#331562](#331562) by [icomex](/forum/user/4967-icomex "View icomex's Profile")  Replied by *[icomex](/forum/user/4967-icomex "View icomex's Profile")* on topic *[Product Insertion plugin throws JResponse error in Joomla 4](/forum/3-bug-report/902337-product-insertion-plugin-throws-jresponse-error-in-joomla-4#331562 "-- 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.")*

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: 5 years 7 months ago by [icomex](/forum/user/4967-icomex "View icomex's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC85MDIzMzctcHJvZHVjdC1pbnNlcnRpb24tcGx1Z2luLXRocm93cy1qcmVzcG9uc2UtZXJyb3ItaW4tam9vbWxhLTQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

5 years 7 months ago [\#331563](#331563) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Product Insertion plugin throws JResponse error in Joomla 4](/forum/3-bug-report/902337-product-insertion-plugin-throws-jresponse-error-in-joomla-4#331563 "-- 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.")*

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: Code:

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: Code:

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](/forum/user/4967-icomex "View icomex's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC85MDIzMzctcHJvZHVjdC1pbnNlcnRpb24tcGx1Z2luLXRocm93cy1qcmVzcG9uc2UtZXJyb3ItaW4tam9vbWxhLTQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.053 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
