how to solve when transaction line option are not accesible from the recorder page on websites

in the latest sca version the transaction line fields are not accessible, so we need to make use of item option to solve the issue. we need to create the item option and with that help we need to extend the recorder view and update the value form there.

_.extend(ReorderItemsActionsAddToCartView.prototype, {
                    getContext: _.wrap(ReorderItemsActionsAddToCartView.prototype.getContext, function (fn) {
                        try {
                            const context = fn.apply(this, _.toArray(arguments).slice(1));
                            var item = this.line.get('item');
                            var item_id = item.get('_id');
                            var hideEzshield = SC.CONFIGURATION.productConfigurator.EZshieldInternalId;
                            var hidelogooption = SC.CONFIGURATION.productConfigurator.logooptionInternalId;
                            var Purchasable = true
                            if (item_id == hideEzshield || item_id == hidelogooption) {
                                Purchasable = false;
                            }
                            if (this.model.get('item').get("custitem_jj_liq_pixels_personalization")) {
                                _.each(this.model.get("options").models, opt => {
                                    if (opt.get('cartOptionId') === "custcol_ag_isreordered") {
                                        opt.set("value", { "label": "Yes", "internalid": "T" });
                                    }
                                    if (opt.get('cartOptionId') === "custcol_ag_is_reviewed") {
                                        opt.set("value", { "label": "No", "internalid": "F" });
                                    }
                                    // if (opt.get('cartOptionId') === "custcol_ag_logooptionselectbox" && opt.get("value").internalid == 3) {
                                    //     // var personalizationType = _.find(this.line.get("options").models,params=>params.get('cartOptionId') === "custcol_ag_personalizationtype")
                                    //     // if (personalizationType) {
                                    //     //     personalizationType.set("value", { "label": "$90 - Color Logo", "internalid": "1" });
                                    //     // }
                                    // }
                                    if (opt.get('cartOptionId') === "custcol_jj_imgpdf_url" && opt.get('value')) {
                                        opt.set("value", { "label": "", "internalid": "" });
                                    }
                                    if (opt.get('cartOptionId') === "custcol_jj_atg_295_image" && opt.get('value')) {
                                        opt.set("value", { "label": "", "internalid": "" });
                                    }
                                })
                            }
                            return {
                            disableAddToCart:Purchasable,
                            ...context
                            }
                        } catch (error) {
                            console.error("ERROR @ OrderHistoryItemActionsView", error);
                        }
                    })
                    
                })

Leave a comment

Your email address will not be published. Required fields are marked *