WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
woocommerce change lightbox, enable for product gallery thumbnails (2 posts)

  1. mgason
    Member
    Posted 4 months ago #

    Hi,
    this thread explains how to disable the standard lightbox that comes with woocommerce. http://wordpress.org/support/topic/woocommerce-disable-lightbox?replies=6

    That much worked fine for me, but clicking the product image on a single product page launches my new lightbox with just the main image. Not the other images in the thumbnail gallery. I can see prettyphoto the woocommerce lightbox is still being applied to thumbnails. What else do I need to do to make that work?

    I am using this lightbox http://wordpress.org/plugins/responsive-lightbox/
    In the responsive lightbox plugin 'swipebox' is chosen as the script.

    https://wordpress.org/plugins/woocommerce/

  2. mgason
    Member
    Posted 4 months ago #

    I partially solved this but nowI can not edit my first psot so here is my added progress and a new question....

    I did the same for thing basically in product-thumbnails.php and it works for the thumbnailed images. (code explained below in case its of use to others)

    It is not quite right.
    Say I have a main image and 3 thumbnails. Clicking any one should launch the lightbox with 4 images, the main one and 3 thumbnails.
    The problem is that clicking main just shows main in the lightbox, clicking a thumbnail just the 3 from the thumbnail gallery.

    What else do I need to do to make that work?
    Also in the linked post above Roy says "Thanks for contributing and helping others. However I would suggest you don't even copy the template file but instead use the filters you already see there"
    I can not figure out how to do it that way.

    Code I changed in "product-thumbnails.php" follow instructions in post linked above to make a copy of the file. Then replace

    echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="%s" title="%s" rel="prettyPhoto[product-gallery]">%s</a>', $image_link, $image_class, $image_title, $image ), $attachment_id, $post->ID, $image_class

    With

    echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="%s" class="%s" title="%s" rel=“lightbox[]">%s</a>', $image_link, $image_class, $image_title, $image ), $attachment_id, $post->ID, $image_class );

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.