How to make a item personalised or not from edit cart

For this we can check for the values before update if any values are present then the item will be stored as a personalised if personalisation made from pdp is removed then it will be not personalised item and can be checked by checking length of fields
An example to check the condition is given
 var options = _.filter(self.model.get("item").attributes.options.models,function (element) {
                            var option = self.model.attributes[element.get("cartOptionId")];
                            if (option && option != '' && (element.get("cartOptionId") != 'custcol_ag_havepersonalization')) {
                                return element;
                            }
                        }
                        );
                        let inModalLogoUrl;
                        inModalLogoUrl = this.options.model.get("uploaded_nonprview_file");
                        if (options.length > 1 || inModalLogoUrl) {
                            self.pdp.setOption("custcol_ag_havepersonalization", 'T'); 
                            if (inModalLogoUrl) {
                                self.pdp.setOption('custcol_ag_personlizationimgurl', inModalLogoUrl);
                            }
                            }else{
                            self.pdp.setOption("custcol_ag_havepersonalization", 'F')  ; 
                        }

Leave a comment

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