I'm facing some difficult to accomplish this apparently easy task.
I'm in a nested block ( suggestion.phtml ) and I want to get a value ( number of search result, and so the collection count) from a parent block ( result.phtml )
I'm wrong or there is not an easy way here ?
Ok solved.
It is possible to access a parent block with:
$this->getParentBlock();
So in this particular scenario:
$searchCount = $this->getParentBlock()
->getParentBlock()
->getParentBlock()
->getResultCount();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With