Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var n_items = content.catalogItems.length,
- bundle = document.querySelector('#tpl-bundle').innerHTML,
- html = '';
- for ( var i=0; i<n_items; i++ ) {
- var c = content.catalogItems[i];
- var skuCode = c.bundle.productBundles.reduce(function(acc, current) {
- return acc + current.sku.idSku + ','
- }, '').slice(0, -1);
- if ( c.bundle.type === "dynamic" ) {
- skuCode = "";
- }
- html += bundle
- .replace('{{idBundle}}', c.bundle.idBundle)
- .replace('{{idCatalogItem}}', c.idCatalogItem)
- .replace('{{price}}', c.price)
- .replace('{{skuCode}}', skuCode)
- .replace('{{freeShipping}}', c.freeShipping)
- .replace('{{showBundlemaster}}', (c.tags.bundle_master === "TRUE" ? '' : 'no-display'))
- .replace('{{bundlemaster}}', (c.tags.bundle_master === "TRUE" ? 'bundlemaster' : ''))
- .replace('{{title}}', c.tags.title)
- .replace('{{title}}', c.tags.title)
- .replace('{{summary}}', c.tags.summary)
- .replace('{{slug}}', c.tags.slug)
- .replace('{{dynmc_bndl_size}}', c.tags.dynmc_bndl_size)
- .replace('{{dynmc_bndl_qnt}}', c.tags.dynmc_bndl_qnt)
- .replace('{{dynmc_bndl_product}}', c.tags.dynmc_bndl_product)
- .replace('{{dynmc_bndl_splash}}', c.tags.dynmc_bndl_splash)
- .replace('{{dynmc_bndl_ribbon}}', c.tags.dynmc_bndl_ribbon)
- .replace('{{showDiscount}}', (c.tags.discount === "" ? 'no-display' : ''))
- .replace('{{discount}}', c.tags.discount)
- .replace('{{showListingprice}}', (c.tags.listingprice === "" ? 'no-display' : ''))
- .replace('{{listingprice}}', c.tags.listingprice)
- .replace('{{stallments}}', c.tags.stallments)
- .replace('{{stallmentPrice}}', c.tags.stallmentprice)
- .replace('{{hiddenValue}}', JSON.stringify(c.bundle.productBundles));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement