daniel-hopkins / zen-colorbox

Colorbox add-on for zen-cart 1.5
GNU General Public License v2.0
1 stars 5 forks source link

Apply lightbox effect to various Zen Cart popups #9

Open DivaVocals opened 10 years ago

DivaVocals commented 10 years ago
daniel-hopkins commented 10 years ago
DivaVocals commented 9 years ago

I never noticed that you had responded.. lol Only found the updates to your repo yesterday.. Gonna submit the combination of our changes (the popups, and the auto installer) as an update in the next week.. (after testing these popups of course!)

Hope all is well with you and your beautiful wife!

DivaVocals commented 9 years ago

Did some testing to the popups code, and found some issues.. (will have to retest and provide more details).. Gonna submit an update with everything BUT the popup updates..

DivaVocals commented 9 years ago

• Shopping cart help --- spins • Some of the Mixed Product Types products, the image is cut off. • The changes to the product_info page broke Image Swatch Demo

mc12345678 commented 7 years ago

Also happened to notice that there was no "check" if the applicable "link" existed or not before attempting to apply further action to it. Ie. on the product_info page:

<script> 
  jQuery(function($) { 
  // Quantity Discounts Available 
  var discountPriceLink = $('a[href*="popupWindowPrice"]'); 
  var discountPriceUrl = discountPriceLink.attr('href').match(/'(.*?)'/)[1]; 
  discountPriceLink.attr({ 
    'href':'#' 
  }).colorbox({ 
    'href':discountPriceUrl, 
    width: '550px', 
    onComplete: function(){ 
      $('#cboxLoadedContent').find('a[href*="window.close"]').closest('td').hide(); 
    } 
  }); 
}); 

</script> 

If an a tag with href popupWindowPrice does not exist, then there is an error on the assignment line for discountPriceUrl because nothing is returned (not that it is undefined just nothing there) for discountPriceLink. As I'm not sure which plugin adds that I could not fully test my solution, but I did a test on the discountPriceLink variable before allowing further processing and used this code in that area:

<script> 
  jQuery(function($) { 
  // Quantity Discounts Available 
  var discountPriceLink = $('a[href*="popupWindowPrice"]'); 
  if (discountPriceLink.length != 0) {
    var discountPriceUrl = discountPriceLink.attr('href').match(/'(.*?)'/)[1]; 
    discountPriceLink.attr({ 
      'href':'#' 
    }).colorbox({ 
      'href':discountPriceUrl, 
      width: '550px', 
      onComplete: function(){ 
        $('#cboxLoadedContent').find('a[href*="window.close"]').closest('td').hide(); 
      } 
    }); 
  }
}); 

</script>