Hi core devs,
I'm found this hook "$this->getHookVar('product_description_array')" in the product.tpl file.
I have tried to add array like this:
$tabs['Test'] = [
'title' => $view->fetch('pages/test/test_tab.tpl'),
'html' => $view->fetch('pages/test/test_content.tpl')
];
$that->view->addHookVar('product_description_array',$tabs);
It's not working.
I tried to debug in the tpl file and found out that the variable is set as a string contains 'array', not a real array.
hook var's value must be a string, not array.
Different extensions can add it's values and we use concatenation for that
This is what is in products.tpl file:
$hookVarArray = $this->getHookVar('product_description_array');
if( $hookVarArray ){
foreach($hookVarArray as $key=>$hkVar){ ?>
<div class="accordion-item">
<h2 class="accordion-header" id="heading<?php echo $key; ?>>">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse<?php echo $key; ?>"
aria-expanded="true" aria-controls="collapse<?php echo $key; ?>">
<?php echo $hkVar['title']; ?>
</button>
</h2>
<div id="collapse<?php echo $key; ?>" class="accordion-collapse collapse" aria-labelledby="heading<?php echo $key; ?>" data-bs-parent="#productDetailsAccordion">
<div class="accordion-body">
<?php echo $hkVar['html']; ?>
</div>
</div>
</div>
$hookVarArray is a string, not array!
if you want to pass an array use $that->view->assign('your_tpl_variable_name', $someArray); inside your hook file where $that = $this->baseObject; (controller instance)