Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
How To Remove Pricing For (Not Logged In) Users on E-commerce/Website for Distributor Business to Business Sales
I'm interested in setting up the Odoo website/e-commerce system for various distributors' websites. This would require me to allow the products to be displayed with general information (ie. product pictures, description,etc.) without pricing to the general public (ie. those that are not logged in). I would then need to be able to provide a login for pre-approved accounts to allow wholesalers to login and see their own pricing according to their pricelist rules and allow them to add to cart/quote which would trigger a RFQ or sales order in Odoo v8.
Unfortunately there is not much information regarding the website/e-commerce module available currently due to the fact Odoo v8 is still in alpha.
I believe this would be extremely useful for distributors to be able to display their products without pricing unless a pre-approved account is setup for them to login. It is possible to do with Magento with various extensions such as the B2B Extension for Magento found here:
or by editing the local.xml file in various theme packages in Magento by using the <customer_logged_in> and <customer_logged_out> tags to provide conditional logic based on those two situations.
I have been looking for a way to either connect Magento (CE 1.8/1.9) to Odoo (v8) by means of a connector (currently there is nothing available) or be able implement this with the current Odoo E-commerce/Website module (preferred). If anyone has any insight on this please comment below as I would appreciate any input on this.
You have to change the view that is responsible for displaying the price. To do that:
- go to: Settings -> Technical -> User Interface -> Views (Technical Settings need to be enabled for your user)
- Search for the "product_price" view (it has QWeb as view type)
- add t-if="not user_id.partner_id.name == 'Public user'" to the first occuring div
Result: <div t-if="not user_id.partner_id.name == 'Public user'" itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer" class="product_price mt16">
This stops displaying prices on the product page.
To not show prices for users who are not logged in on the page with the overview of the products:
- open the start page of the shop
- Go to the HTML-Editor via Customize
- select the "Product item" view
- again add t-if="not user_id.partner_id.name == 'Public user'" to the following element:
<div itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer" class="product_price" ...
You can do this in standard in Odoo. You need to include a condition in the QWeb/HTML. You can access this directly in the Odoo Website builder in Customize > HTML Editor.
I'm not a specialist in QWeb syntax, some documentation is available in the following link and more will come in June. https://doc.openerp.com/trunk/web/qweb/
My guess is that you need to insert a t-if= attribute in the HTML tag of the amount you only want to display to logged in users. There are plenty of examples of this in the default site.
Side note: There is no connector between Magento and Odoo v8 simply because Odoo v8 has not been released yet... However there are a whole bunch of them for OpenERP v7 so chances are that some of them get migrated to v8. But anyway, as you said, Odoo Website is the preferred solution because natively integrated.
I’v got rid of the prices on the first to pages of the webshop by following Martin's instructions regarding the product-item and product price views. However, prices re-appear in the shopping cart page so after products have been added to cart.
I guess that there is an additional view that needs to be adapted?
Thank you everyone for all the answers in this post.
I've gotten the first 2 answers working (hide pricing), but I'm having difficulty figuring out "inherit and replace the Add to Cart button " answer.
Where does the template snippet go?
Where do I put the "t-if statements to replace the add to cart button"?
Any help would be much appreciated :)
Hi @luke, I'm interested in this kind of functionality too, by following Martin Apitz instructions,
1. I got to hide the price on the single product page, however I'd like to change the Add to Cart button to someting like the sitewards/B2BProfessional example "Please Login for Price Information" and the link would take the visitor to a sing up form.
2. Changing the Product Item View from the HTML Editor did not work for me after saving changes on that file resulting: <div itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer" class="product_price" t-if="[product.product_variant_ids] and [not user_id.partner_id.name == 'Public user']"> I'm guessing that this should hide prices in the main shop page ej. http://myurl.com/shop , is this right?
@Francisco, what i'd recommend is that you inherit and replace the Add to Cart button with a link to your login page. Here's an example of inheriting the default add to cart button:
<template id="product_add_to_cart_Custom" inherit_id="website_sale.product" name="Add To Quote - Logged In" customize_show="True">
<xpath expr="//a[@id='add_to_cart']" position="replace">
<a t-if="not user_id.partner_id.name == 'Public user'" id="add_to_cart" class="btn btn-primary btn-lg mt8 js_check_product a-submit" href="#"><i class="fa fa-angle-double-right"></i>&nbsp;&nbsp;&nbsp;Add to Quotation</a>
You could then use conditional t-if statements to replace the add to cart button in the example above with your login-for-price button (just link to yourdomain.com/web/login), and the have another conditional t-if statement to display a normal add to cart or 'add to quote' button for users that are logged in.
I will be creating a community module to achieve this type of functionality in the near future to simplify things for B2B users like yourself here:
Please feel free to post back if you run into any issues or have any questions.
About This Community
This platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 5/24/14, 1:20 AM|
|Seen: 19320 times|
|Last updated: 11/13/16, 12:16 PM|