Update the image on matrix table to show the child images

Updating the extension for matrix table to show the child images

The image should be in the format as below,

Parent Product code_{size}.{color}.{packaging}.EXT

If the {size}.{color}.{packaging} contains any special character, please replace with a single space. And if not available any of these {size}.{color}.{packaging}, then use number [0-9]

For example, if color not available for the item BLG2122 then BLG2520_Small – Size 8.0.Carton 120 Pairs.jpg

Images are added in the file cabinet, in the path Website Hosting Files >> Live Hosting Files >>bastionpacific website item images

Updated the Extension “PDPMatrixTable” to add the URL for the child image dynamically as per the specified condition

Updated the template file in extension named “product_details_table_subrow.tpl” and the updated URL is added to the template

            if(size == false)
            { 
                var size_url = "0"; 
            }else 
            { 
                var str = this.model.get('custitem61'); 
                size_url = str.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, ' '); 
                if(size_url=="Small"){ 
                    size_url = size_url+" - Size 8" 
                } 
                if(size_url=="Medium"){ 
                    size_url = size_url+" - Size 9" 
                } 
                if(size_url=="Large"){ 
                    size_url = size_url+" - Size 10" 
                } 
                if(size_url=="X Large"){ 
                    size_url = size_url+" - Size 11" 
                } 
                if(size_url=="XX Large"){ 
                    size_url = size_url+" - Size 12" 
                } 
            } 
            if(packaging == false){ 
                var packaging_url = "0"; 
            }else 
            { 
                var packstr = this.model.get('custitem66'); 
                packaging_url = packstr.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, ' '); 
            } 
            if(color == false){ 
                var color_url = "0"; 
            }else 
            { 
                var colorstr = this.model.get('custitem65'); 
                color_url = colorstr.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, '         '); 
            } 
      var name_url = this.model.getSku(); 
      var image_url = "https://bp.sca-jobinandjismi.ml/bastionpacific website item                  images/"+name_url+"_"+size_url+"."+color_url+"."+packaging_url+"."+"jpg" 
      console.log("URLLLLLLL", image_url) 

Leave a comment

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