Skip to Content

New J2Commerce 6.6.5 is out. Here is everything in the release.

See What’s New
Account
Enter the email address on your account.
Forgot your username?
Enter your password.
Forgot your password?

Or continue with

Pending Public Category: Technical Support / Bugs Ticket #1030

# Bug report — Group Products 6.0.5: `CartHelper::getCurrentCartId()` does not exist

This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

J2Commerce

Version
J2Commerce v6

Conversation

Richard Sparks

## Summary

Setting any product's **Product Type** to **Group Products** breaks that product completely — both the admin article edit form and the frontend product page fatal with:

``` Error: Call to undefined method J2Commerce\Component\J2commerce\Administrator\Helper\CartHelper::getCurrentCartId() ```

This isn't an edge case — it's on the main render path every group product goes through, in both the admin form and every frontend skin.

## Environment

- Joomla 6.1.3, J2Commerce 6.6.1 - **Group Products 6.0.5** (`plg_j2commerce_app_groupproducts`, id 1055), installed today (2026-09-11), enabled, Template Type = UIkit - Old Group Products 4.0.3 (`j2store` variant) present but disabled — not a factor

## Steps to reproduce

1. Edit any article that's a J2Commerce product with Product Type = Simple (or any non-group type).
2. J2Commerce tab → **Change Product Type** → **Group Products** → **Confirm Change**.
3. The J2Commerce tab immediately shows a generic **"Error loading J2Commerce product form."** notice and the panel renders empty. The product type change itself *did* persist to the database (`#__j2commerce_products.product_type = 'groupproducts'`).
4. Visit the product on the frontend (`index.php?option=com_j2commerce&view=product&id=id`) — full Joomla error page, HTTP 500.

Reproduced against article/product id 84/16 ("All 4 Pre-Printed Grid Practice Panels") on a sandbox category built for this test.

## Root cause (traced via a CLI reproduction outside the generic try/catch that normally hides this)

`ProductHelper::getFullProduct()` → `applyBehaviorEnhancements()` → `Groupproducts::onAfterGetProduct()` (`administrator/components/com_j2commerce/src/Model/Behavior/ Groupproducts.php:301`) calls:

```php $cartId = CartHelper::getInstance()-getCurrentCartId(); ```

`CartHelper` (`administrator/components/com_j2commerce/src/Helper/ CartHelper.php`) has **no `getCurrentCartId()` method at all** — not a typo-able near-miss, the method simply isn't defined anywhere in the installed J2Commerce 6.6.1 core. `grep -r getCurrentCartId` across the whole codebase turns up **8 call sites, all inside the Group Products app**, none inside a definition:

- `administrator/components/com_j2commerce/src/Model/Behavior/Groupproducts.php` (lines 301, 443) - `plugins/j2commerce/app_groupproducts/source/admin/Model/Behavior/Groupproducts.php` (lines 301, 443 — build source copy) - `plugins/j2commerce/app_groupproducts/source/site/templates/{uikit,bootstrap5}/view_groups.php` - `plugins/j2commerce/app_uikit/tmpl/{uikit,tag_uikit}/view_groups.php` - `plugins/j2commerce/app_bootstrap5/tmpl/{bootstrap5,tag_bootstrap5}/view_groups.php`

So it's not just the admin form and one frontend skin — it's every group-product render path in every installed J2Commerce skin (UIkit and Bootstrap 5), admin and site.

## Likely fix

`CartHelper` does have a method that resolves/creates the shopper's current cart — `getCart(int $cartId = 0, bool $needCreateCart = true, string $cartType = 'cart'): ?object` (doc-tagged `@since 6.0.6`), which returns a cart row including `j2commerce_cart_id`. That strongly suggests Group Products 6.0.5 was built against an earlier/different J2Commerce core API where `CartHelper` exposed a `getCurrentCartId()` convenience method directly, and that method was renamed or folded into `getCart()` at some point before 6.6.1 without every Group Products call site being updated to match. The fix is presumably either:

- restore a thin `getCurrentCartId(): int` convenience method on `CartHelper` that wraps `getCart()-j2commerce_cart_id ?? 0`, or - update all 8 Group Products call sites to `CartHelper::getInstance()-getCart()-j2commerce_cart_id ?? 0`.

## Impact

Group Products 6.0.5 cannot be used at all against this J2Commerce 6.6.1 install — every group product 500s on both the edit screen and the storefront the moment it's created. Since this is the app's entire purpose, this is release-blocking, not a minor bug.

## Note on error visibility

Worth a mention while you're in there: the admin article-edit field (`plg_content_j2commerce`'s `J2commerceField::getInput()`) catches every `\Throwable` and always shows the same generic "Error loading J2Commerce product form." message, and logs via `Factory::getApplication()-getLogger()-error()` — which, at least in this environment, doesn't appear to write to any file under `administrator/logs/` (no logger registered for that category by default). Finding this bug required reproducing the render outside the try/catch via a CLI script. A logged category with a file logger registered by default (or at minimum surfacing the exception message when Joomla's Debug System is on) would have made this a five-minute diagnosis instead of an hour.

Adam Melcher Staff

Richard,

I just emailed you the latest beta that you need for the plugin to work. It is calling a function that is new in J2Commerce 6.6.2. It is most likely releasing later today - but I am already using it on some of my own sites so you will be good on this until the release.

 

Adam

Adam Melcher Staff

Richard,

I also looked into the article edit view error notifications and while AI was wrong (partly) in the last paragraph - it does have the Logger function writing to the administrator log files, it wasn't actually doing it so future debugging should be much easier between that and more specific error emssages.

 

Adam

Richard Sparks

Group Products is working now (thanks for the 6.6.1.23 beta) — I've built two bundles and both render correctly on their own product page (`index.php?option=com_j2commerce&view=product&id=id`): parent product with a live "Products in this group" table, correct prices/qty per child, Add to Basket.

My products don't use J2Commerce's own routed product/category pages, though — every product is a Joomla article, and all display content (images, description, price, cart) is placed via YOOtheme Pro's dynamic-content fields, including the ones your free **YOOtheme Pro Integration** app (`plg_system_yootheme_j2commerce`) adds. That's working well for simple products: binding a Text element to `Product ▸ Add to Cart` renders the full cart widget right on the article's own page. My images are are saved in Joomla custom fields and displayed through YOOtheme dynamic content slideshow element.

Question

**Is there a way to render the group-products picker itself — the table with a checkbox/qty per sub-product — somewhere other than the standalone `view=product` page?** Either:

- as its own field/context option on the YOOtheme integration (so it can go on the article's own page, the way `Product ▸ Add to Cart` does for simple products), or - as a shortcode mode I'm missing.

What I've found so far (may already be known to you)

Traced `ProductType::resolveAddToCart()` (the YOOtheme plugin's "Add to Cart" field) → it always calls `ProductLayoutService::renderLayout('list.category.item', $displayData)` — the category-listing-card layout. For group products, your own `item_groupproducts.php` comment explains why that card is just a link:

*"A grouped product has to be configured on its own page (which sub-products, at what quantity), so the list card always links through instead of offering an inline add-to-cart form — same reasoning as app_bundleproduct's card."*

Makes sense for a listing context. But since my product pages *are* single-item context already (one article = one product, no routed J2Commerce product page in use), I was hoping to land on the real picker there instead of a "View Product Details" link to a second page.

Also tried, both reverted after checking:

- `{j2commerce}id|cart{/j2commerce}` — resolves straight to `list.category.item_cart`, bypassing the product-type dispatcher. Renders a bare, non-functional "Add to Basket" button — no sub-product rows. - `{j2commerce}id|detail{/j2commerce}` — dispatches `onJ2CommerceViewProductHtml`. Rendered nothing when placed inside an article's own content field via the shortcode custom field (rather than reached through the normal `view=product` route).

If there's currently no built-in way to do this, no worries — just let me know and I'll either wait for a future release or find a workaround on my end (e.g. linking to the standalone product page instead of trying to embed the picker, and populating J2Commerce's own Images/Description fields for group products specifically so that page looks presentable).

I'm trying to upgrade my old J2Store sites to the current J2Commerce code but still retain the original configuration of product content, add to cart and checkout so I don't have to rebuild all my products.

Here's an example of my frontend v4 group product display I'm hoping to retain = https://www.quintessentialquilting.com/shop/notions/pre-printed-grid-practice-panels

Richard

Adam Melcher Staff

Richard,

The danger with relying on AI for every answer is it makes everything seem like the correct answer. While it was correct in the ProductLayoutService::renderLayout('list.category.item', $displayData) function - that only works for the layout files that generate the category layout views - not the product detail views (which is why it wouldn't find the table view in a category view layout file). I will look to see what is needed to make sure that functionality is included in a shortcode.

 

Adam

Richard Sparks

Group Products: is there a supported way to render the full picker outside view=product?

Context

My products aren't visited through J2Commerce's own routed category/product pages — every product is a Joomla article, and all display content (images, description, price, cart) is placed via YOOtheme Pro's dynamic-content fields, including the ones your free YOOtheme Pro Integration app (plg_system_yootheme_j2commerce) adds. That works great for simple products. For Group Products, it doesn't, and I now understand exactly why — I'd like to know if there's a supported way around it, or if this is just not possible.

What I traced

ProductType::resolveAddToCart() (plugins/system/yootheme_j2commerce/src/Module/Source/Type/ ProductType.php:188) — the field my "Add to Cart" element binds to — unconditionally calls:

ProductLayoutService::renderLayout('list.category.item', $displayData);

For a group product, that resolves to plugins/j2commerce/app_uikit/ layouts/app_uikit/list/category/item_groupproducts.php, whose own comment says the card intentionally link-throughs instead of embedding a picker. Makes complete sense for an actual category grid card. But I'm trying to put the Add To Cart and group product table directly on the product details page. A click-through to a page with only the table/button doesn't work there. 

The real picker — the groups and groupcart sub-templates that build the checkbox/qty table and add-to-cart form — only exist inside components/com_j2commerce/src/View/Product/HtmlView.php, reached via $this->loadTemplate('groups') / $this->loadTemplate('groupcart') on that specific View instance. ProductLayoutService::renderLayout() is a separate, lightweight partial renderer with no path to those templates.

I also checked whether your own mod_j2commerce_products module could be used as a workaround (a third party suggested modules "bypass" this check) — it doesn't; it also calls ProductLayoutService:: renderProductItem(), which hits the exact same list.category.item partial. So as far as I can tell, every embeddable entry point — the YOOtheme dynamic field, a raw {j2commerce} shortcode, and the official products module — converges on the same partial renderer, and none of them can reach the real picker.

The question

Is there a supported way to render the full group-product picker (the groups/groupcart output) for a specific product ID, outside of actually routing to view=product&id=X?

Either:

  • a dedicated dynamic-content field/context on the YOOtheme integration app that renders the full detail template instead of the category-card partial, or
  • a documented/supported entry point into Product\HtmlView (or equivalent) that a custom element or shortcode could call directly to get just that inner markup, or
  • confirmation that this genuinely isn't possible today, so I know to stop looking for a supported path and either accept a link-through or build something custom against internals (which I understand you can't support/guarantee going forward).

What I'm considering in the meantime

Since the card link field you expose (ProductType::resolveLink() → RouteHelper::getProductRoute(), always view=product&id=X) is the same working route regardless of product type, I'm adding a second, conditional link on group-product category cards specifically, so customers get to the real picker in one click instead of two (article → "View Product Details" → the actual page). That's a reasonable workaround on my end, but an inline picker would obviously be nicer if there's any supported way to get there.

Thanks again — sorry for the noise on the earlier version of this question; wanted to get you something more specific this time.

In J2Commerce version 4 and previous, adding the product short code to the parent product's details page displayed the grouped products table and add to cart button perfectly. But it no longer works in version 6+. 

Richard

 

Adam Melcher Staff

Richard,

I don't see why we can't expose it for list item views. I can see the use case with YT based sites. 

Let me se what I can do in the morning for you and other YT users...

 

Adam

Adam Melcher Staff

Richard,

This should already work in 6.6.2+ :

{j2commerce}<id>|detail{/j2commerce}

Have you tried this already?

Adam

Richard Sparks

Hi Adam,

Thanks. |detail works. On J2Commerce 6.6.3, {j2commerce}<id>|detail{/j2commerce} renders the full "Products in this group" table and Add to Basket for a group product on a Joomla article page built with YOOtheme Pro. 

The catch in a YOOtheme layout: |detail renders the entire product view. My article layout already shows the images, title, price and description, so the page showed them twice (title, "Starting From" price, SKU, short description, Description tab). The two-column product grid also rendered with an empty image column, which pushed the table to the right.

How I fixed it:  I created a template override of

plugins/j2commerce/app_uikit/tmpl/uikit/view_groupproducts.php

at

templates/yootheme/html/com_j2commerce/templates/uikit/view_groupproducts.php

The real product page (view=product) uses the same file, so the override checks the request. When option=com_j2commerce it loads the original file unchanged. Anywhere else, such as an article embedding |detail, it outputs only the add-to-cart <form>, meaning the groups and groupcart sub-templates plus their plugin events:

if (Factory::getApplication()->getInput()->getCmd('option') === 'com_j2commerce') { require JPATH_PLUGINS . '/j2commerce/app_uikit/tmpl/uikit/view_groupproducts.php'; return; } // ...otherwise output only the add-to-cart <form>

Result: the article page shows just the group table and Add to Basket, and the standalone product page is untouched.

Notes for others with the same setup (trying to display Grouped Products table and add-to-cart on the product details page:

  • For group products, |cart and the YOOtheme integration's Product ▸ Add to Cart field only render a "View Product Details" link. Use |detail instead when placing the shortcode on the product details page.
  • The override above is for the UIkit subtemplate. Sites using Bootstrap 5 would override app_bootstrap5/tmpl/bootstrap5/view_groupproducts.php the same way.
  • If you're migrating from J2Store 4, convert old {j2store}...{/j2store} shortcodes to {j2commerce}...{/j2commerce}, then disable the J2Store 4 content plugin before testing. While it's enabled it renders the old shortcodes itself, which can make a J2Commerce setup look like it's working when it isn't.
  • Joomla's override-change notice might not flag this file after an update. I think Joomla looks for the original of an html/com_j2commerce/... override in the component's tmpl folder, but this one lives in the app_uikit plugin. You might have to manually compare the override against the new version original after J2Commerce or Group Products updates to see if there have been any changes in that file (Adam: this applies to every J2Commerce subtemplate override. Making them detectable by Joomla's check would help users.)

Suggestion: a built-in shortcode option that renders only the add-to-cart form would make this work without an override, for group products and any other type that uses the full product view. Something like |detailcart.

Thanks again for the quick help, and your patience with my ignorance!

Richard

Adam Melcher Staff

Richard,

6.6.4 (releasing soon) has already fixed the tmpl override issue with the plugins and they will behave the same way Joomla plugins with tmpl overrides behave as well. 

We try to get these resolved as quickly as possible and appreciate your patience as items like this can be frustrating for anyone. 

FYI - there is a new J2Commerce JUG that is about to launch soon that is going to be run by SD and Jose that you might be interested in:

https://j2commercejug.com/

 

Adam

Richard Sparks

Looking forward to version 6.6.4. I understand you have a LOT to do - all at once - as quickly as possible. Not an easy task. So I appreciate your stamina and persistence, and patience with users like me.

Thanks for the JUG tip!

Adam Melcher Staff

Richard,

I knew what I was signing up for when I started this journey... ;)

Glad I am able to help your projects.

 

Adam