Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
7 Odpowiedzi
8349 Widoki

Wondering if it is possible to increase the number of columns to show more products per row.

Awatar
Odrzuć
Najlepsza odpowiedź

Those constants are meant to be overridden by a module

Simply import the main controller with:

from openerp.addons.website_sale.controllers import main

then change the values

main.PPR = your_nr

main.PPG = your_nr

Regards,

Paul

Awatar
Odrzuć
Najlepsza odpowiedź

For anyone wondering given that since 2014 no one has answered the specific question, it's rather simple and instructions were almost complete to change the values of the grid without having to modify the Core Files.

You need to create a main.py file inside a Folder named controllers on your Custom Module, it should contain this to replace at your liking the Products per Page and per Row, make sure PPR is a multiple of PPG:

  • from odoo.addons.website_sale.controllers import main
    # path of the main.py that has the original values

    main.PPG = 21 # Products per Page
    main.PPR = 3 # Products per Row

Inside that very same controllers folder make a __init__.py file with the following inside to call the main.py file you just created :

  • from . import main

And finally outside your Custom Module Folder create another __init__.py with the following code inside to call the contents of the controllers Folder you just created with the main.py File inside

  • from . import controllers

Hope this helps someone.

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Found it hardcoded at line 11 of /website_sale/controllers/main.py

PPR = 4  # Products Per Row

Probably want to make sure it's divisible by the amount set on line 10

PPG = 20 # Products Per Page

Still not sure how to override this without changing the core file...

Awatar
Odrzuć
Autor

It looks like changing this value is not having any effect though...

@grayson, I'm also trying to figure this out. I think you may need to override it in your theme's layout.xml. I'll post back here once I figure it out. Are you using a custom theme module, or the built-in bootswatch templates?

@grayson, changing the value in /website_sale/controllers/main.py definitely has an affect, but i've found it only works after a server reboot (eg. change PPR = 5, save and reboot machine). I'll write back with an answer once I figure out how to override the default controller within a custom theme module.

Autor

@Luke, thanks for pitching in. I'll try rebooting and see what happens...

Powiązane posty Odpowiedzi Widoki Czynność
4
lip 23
8651
1
mar 15
7407
0
kwi 25
972
1
maj 24
3544
1
kwi 24
2349