تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
7 الردود
8298 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
أفضل إجابة

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.

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

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

الصورة الرمزية
إهمال
الكاتب

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.

الكاتب

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
4
يوليو 23
8618
1
مارس 15
7374
0
أبريل 25
925
1
مايو 24
3408
1
أبريل 24
2230