Hi,
This is my custom code ,version=10
@http.route('/wishlist/add-to-cart', type='http', auth="public", website=True)
def add_to_cart(self,product_id,qty=1):
cr, uid, context, registry = request.cr, request.uid, request.context, request.registry
# Check user input
try:
product_id = int(product_id)
except:
product_id = None
if product_id:
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
so._cart_update(cr, uid, product_id=product_id.id, add_qty=1)
# Redirect to cart anyway
return request.redirect("/shop/cart")