Odoo 17’s web pages serve as a digital canvas on which businesses can build their online presence. The gateways through which visitors interact with your brand are these intricate tapestries of content, functionality, and design. The ability to alter pre-existing web pages is a valuable tool that you can use to achieve a variety of goals, such as captivating users with visually stunning product showcases, streamlining user experiences, or adding a distinctive flair to your website.
Related Articles
Exploring the Core of Web Pages in Odoo 17
The website module is the main component of Odoo’s web page management. It is a powerful tool that manages the appearance, features, and customization of your website. This module acts as the coordinator, combining the various components that give your web pages life.
Every page in Odoo 17 is important to the growth of your online story, and each plays a crucial role in bringing that story to life. These digital spaces—from the home page’s welcoming appearance to the product showcases, about us pages, and contact forms’ educational content—combine to form your online persona.
In addition to disseminating information, Odoo 17 web pages can collect user data via intuitive forms, promote interaction with captivating elements, and ease online transactions. These digital platforms’ adaptability enables you to produce captivating experiences that connect with your target audience.
The Seamless Online Shopping Journey: An Examination
Let’s look at a real-world example to show the transformative power of web page modification in Odoo 17: improving an e-commerce website’s home page to highlight best-selling products and alluring promotional offers.
The Odoo home page is initially blank, ready for your artistic input. But with a few calculated changes, you can turn this virtual space into an attention-grabbing display that draws users in and advances them through the sales funnel.
On the homepage, display items that are in high demand
To get things started, we’ll feature top-selling products prominently on the Homepage. In addition to sparking interest, it guides visitors towards popular products. We’ll write some custom code to create a function that sorts these products based on sales volume, then we’ll integrate it into the front end for a visually appealing display.
from odoo import http
from odoo.http import request
from odoo.addons.website.controllers.main import Home
class Website(Home):
@http.route('/', auth="public", website=True, sitemap=True)
def index(self, **kw):
products = request.env['product.template'].sudo().search([])
for each in products:
each.sales_count = 0
each.top_selling = False
orders = request.env['sale.order'].sudo().search([('state', 'in', ('sale', 'done'))])
for order in orders:
order_line = order.order_line
for product in order_line:
product.product_id.sales_count = product.product_id.sales_count + 1
super(Website, self).index()
website_product_ids = request.env['product.template'].sudo().search([('sales_count', '!=', 0)], order='sales_count desc', limit=4)
website_product_ids.top_selling = True
return request.render('website.homepage',
{'website_product_ids': website_product_ids})
This bit of code retrieves the best-selling items from the website’s homepage and displays them there, according to how many sales they generated over a given period. template for a homepage.
You can inherit the website and add these best-selling products to the homepage. Make a template for the homepage and include a container with the ID wrap inside the div. Here’s an illustration of how to use a product cart view to show the top-selling items:
inherit_id="website.homepage" name="Products" active="True">MOST SELLING PRODUCTS
style="overflow: hidden;">t-as="website_product_id"> style="padding:6px 6px 6px 6px;">This sample of code loops through the most popular products, displaying each one’s name, picture, and price in a product cart view on the homepage.
These instructions will help you incorporate your best-selling products into your e-commerce website’s homepage with ease, giving visitors an interesting and inviting experience that highlights your offerings.
Gaining proficiency in editing pre-existing web pages in Odoo 17 enables companies to create engaging online experiences that appeal to their target market. With Odoo’s extensive website module, you can unleash your creative vision and customize every aspect of your web pages to match your business goals and brand identity. You can choose to use the code-driven backend customization approach or the intuitive front-end editing approach.
Odoo’s web page modification features give you the tools you need to succeed in the digital world, whether you’re an e-commerce retailer looking to highlight your best-selling products, a service provider looking to streamline user engagement, or an organization trying to build a strong online presence.