Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
Die Frage wurde geschlossen aus dem folgenden Grund: Question / Code not indented
von ANRD zu 03.05.2024 13:09:40

I'm trying to modify the Views > website_sale.product. Currently, when an invalid combination is selected, an error message appears, and the "Add to Cart" button is deactivated. However, we have a specific scenario where we want a combination to register as invalid on the website, triggering the warning message and making the "Add to Cart" button inactive, but still be available as a valid product for our sales team to add to quotations.


I've attempted to modify the code so that any variant value containing the word "custom" will trigger the warning message and make the "Add to Cart" button inactive, while still allowing the product to be available for building quotations. But I have not had any success.


Would anybody be able to assist? Here is the original code.


<t name="Product" track="1" t-name="website_sale.product">

        <!-- Qweb variable defining the class suffix for navbar items.

             Change accordingly to the derired visual result (eg. `primary`, `dark`...)-->

        <t t-set="navClass" t-valuef="light"/>


    <t t-cache="pricelist,product,fiscal_position">

        <!-- TODO drop _get_first_possible_combination here -->

        <t t-set="combination" t-value="product._get_first_possible_combination()"/>

        <t t-set="combination_info" t-value="product._get_combination_info(combination, add_qty=add_qty)"/>

        <t t-set="product_variant" t-value="product.env['product.product'].browse(combination_info['product_id'])"/>


        <t t-call="website.layout">

            <t t-set="additional_title" t-value="product.name"/>

            <div itemscope="itemscope" itemtype="document_sudo.id)" t-att-target="target">

                                            <i t-att-class="'fa ' + icon"/>

                                            <t t-out="attachment_sudo.name"/>

                                        </a>

                                    </div>

                                </t>

                            </div>

                            <div id="o_product_terms_and_share" class="d-flex justify-content-between flex-column flex-md-row align-items-md-end mb-3">

                            </div>

                        </div>

                    </div>

                </section>

                <div itemprop="description" t-field="product.website_description" class="oe_structure oe_empty mt16" id="product_full_description"/>

                <div class="oe_structure oe_empty oe_structure_not_nearest mt16" id="oe_structure_website_sale_product_2" data-editor-message="DROP BUILDING BLOCKS HERE TO MAKE THEM AVAILABLE ACROSS ALL PRODUCTS"/>

            </div>

        </t>

    </t>

    </t>


Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Mai 24
649
0
Mai 24
886
0
Mai 24
556
0
Mai 24
967
1
Mai 24
1333