Oksydan / falcon

Prestashop starter theme that provides great development experience.
GNU General Public License v3.0
264 stars 63 forks source link

🐛 [BUG] - is_shoppingcart in displayNav2 hooks not work #331

Closed ludimassa closed 1 year ago

ludimassa commented 1 year ago

Description

hi everyone, I am trying to dove the module is_shoppingcart in the displayNav2 hooks throw theme.yml configuration file end it's not is showed Anyone can help me?

Node.js version

18

php version

7.4

OS and it's version

xampp

Browsers

Chrome

Required module/theme

theme and is_shoppingcart

Reproduction steps

1. change the theme.yml by moving is_shoppingcart in       displayNav2 hooks

Logs

No response

Oksydan commented 1 year ago

Hi @ludimassa,

it's not a bug. You can read is_shoppingcart module code. You have to create a new hook service inside module. You can tak a look here https://github.com/Oksydan/is_shoppingcart/blob/main/src/Hook/DisplayTop.php https://github.com/Oksydan/is_shoppingcart/blob/main/config/common.yml#L29-L32

Since it isn't a bug. I am going to close this issue. Feel free to open new one.

bogwero commented 1 year ago

Hi, It's pretty easy to modify the module for other hooks, you will have to add the hooks like this: in the file modules/is_shoppingcart/config/common.yml, add the following:

    oksydan.is_shoppingcart.hook.display_nav2:
        class: Oksydan\IsShoppingcart\Hook\DisplayTop
        parent: 'oksydan.is_shoppingcart.hook.abstract_display_hook'
        public: true

(it basically tells it to use the same code from DisplayTop hook for display_nav2 hook.)

After applying the changes, you will probably need to uninstall and reinstall the module, or switch to classical theme and then back to Falcon and clear cache from Back Office-> Advanced parameters -> Performance -> Clear Cache button.

Happy coding!

ludimassa commented 1 year ago

Thanks a lot

krodelabestiole commented 3 months ago

thanks ! still it's a bit impractical that the modification might get crushed on a plugin update... Maybe the cart should be able to get moved to other common header's hooks out of the box ? (I'm just running into the exact same issue)

I didn't know about the substitution trick with common.yml though, tanks a lot !

-- I've tried to override common.yml in the theme directory : /theme/falcon/modules/is_shoppincart/config/common.yml but it doesn't seem to work, if that might be useful to anyone...