Results 1 to 5 of 5
  1. #1
    Join Date
    May 2009
    Posts
    1,238
    Plugin Contributions
    2

    Default main and additional images modal

    Hi

    Using 1.55

    I have changed MY_TEMPLATE/templates/tpl_modules_main_product_image.php so that instead of the js popup it opens in a modal, and works fine.

    I would like to do the same with the additional images as well, and possibly in the same modal, so to have "next"/"previous" buttons.

    The code for main image is
    PHP Code:
    <div id="productMainImage" class="centeredContent back">
        <div type="button" class="btn btn-lg fz-product-image" data-toggle="modal" data-target="#fz-modal">
        <?php
        
    echo zen_image($products_image_medium$products_nameLARGE_IMAGE_WIDTHLARGE_IMAGE_HEIGHT) . '<br /><span class="imgLink">' TEXT_CLICK_TO_ENLARGE '</span></a>';
        
    ?>
        </div>
    </div>
        <!-- start modal window -->
        <div class="modal fade" id="fz-modal" tabindex="-1" role="dialog" aria-labelledby="fz-modal-label">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="fz-modal-label">
                    <?php echo $products_name?>
                    </h4>
                    </div>
                    <div class="modal-body">
                    <?php
                    
    echo zen_image($products_image_large$products_nameLARGE_IMAGE_WIDTHLARGE_IMAGE_HEIGHT);
                    
    ?>
                    </div>
                    <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- END modal window -->
    I played with includes/modules/MY_TEMPLATE/additional_images.php and managed to trigger the modal, but the image loaded would be the small main one, and not the additional one/s, and obviously not "next"/"previous" buttons; as you can guess I basically copied the main image code, and put it in the additional one, commenting out the script part ($script_link)

    I just can't interpret all the php, I kinda can imagine some of it what it does, but putting it together to do what I need is just over me.

    Thank you.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,799
    Plugin Contributions
    17

    Default Re: main and additional images modal

    There are other image related plugins that modify how the additional images are grouped into such an effect if you want to see how/what they have modified to support the same or similar operation or if didn't want to reinvent the general effect. These include but are not limited to zen colorbox also zen lightbox. Each of these would bring the image up in the center of the screen, with additional images one could select left/right (next/prev) and there would/could be a background applied to the main page. Clicking on the non-image part generally would restore the page though depending on the plugin and setup other such options might be available.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    May 2009
    Posts
    1,238
    Plugin Contributions
    2

    Default Re: main and additional images modal

    Thank you.

    I have downloaded them, and as of now I can't seem to see all the stuff going on, I was hoping for something easier.
    If I can't sort it out, I'll consider installing the colorbox, though I'll have to do lots of work to adapt it to my needs.

  4. #4
    Join Date
    May 2009
    Posts
    1,238
    Plugin Contributions
    2

    Default Re: main and additional images modal

    @mc12345678
    Thank you for your last comment in colorbox thread, I appreciate, and agree with the time/benefits.
    That said I am going to follow both roads (I guess I have too much time!), colorbox customization, and this modal one.

    I have done some progress by modifying the includes/modules/MY_TEMPLATE/additional_images.php

    Changed these two lines:

    PHP Code:
    $large_link zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL'pID=' $_GET['products_id'] . '&pic=' $i '&products_image_large_additional=' $products_image_large);

    $script_link '<script type="text/javascript"><!--' "\n" 'document.write(\'' . ($flag_display_large '<a href="javascript:popupWindow(\\\'' str_replace($products_image_largeurlencode(addslashes($products_image_large)), $large_link) . '\\\')">' $thumb_slashes '<br />' TEXT_CLICK_TO_ENLARGE '</a>' $thumb_slashes) . '\');' "\n" '//--></script>'
    To:

    PHP Code:
    $large_link zen_href_link('<div type="button" class="btn btn-lg fz-product-image" data-toggle="modal" data-target="#fz-modal-1">''pID=' $_GET['products_id'] . '&pic=' $i '&products_image_large_additional=' $products_image_large '</div>');
        
    $large_link =  zen_href_link'pID=' $_GET['products_id'] . '&pic=' $i '&products_image_large_additional=' $products_image_large );

    $script_link =  ($flag_display_large '<div type="button" class="btn btn-lg fz-product-image" data-toggle="modal" data-target="#fz-modal-1">' $thumb_slashes '<br />' TEXT_CLICK_TO_ENLARGE '</div>' $thumb_slashes); 
    And adding the modal code to includes/templates/MY_TEMPLATE/tpl_modules_additional_images.php.

    Doing that it displays the images, and when clicked the modal opens, obviously there are problems:
    - no gallery effect (next/previous, and main image)
    Which as of now will let as it is, and try to solve the following, being more relevant:
    - both (I am testing with two additional images) images display same image, precisely image_02_LRG

    My guess is I have to change the code in the modal where it calls the content (image)

    PHP Code:
    <div class="modal-body">
        <?php
        
    echo zen_image($products_image_large$products_nameLARGE_IMAGE_WIDTHLARGE_IMAGE_HEIGHT);
        
    ?>
    </div>

  5. #5
    Join Date
    May 2009
    Posts
    1,238
    Plugin Contributions
    2

    Default Re: main and additional images modal

    My guess is I have to change the code in the modal where it calls the content (image)
    Wrong guess.

    I made some progress:

    Using the following makes the modal trigger, and I see next/previous buttons, problem is the image not loading in the modal.
    $fz_image_path is supposed to call the image ... I guess (again!)

    PHP Code:
    $script_link = ($flag_display_large '<a class="fz-thumbnail" href="#" data-toggle="modal" data-image="' $fz_image_path '" data-target="#image-gallery">' $thumb_slashes '<br />' TEXT_CLICK_TO_ENLARGE '</a>' $thumb_slashes)  ; 
    I tried this

    PHP Code:
    $fz_image_path str_replace($products_image_largeurlencode(addslashes($products_image_large)), $large_link); 
    And displays the missing image icon, which makes me think I am on the right track ... if I only knew how to get the correct path!

 

 

Similar Threads

  1. v155 Additional Images, Colorbox and Main Image Thumbnail
    By mvstudio in forum General Questions
    Replies: 9
    Last Post: 14 Nov 2017, 09:16 PM
  2. v150 Attribute Images & Additional Images Replace Main Image Onclick w/ Zoom
    By rbarbour in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 1 Mar 2013, 10:46 PM
  3. Product description ALWAYS under Main Image and Additional images
    By sonjamichelle in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 19 Mar 2009, 03:59 PM
  4. How to align the main and additional product images in the listing?
    By mishutkadesign in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 17 Jul 2008, 02:49 PM
  5. Additional Images + Main Image Trouble
    By Cyopz in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 22 Feb 2008, 11:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR