Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

4

How to put your website products table like in /shop in the page and location you need

By
Axel Mendoza
on 12/16/15, 2:09 AM 1,050 views

In the Odoo website ecommerce page /shop there is a product table that allow you to clic on the products to send you to the product page and be able to buy it. How could we use that product table to show it in the homepage or in the page you need?

This is a follow up question of the question https://www.odoo.com/es_ES/forum/help-1/question/how-to-believe-that-we-cant-use-our-products-on-website-homepage-93011

I will provide the answer and examples of how to do it. This will start a serie of qweb widgets posts that solve some situations that could be solved using the provided solutions

Have a look at the controllers and the views in the module website_sale. The controllers do the redirection and the XML files create those views which show all products in combination with slug.

Yenthe
on 12/16/15, 2:33 AM
4

Axel Mendoza

--Axel Mendoza--
10195
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 12/16/15, 4:30 AM

This could be solved in several ways like those referred in the follow up question, I have developed at least two ways to solve it. 

The first one and more simple way is to use the widget website_products. 
What widget is that?
It's a new widget that you could use after install the module solt_qweb_widgets from https://github.com/aek/odoo_public/tree/8.0/addons/solt_qweb_widgets
How can I use that widget to display the products?

<div class="row" t-esc="website" t-esc-options='{"widget":"website_products"}'/>

That will display all the products you have, 4 products per row and 20 total products per page like in the original shop

How can I filter what products will be displayed?

<div class="row" t-esc="website" t-esc-options='{"widget":"website_products", "domain": [["sale_ok", "=", true], ["service_quotation", "=", false], ["website_published", "=", true]]}'/>

As you see in the options you could specify a domain to filter the products to display

How can I change the template used?

There is a default template that it's a clean of the original website_sale.products template without the layout that will include the header and footer stuffs. You don't need to specify a template, but if you wanna provide your own template you could do it like this:

<div class="row" t-esc="website" t-esc-options='{"widget":"website_products", "template": "solt_qweb_widgets.website_products", "domain": [["sale_ok", "=", true], ["service_quotation", "=", false], ["website_published", "=", true]]}'/>

Take as a base the template solt_qweb_widgets.website_products for your modifications

See an example of how this works at my Odoo website version of my site: https://saas.soltein.org


The second way to display the products table it's using another qweb component of that module that allow you to use t-call-xpath to select the nodes from an existing template. It's functional but not complete yet. The use of that tag attribute in combination with a widget to provide the additional data that the template need to render will give the same result of the first way when you retrieve the content of the <t t-call="website.layout"> to remove the header and footer of the /shop page , but have more use for other scenarios

The first way it's the recommended one right now since it's in production right now.

Hope that helps to others, the same technique apply for whatever you want to use it on your page like partners that it's also available and you could see it on my site too

Cheers

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/16/15, 2:09 AM
Seen: 1050 times
Last updated: 6/30/16, 4:29 PM