Bug Report
Current Behavior
Rendering a cartproducts_listproducts (or cartproducts_showproduct) plugin whose product has a category throws a fatal error:
Call to undefined method TYPO3\CMS\Extbase\Domain\Model\Category::getCartProductShowPid()
in Classes/ViewHelpers/Link/ProductViewHelper.php line 102
Expected behavior/output
The extended Extcode\CartProducts\Domain\Model\Category (which provides getCartProductShowPid() / getCartProductListPid()) should be used wherever a category is loaded via a product, so the plugin renders without error.
Environment
- TYPO3 version(s): 14.3
- cart-products version: dev-main (8.x branch)
- Is your TYPO3 installation set up with Composer (Composer Mode): yes
- OS: Windows 11 (via ddev/Docker)
Possible Solution
Configuration/Extbase/Persistence/Classes.php maps Extcode\CartProducts\Domain\Model\Category to the sys_category table, but that only configures persistence (table mapping) — it does not register an Extbase Object substitution. extcode/cart's CategoryTrait::getCategory() is typed to the core TYPO3\CMS\Extbase\Domain\Model\Category, so without a substitution Extbase hydrates the plain core class instead of the extended one.
Adding the following to ext_localconf.php resolves the issue:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Extbase\Domain\Model\Category::class] = [
'className' => \Extcode\CartProducts\Domain\Model\Category::class,
];
Additional context
Confirmed by registering the substitution manually in a site extension's ext_localconf.php — the error disappears immediately.
Bug Report
Current Behavior
Rendering a
cartproducts_listproducts(orcartproducts_showproduct) plugin whose product has a category throws a fatal error:Expected behavior/output
The extended
Extcode\CartProducts\Domain\Model\Category(which providesgetCartProductShowPid()/getCartProductListPid()) should be used wherever a category is loaded via a product, so the plugin renders without error.Environment
Possible Solution
Configuration/Extbase/Persistence/Classes.phpmapsExtcode\CartProducts\Domain\Model\Categoryto thesys_categorytable, but that only configures persistence (table mapping) — it does not register an Extbase Object substitution.extcode/cart'sCategoryTrait::getCategory()is typed to the coreTYPO3\CMS\Extbase\Domain\Model\Category, so without a substitution Extbase hydrates the plain core class instead of the extended one.Adding the following to
ext_localconf.phpresolves the issue:Additional context
Confirmed by registering the substitution manually in a site extension's
ext_localconf.php— the error disappears immediately.