Jump to content

Displaying Module Front Hook in Prestashop Backoffice


Recommended Posts

Hi dear prestashop community!

I'm kinda new to prestashop development and as I start to step deeper into module delevopment I start to struggle. Because of that I'd like to ask my question here(well maybe this isn't even possible):


Let's say I have for example the blockcart module, and lets say the displayTop hook displays the good old black shopping cart button on top of my shop.


Now i want to display right this black button somewhere in the backoffice of my shop. I create a BlockCart object and then I call the hookDisplayTop($params) method. In the frontoffice, this just works fine, but that's not the case when i try it in the backoffice. I get with the blockcart module the following error:


[PrestaShop] Fatal error in module file \prestashop\modules\blockcart\blockcart.php:
Call to a member function getProducts() on a non-object


I tried to look it up, and found out that the getProducts() function is in classes/Cart.php. So it might be a problem that this classes management might work automatically in the front office, but I think i have import/require some files manually, but I really dont figure out what files I need in order to have this automatically work for not only the blockcart module, but every other (standard) module.


I hope you guys can help me! :)


Kind regards from Germany,


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...