I’m customizing an Odoo eCommerce website and I need to modify the add_qty parameter in the product details page dynamically via a URL parameter. I’m extending the WebsiteSale class to achieve this.
Here’s my code snippet:
class WebsiteSaleCustom(WebsiteSale):
def _prepare_product_values(self, product, category, search, **kwargs):
values = super()._prepare_product_values(product, category, search, **kwargs)
values['add_qty'] = int(kwargs.get('add_qty', 1))
return values
This solution works as expected upon the first load of the product details page. However, the issue arises when attempting to dynamically update the add_qty parameter.
Any insights or suggestions on how to achieve this would be greatly appreciated. Thank you for your help!