View Issue Details

IDProjectCategoryView StatusLast Update
0006959OXID eShop (all versions)1. ----- eShop frontend -----public2019-03-12 09:30
ReporterHelmut L. 
Status acknowledgedResolutionopen 
Product Version6.1.1 
Target VersionFixed in Version 
Summary0006959: User components not accessible in Smarty
DescriptionIn the aUserComponentNames array you must provide the class name with the complete namespace. When the components are then assigned to smarty the class name with the namespace is used as the name of the variable in the template. This leads to a variable name that is inaccessible in smarty because it contains backslashes.
Steps To Reproduceadd a namespaced class to aUserComponentNames
$this->aUserComponentNames['\tc\test'] = 1;

This class would now be available in smarty under the name $\tc\test, which will immediately cause a template error due to the backslashes in the name.
TagsComponents, Namespaces, Smarty
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined



2019-03-01 08:43

developer   ~0012804

Last edited: 2019-03-01 08:50

View 2 revisions

edit: deleted my first answer as I missed an information.


2019-03-01 10:37

administrator   ~0012805

Last edited: 2019-03-01 10:39

View 2 revisions

As of now using class names with namespaces aren't working as key names when registering them for own components. Currently you still have to use the class names without the namespaces. For example the shop does it too:
protected $_aComponentNames = ['oxcmp_cur' => 1, 'oxcmp_shop' => 1, 'oxcmp_basket' => 1, 'oxcmp_user' => 1];

Because the namespaces are the prefered way to got, but we still have the backwards compatibility layer, this requirement is a feature for now.



2019-03-12 09:30

developer   ~0012816

There's a workaround for adding own namepaced components.


namespace HkReuter\OxSampleModule\Application\Component;

 * Register own component in
 * class_exists(\HkReuter\OxSampleModule\Application\Component\OxSample::class);
 * $this->aUserComponentNames = ['oxcmp_oxsample' => 1];
class OxSample extends \OxidEsales\Eshop\Application\Controller\FrontendController

 * Class alias is needed to make this work in templates.
class_alias(\HkReuter\OxSampleModule\Application\Component\OxSample::class, 'oxcmp_oxsample');