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.
Is there any way to add product directly to cart from a external link.
Example : Suppose I have my Odoo e-commerce website running on http://www.myodoo.com & I having a product which i am promoting from another website, now i want to set a link in such a way so when user click the link it will come to my Odoo e-commerce cart page with auto selection of that product and qty and other parameter, http://www.myodoo.com/shop/cart
So in this way no need to select the product and entry qty manually by end user , direct link maybe like http://www.myodoo.com/shop/cart?prouct='xyz'&qty=1.
Any help or suggestions are welcome....
Just write your own route.
@http.route('/shop/add-to-cart', type='http', auth="public", website=True)
cr,uid,context,registry = request.cr,request.uid,request.context,request.registry
#Check user input
product_id = int(pId)
product_id = None
product_id = registry["product.product"].browse(cr,uid,[product_id])
#Is the product ok
if product_id and product_id.sale_ok and product_id.website_published:
#Get the cart-sale-order
so = request.website.sale_get_order(force_create=1)
#Update the cart
#Redirect to cart anyway
I couldn't try this code, but it should work.
If you need help with writing modules. You can find useful information here
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: 2/29/16, 10:43 PM|
|Seen: 821 times|
|Last updated: 8/3/16, 3:44 AM|