コンテンツへスキップ
メニュー
この質問にフラグが付けられました
889 ビュー

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
1465
1
5月 24
1964
1
3月 23
2319
1
8月 21
4277
1
3月 17
2812