Skip to Content
Menu
This question has been flagged
7 Replies
7087 Views

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

Avatar
Discard
Best Answer

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

Avatar
Discard
Best Answer

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.

Avatar
Discard
Author Best Answer

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...

Avatar
Discard
Author

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.

Author

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

Related Posts Replies Views Activity
4
Jul 23
7654
1
Mar 15
6492
1
May 24
749
1
Apr 24
591
0
Apr 24
423