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

#   Title: 500 error "A key is required" when opening checkout without Itemid (Jooml

##

- **[Sinus](/forum/user/44473-sinus "View Sinus's Profile")**
- [![Sinus's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/44473-sinus "View Sinus's Profile") Topic Author
- [ Offline](/forum/user/44473-sinus)

Less More

- Posts: 8
- Thank you received: 0
-
-

2 weeks 6 days ago -  2 weeks 6 days ago [\#100000242](#100000242) by [Sinus](/forum/user/44473-sinus "View Sinus's Profile")  *[Title: 500 error "A key is required" when opening checkout without Itemid (Jooml](/forum/27-checkout/100000049-title-500-error-a-key-is-required-when-opening-checkout-without-itemid-jooml#100000242 "-- url of the page with the problem -- :   www.greenfirezuidlaren.nl/  -- HikaShop version -- : 6.6.0 (Business) -- Joomla version -- : 6.1.3 -- PHP version -- : 8.4.25 -- Browser(s) name and version -- :  Chrome 155.0 -- Error-message(debug-mod must be tuned on) -- : : 0 - A key is required  Hi,  I ran into a 500 error on our shop (  www.greenfirezuidlaren.nl ) and tracked it down to the checkout controller. It looks like a Joomla 6 compatibility issue, so I thought I'd share what I found.  Our setup: Joomla 6.1.3, PHP 8.4.25, HikaShop Business 6.6.0 and YOOtheme Pro 5. The checkout menu item is set in the HikaShop configuration (checkout&#95;itemid 434, SEF name &quot;afrekenen&quot;).  What happens: when a visitor has something in their cart and opens the checkout without an Itemid in the URL, they get a 500 page saying &quot;0 - A key is required&quot;. For example:    www.greenfirezuidlaren.nl/component/hikashop/checkout  We mostly saw this through old add-to-cart links like /component/hikashop/product/updatecart/add-1/cid-66, which redirect to that URL.  A few things I noticed while testing: - With an empty cart (or no session at all) there's no error, you just get redirected to the product listing. - As soon as there's any Itemid in the URL, even one that doesn't exist, HikaShop redirects nicely to the checkout menu item. - It also happens with tmpl=component and format=raw, so it's not the template.  I briefly turned on Joomla debug to get the stack trace:  1  JROOT/libraries/vendor/joomla/database/src/DatabaseQuery.php:1890 2  Joomla&#92;Database&#92;DatabaseQuery-&gt;bind()   JROOT/libraries/vendor/joomla/database/src/DatabaseQuery.php:1988 3  Joomla&#92;Database&#92;DatabaseQuery-&gt;bindArray()   JROOT/libraries/src/Language/Associations.php:126 4  Joomla&#92;CMS&#92;Language&#92;Associations::getAssociations()   JROOT/administrator/components/com&#95;menus/src/Helper/MenusHelper.php:281 5  Joomla&#92;Component&#92;Menus&#92;Administrator&#92;Helper&#92;MenusHelper::getAssociations()   JROOT/components/com&#95;hikashop/controllers/checkout.php:159 6  checkoutController-&gt;show()   JROOT/libraries/src/MVC/Controller/BaseController.php:738 7  hikashopController-&gt;execute()   JROOT/administrator/components/com&#95;hikashop/helpers/helper.php:3167 8  require&#95;once()   JROOT/components/com&#95;hikashop/hikashop.php:85  So as far as I can tell, line 159 of checkout.php calls MenusHelper::getAssociations() with an empty menu item id when there's no Itemid. Joomla 6 then hands an empty array to bindArray(), which throws the exception. Joomla 5 didn't complain about this, which is probably why it hasn't come up before.  I noticed the changelog for 6.5.1 mentions a change to this same block (the multilingual menu associations in the checkout, which now only runs when the Joomla classes exist). Maybe a check on the menu item id could be added there as well. We're on 6.6.0, which is the latest version available to us.  A simple guard would probably fix it: only call getAssociations() when the menu item id is above 0, or fall back to the configured checkout&#95;itemid first.  For now I've added this to our .htaccess as a workaround, and that works fine:  Because of that workaround, the link above now redirects instead of showing the error.   Best regards, Sinus")* was created by *[Sinus](/forum/user/44473-sinus "View Sinus's Profile")*

-- url of the page with the problem -- : [ www.greenfirezuidlaren.nl/](https://www.greenfirezuidlaren.nl/)
-- HikaShop version -- : 6.6.0 (Business)
-- Joomla version -- : 6.1.3
-- PHP version -- : 8.4.25
-- Browser(s) name and version -- :  Chrome 155.0
-- Error-message(debug-mod must be tuned on) -- : : 0 - A key is required

Hi,

I ran into a 500 error on our shop ([ www.greenfirezuidlaren.nl](https://www.greenfirezuidlaren.nl)) and tracked it down to the checkout controller. It looks like a Joomla 6 compatibility issue, so I thought I'd share what I found.

Our setup: Joomla 6.1.3, PHP 8.4.25, HikaShop Business 6.6.0 and YOOtheme Pro 5. The checkout menu item is set in the HikaShop configuration (checkout_itemid 434, SEF name "afrekenen").

What happens: when a visitor has something in their cart and opens the checkout without an Itemid in the URL, they get a 500 page saying "0 - A key is required". For example:

[ www.greenfirezuidlaren.nl/component/hikashop/checkout](https://www.greenfirezuidlaren.nl/component/hikashop/checkout)

We mostly saw this through old add-to-cart links like /component/hikashop/product/updatecart/add-1/cid-66, which redirect to that URL.

A few things I noticed while testing:
- With an empty cart (or no session at all) there's no error, you just get redirected to the product listing.
- As soon as there's any Itemid in the URL, even one that doesn't exist, HikaShop redirects nicely to the checkout menu item.
- It also happens with tmpl=component and format=raw, so it's not the template.

I briefly turned on Joomla debug to get the stack trace:

1  JROOT/libraries/vendor/joomla/database/src/DatabaseQuery.php:1890
2  Joomla\Database\DatabaseQuery-&gt;bind()
  JROOT/libraries/vendor/joomla/database/src/DatabaseQuery.php:1988
3  Joomla\Database\DatabaseQuery-&gt;bindArray()
  JROOT/libraries/src/Language/Associations.php:126
4  Joomla\CMS\Language\Associations::getAssociations()
  JROOT/administrator/components/com_menus/src/Helper/MenusHelper.php:281
5  Joomla\Component\Menus\Administrator\Helper\MenusHelper::getAssociations()
  JROOT/components/com_hikashop/controllers/checkout.php:159
6  checkoutController-&gt;show()
  JROOT/libraries/src/MVC/Controller/BaseController.php:738
7  hikashopController-&gt;execute()
  JROOT/administrator/components/com_hikashop/helpers/helper.php:3167
8  require_once()
  JROOT/components/com_hikashop/hikashop.php:85

So as far as I can tell, line 159 of checkout.php calls MenusHelper::getAssociations() with an empty menu item id when there's no Itemid. Joomla 6 then hands an empty array to bindArray(), which throws the exception. Joomla 5 didn't complain about this, which is probably why it hasn't come up before.

I noticed the changelog for 6.5.1 mentions a change to this same block (the multilingual menu associations in the checkout, which now only runs when the Joomla classes exist). Maybe a check on the menu item id could be added there as well. We're on 6.6.0, which is the latest version available to us.

A simple guard would probably fix it: only call getAssociations() when the menu item id is above 0, or fall back to the configured checkout_itemid first.

For now I've added this to our .htaccess as a workaround, and that works fine:
Code:

RewriteCond %{QUERY_STRING} !(^&#124;&amp;)Itemid=[0-9] RewriteRule ^component/hikashop/checkout(/show)?/?$ /kachelbrandstoffen/afrekenen [R=301,L,QSA]

Because of that workaround, the link above now redirects instead of showing the error. 

Best regards,
Sinus

Last edit: 2 weeks 6 days ago by [Sinus](/forum/user/44473-sinus "View Sinus's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzEwMDAwMDA0OS10aXRsZS01MDAtZXJyb3ItYS1rZXktaXMtcmVxdWlyZWQtd2hlbi1vcGVuaW5nLWNoZWNrb3V0LXdpdGhvdXQtaXRlbWlkLWpvb21sP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) 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: 86323
- Thank you received: 14283
-
-

2 weeks 6 days ago [\#100000245](#100000245) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Title: 500 error "A key is required" when opening checkout without Itemid (Jooml](/forum/27-checkout/100000049-title-500-error-a-key-is-required-when-opening-checkout-without-itemid-jooml#100000245 "-- url of the page with the problem -- :   www.greenfirezuidlaren.nl/  -- HikaShop version -- : 6.6.0 (Business) -- Joomla version -- : 6.1.3 -- PHP version -- : 8.4.25 -- Browser(s) name and version -- :  Chrome 155.0 -- Error-message(debug-mod must be tuned on) -- : : 0 - A key is required  Hi,  I ran into a 500 error on our shop (  www.greenfirezuidlaren.nl ) and tracked it down to the checkout controller. It looks like a Joomla 6 compatibility issue, so I thought I'd share what I found.  Our setup: Joomla 6.1.3, PHP 8.4.25, HikaShop Business 6.6.0 and YOOtheme Pro 5. The checkout menu item is set in the HikaShop configuration (checkout&#95;itemid 434, SEF name &quot;afrekenen&quot;).  What happens: when a visitor has something in their cart and opens the checkout without an Itemid in the URL, they get a 500 page saying &quot;0 - A key is required&quot;. For example:    www.greenfirezuidlaren.nl/component/hikashop/checkout  We mostly saw this through old add-to-cart links like /component/hikashop/product/updatecart/add-1/cid-66, which redirect to that URL.  A few things I noticed while testing: - With an empty cart (or no session at all) there's no error, you just get redirected to the product listing. - As soon as there's any Itemid in the URL, even one that doesn't exist, HikaShop redirects nicely to the checkout menu item. - It also happens with tmpl=component and format=raw, so it's not the template.  I briefly turned on Joomla debug to get the stack trace:  1  JROOT/libraries/vendor/joomla/database/src/DatabaseQuery.php:1890 2  Joomla&#92;Database&#92;DatabaseQuery-&gt;bind()   JROOT/libraries/vendor/joomla/database/src/DatabaseQuery.php:1988 3  Joomla&#92;Database&#92;DatabaseQuery-&gt;bindArray()   JROOT/libraries/src/Language/Associations.php:126 4  Joomla&#92;CMS&#92;Language&#92;Associations::getAssociations()   JROOT/administrator/components/com&#95;menus/src/Helper/MenusHelper.php:281 5  Joomla&#92;Component&#92;Menus&#92;Administrator&#92;Helper&#92;MenusHelper::getAssociations()   JROOT/components/com&#95;hikashop/controllers/checkout.php:159 6  checkoutController-&gt;show()   JROOT/libraries/src/MVC/Controller/BaseController.php:738 7  hikashopController-&gt;execute()   JROOT/administrator/components/com&#95;hikashop/helpers/helper.php:3167 8  require&#95;once()   JROOT/components/com&#95;hikashop/hikashop.php:85  So as far as I can tell, line 159 of checkout.php calls MenusHelper::getAssociations() with an empty menu item id when there's no Itemid. Joomla 6 then hands an empty array to bindArray(), which throws the exception. Joomla 5 didn't complain about this, which is probably why it hasn't come up before.  I noticed the changelog for 6.5.1 mentions a change to this same block (the multilingual menu associations in the checkout, which now only runs when the Joomla classes exist). Maybe a check on the menu item id could be added there as well. We're on 6.6.0, which is the latest version available to us.  A simple guard would probably fix it: only call getAssociations() when the menu item id is above 0, or fall back to the configured checkout&#95;itemid first.  For now I've added this to our .htaccess as a workaround, and that works fine:  Because of that workaround, the link above now redirects instead of showing the error.   Best regards, Sinus")*

Hi,

Thank you for the detailed analysis, you are right. The cause is a change in Joomla 6.2: Joomla's association lookup now accepts several ids and fails with "A key is required" when it receives no id, which is what the checkout passes when the URL has no Itemid. Note that this code only exists from Joomla 6.2.0 on (the Associations.php line in your stack trace), so your site is most likely running a 6.2.x version rather than 6.1.3.

We have fixed it: HikaShop now only looks up the menu associations when there is a menu item id, so /component/hikashop/checkout redirects again to the checkout menu item set in the configuration.

Download the install package of HikaShop on our website and install it on yours in order to get the patch and it should then work fine.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzEwMDAwMDA0OS10aXRsZS01MDAtZXJyb3ItYS1rZXktaXMtcmVxdWlyZWQtd2hlbi1vcGVuaW5nLWNoZWNrb3V0LXdpdGhvdXQtaXRlbWlkLWpvb21sP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[Sinus](/forum/user/44473-sinus "View Sinus's Profile")**
- [![Sinus's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/44473-sinus "View Sinus's Profile") Topic Author
- [ Offline](/forum/user/44473-sinus)

Less More

- Posts: 8
- Thank you received: 0
-
-

2 weeks 5 days ago [\#100000252](#100000252) by [Sinus](/forum/user/44473-sinus "View Sinus's Profile")  Replied by *[Sinus](/forum/user/44473-sinus "View Sinus's Profile")* on topic *[Title: 500 error "A key is required" when opening checkout without Itemid (Jooml](/forum/27-checkout/100000049-title-500-error-a-key-is-required-when-opening-checkout-without-itemid-jooml#100000252 "-- url of the page with the problem -- :   www.greenfirezuidlaren.nl/  -- HikaShop version -- : 6.6.0 (Business) -- Joomla version -- : 6.1.3 -- PHP version -- : 8.4.25 -- Browser(s) name and version -- :  Chrome 155.0 -- Error-message(debug-mod must be tuned on) -- : : 0 - A key is required  Hi,  I ran into a 500 error on our shop (  www.greenfirezuidlaren.nl ) and tracked it down to the checkout controller. It looks like a Joomla 6 compatibility issue, so I thought I'd share what I found.  Our setup: Joomla 6.1.3, PHP 8.4.25, HikaShop Business 6.6.0 and YOOtheme Pro 5. The checkout menu item is set in the HikaShop configuration (checkout&#95;itemid 434, SEF name &quot;afrekenen&quot;).  What happens: when a visitor has something in their cart and opens the checkout without an Itemid in the URL, they get a 500 page saying &quot;0 - A key is required&quot;. For example:    www.greenfirezuidlaren.nl/component/hikashop/checkout  We mostly saw this through old add-to-cart links like /component/hikashop/product/updatecart/add-1/cid-66, which redirect to that URL.  A few things I noticed while testing: - With an empty cart (or no session at all) there's no error, you just get redirected to the product listing. - As soon as there's any Itemid in the URL, even one that doesn't exist, HikaShop redirects nicely to the checkout menu item. - It also happens with tmpl=component and format=raw, so it's not the template.  I briefly turned on Joomla debug to get the stack trace:  1  JROOT/libraries/vendor/joomla/database/src/DatabaseQuery.php:1890 2  Joomla&#92;Database&#92;DatabaseQuery-&gt;bind()   JROOT/libraries/vendor/joomla/database/src/DatabaseQuery.php:1988 3  Joomla&#92;Database&#92;DatabaseQuery-&gt;bindArray()   JROOT/libraries/src/Language/Associations.php:126 4  Joomla&#92;CMS&#92;Language&#92;Associations::getAssociations()   JROOT/administrator/components/com&#95;menus/src/Helper/MenusHelper.php:281 5  Joomla&#92;Component&#92;Menus&#92;Administrator&#92;Helper&#92;MenusHelper::getAssociations()   JROOT/components/com&#95;hikashop/controllers/checkout.php:159 6  checkoutController-&gt;show()   JROOT/libraries/src/MVC/Controller/BaseController.php:738 7  hikashopController-&gt;execute()   JROOT/administrator/components/com&#95;hikashop/helpers/helper.php:3167 8  require&#95;once()   JROOT/components/com&#95;hikashop/hikashop.php:85  So as far as I can tell, line 159 of checkout.php calls MenusHelper::getAssociations() with an empty menu item id when there's no Itemid. Joomla 6 then hands an empty array to bindArray(), which throws the exception. Joomla 5 didn't complain about this, which is probably why it hasn't come up before.  I noticed the changelog for 6.5.1 mentions a change to this same block (the multilingual menu associations in the checkout, which now only runs when the Joomla classes exist). Maybe a check on the menu item id could be added there as well. We're on 6.6.0, which is the latest version available to us.  A simple guard would probably fix it: only call getAssociations() when the menu item id is above 0, or fall back to the configured checkout&#95;itemid first.  For now I've added this to our .htaccess as a workaround, and that works fine:  Because of that workaround, the link above now redirects instead of showing the error.   Best regards, Sinus")*

Thanks for the quick fix and the explanation! You're right, I double-checked and the site is running Joomla 6.2.0 with PHP 8.5.11, not 6.1.3, sorry for the confusion. I'll install the updated package and report back if anything is still off.

Sinus

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzEwMDAwMDA0OS10aXRsZS01MDAtZXJyb3ItYS1rZXktaXMtcmVxdWlyZWQtd2hlbi1vcGVuaW5nLWNoZWNrb3V0LXdpdGhvdXQtaXRlbWlkLWpvb21sP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) 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.060 seconds

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