Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- AttributeMachine.prototype.Generate_Discount = function( discount )
- {
- var discount_div;
- var msrp = Number(document.getElementById('price-value-additional').innerHTML.replace(/[\$,]/, '')),
- savings_percent = Math.round(discount.discount / msrp * 100),
- savings_percent_formatted = savings_percent + '%';
- // console.log('Generate_Discount', discount, msrp, savings_percent, savings_percent_formatted );
- discount_div = document.createElement( 'div' );
- discount_div.innerHTML = 'You Save: ' + savings_percent_formatted + '<br>' + discount.descrip + ': ' + discount.formatted_discount;
- return discount_div;
- }
- AttributeMachine.prototype.Generate_Swatch = function( product_code, attribute, option )
- {
- var swatch = document.createElement( 'li' );
- var span = document.createElement( 'span' ); // to vertically center the swatch images
- var img = document.createElement( 'img' );
- img.src = option.image;
- swatch.appendChild( span );
- swatch.appendChild( img );
- return swatch;
- }
- </script>
Add Comment
Please, Sign In to add comment