I was pumped to upgrade to the Gold Cart plugin for WP E-Commerce today, but was disappointed to find that the product gallery lightboxes simply don't function. This was a disappointment, as it was the primary reason for the upgrade.

When clicking on a Product Thumbnail in the Gallery, nothing happens. A deeper look at the WP E-Commerce JavaScript reveals this event handler, which effectively cancels any actions from taking place by clicking a thumbnail:

jQuery('.attachment-gold-thumbnails').click(function(){
	jQuery(this).parents('.imagecol:first').find('.product_image').attr('src', jQuery(this).parent().attr('rev'));
	jQuery(this).parents('.imagecol:first').find('.product_image').parent('a:first').attr('href', jQuery(this).parent().attr('href'));
	return false;
});

So, what can we do. If we alter the JavaScript file, we leave ourselves vulnerable to any upgrades that will simply overwrite our changes. Same deal with modifying the gold_shpcrt_display_gallery function to remove the attachment-gold-thumbnails class.

I rather "hacky" solution that I employed was to use a little string manipulation to strip out the attachment-gold-thumbnails class from any <a> tags present in the function output. This had no effect on the display, but did solve the issue. In your customized version of the wpsc-single_product.php or wpsc-products_page.php, make the following adjustment:

<?php
if ( function_exists( 'gold_shpcrt_display_gallery' ) )
    echo str_replace('attachment-gold-thumbnails', '', gold_shpcrt_display_gallery( wpsc_the_product_id() ));
?>

Tags:

3 Comments

  1. Thanks so much for posting this! I have been working on this for a couple hours now and you fix worked in seconds!!!

  2. I have been trying to fix the same issue with the thumbnails not working for a couple hours now. My problem was the anchors were getting the wrong class and the solution was: <code> if ( function_exists( 'gold_shpcrt_display_gallery' ) )
        echo str_replace('thumbnail', 'thickbox', gold_shpcrt_display_gallery( wpsc_the_product_id() ));</code>
    Thank you soooo much for this post!!

Leave a Reply to Barbara Cancel reply

Your email address will not be published. Required fields are marked *