Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2011
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <script type="text/javascript">
  2.         var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
  3.         document.observe("dom:loaded", function() {
  4.             var customValidation = false;
  5.             var priceFormat = <?php echo $this->helper('tax')->getPriceFormat(); ?>;
  6.             $$('.validate-custom-configurable').each(function(el){
  7.                 el.observe('click',function(event){
  8.                     var total_amount = optionsPrice.productPrice;
  9.                     $$('label.label-radio-configurable input').each(function(elmn){
  10.                         if ( elmn.checked == true ) {
  11.                             total_amount = total_amount + parseFloat(elmn.parentNode.id);
  12.                         }
  13.                     });
  14.                     $$('.price').each(function(priceobj) {
  15.                         priceobj.update(formatCurrency(parseFloat(total_amount), priceFormat)).innerHTML;
  16.                     });
  17.                 });
  18.             });
  19.             Validation.addAllThese([
  20.                 ['validate-custom-configurable', 'This is a required field.', function(v) {
  21.                     $$('.validate-custom-configurable').each(function(el){
  22.                         if (el.checked) {
  23.                             customValidation = true;
  24.                         }
  25.                     });
  26.                     return customValidation;
  27.                 }]
  28.             ]);
  29.         });
  30.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement