Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
5 ตอบกลับ
9872 มุมมอง

Hi,

Iam working with Odoo 8.

Actually the button "Add to cart" redirects me to the cart page. I need to stay in the same page of the product that i added.

Thank  you ...


อวตาร
ละทิ้ง

Did you solve it?

คำตอบที่ดีที่สุด

Hi Lama,

You need to inherit website_sale/controllers/main.py method cart_update(), rewrite return request.redirect("/shop/cart") to your desire path.

อวตาร
ละทิ้ง

Thank you very much! But another question arises. Are we able to do this so that the page does not refresh? does it mean that she doesn't come back to the top?

คำตอบที่ดีที่สุด

How did you solve it?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi lama lili

I have the same problem; I created a module but still I get redirects to the homepage.

Can you share how did you solve this?

Thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello, I am facing the same problem, I use Odoo 12 Online, could you please share the code and details to resolve this problem
Thanks alot

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Hi Sushma,

I tried to write this in a new module:

@http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True)
    def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
        cr, uid, context = request.cr, request.uid, request.context
        request.website.sale_get_order(force_create=1)._cart_update(product_id=int(product_id), add_qty=float(add_qty), set_qty=float(set_qty))
        return request.redirect("")

 But it redirect me again in the cart page. I need to stay in the same page of the product. Do i write

return request.redirect("#") ?

Thank you Sushma.

อวตาร
ละทิ้ง

Hi,

This method is calling from different places, Instead to redirect to product page find current path and re-direct to the same path. although # used in JS not for controller.

Thanks.

ผู้เขียน

Thank you , i resolved it :)

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 25
1289
0
ม.ค. 25
3394
1
ก.ย. 24
1238
1
ส.ค. 23
14709
change password แก้ไขแล้ว
1
ส.ค. 23
13315