[go: nahoru, domu]

Skip to Content
Menu
This question has been flagged
150 Views

On Odoo17, I would like to modify the dynamic snippet of the e-commerce website, I added the following code to my own module, but it was unsuccessful

TypeError: DynamicSnippetProductsCard is undefined


. What should I do?

/** @odoo-module **/

import { DynamicSnippetProductsCard} from "@website_sale/snippets/s_dynamic_snippet_products/000";
import { patch } from "@web/core/utils/patch";

patch(DynamicSnippetProductsCard.prototype, {
    async _onClickAddToCart(ev) {
    debugger
        const $card = $(ev.currentTarget).closest('.card');
        const data = await this.rpc("/shop/cart/update_json", {
            product_id: $card.find('input[data-product-id]').data('product-id'),
            add_qty: 1,
            uom_id: 43,
            display: false,
        });
        wSaleUtils.updateCartNavBar(data);
        wSaleUtils.showCartNotification(this.call.bind(this), data.notification_info);
        if (this.add2cartRerender) {
            this.trigger_up('widgets_start_request', {
                $target: this.$el.closest('.s_dynamic'),
            });
        }
    },

});

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 24
219
1
May 24
333
1
Mar 23
1095
1
Aug 21
3117
1
Mar 17
1923