Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var n_items = content.catalogItems.length,
  2.             bundle  = document.querySelector('#tpl-bundle').innerHTML,
  3.             html    = '';
  4.  
  5.         for ( var i=0; i<n_items; i++ ) {
  6.             var c = content.catalogItems[i];
  7.  
  8.             var skuCode = c.bundle.productBundles.reduce(function(acc, current) {
  9.                 return acc + current.sku.idSku + ','
  10.             }, '').slice(0, -1);
  11.  
  12.             if ( c.bundle.type === "dynamic" ) {
  13.                 skuCode = "";
  14.             }
  15.  
  16.             html += bundle
  17.                     .replace('{{idBundle}}', c.bundle.idBundle)
  18.                     .replace('{{idCatalogItem}}', c.idCatalogItem)
  19.                     .replace('{{price}}', c.price)
  20.                     .replace('{{skuCode}}', skuCode)
  21.                     .replace('{{freeShipping}}', c.freeShipping)
  22.                     .replace('{{showBundlemaster}}', (c.tags.bundle_master === "TRUE" ? '' : 'no-display'))
  23.                     .replace('{{bundlemaster}}', (c.tags.bundle_master === "TRUE" ? 'bundlemaster' : ''))
  24.  
  25.                     .replace('{{title}}', c.tags.title)
  26.                     .replace('{{title}}', c.tags.title)
  27.  
  28.                     .replace('{{summary}}', c.tags.summary)
  29.  
  30.                     .replace('{{slug}}', c.tags.slug)
  31.                     .replace('{{dynmc_bndl_size}}', c.tags.dynmc_bndl_size)
  32.                     .replace('{{dynmc_bndl_qnt}}', c.tags.dynmc_bndl_qnt)
  33.                     .replace('{{dynmc_bndl_product}}', c.tags.dynmc_bndl_product)
  34.                     .replace('{{dynmc_bndl_splash}}', c.tags.dynmc_bndl_splash)
  35.                     .replace('{{dynmc_bndl_ribbon}}', c.tags.dynmc_bndl_ribbon)
  36.  
  37.                     .replace('{{showDiscount}}', (c.tags.discount === "" ? 'no-display' : ''))
  38.                     .replace('{{discount}}', c.tags.discount)
  39.  
  40.                     .replace('{{showListingprice}}', (c.tags.listingprice === "" ? 'no-display' : ''))
  41.                     .replace('{{listingprice}}', c.tags.listingprice)
  42.  
  43.                     .replace('{{stallments}}', c.tags.stallments)
  44.                     .replace('{{stallmentPrice}}', c.tags.stallmentprice)
  45.  
  46.                     .replace('{{hiddenValue}}', JSON.stringify(c.bundle.productBundles));
  47.  
  48.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement