跳至内容
菜单
此问题已终结
875 查看

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'),
            });
        }
    },

});

形象
丢弃
相关帖文 回复 查看 活动
1
6月 24
1460
1
5月 24
1958
1
3月 23
2308
1
8月 21
4258
1
3月 17
2801