Results 1 to 10 of 34

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Limit additional images listed?

    can anyone explain if there is a way to limit the number of additional images shown?

    My supplier provides up to 10 but I only want to display a maximum of 3? is there any way to only get it to display the first 3 found?

    Thanks in advance.

    Phil
    Phil Rogers
    A problem shared is a problem solved.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,474
    Plugin Contributions
    88

    Default Re: Limit additional images listed?

    You could copy /includes/modules/additional_images.php into /includes/modules/YOUR_TEMPLATE/additional_images.php and edit the following section (from the 1.5.0 version):

    Code:
     // Check for additional matching images
      $file_extension = $products_image_extension;
      $products_image_match_array = array();
      $files_found = 0;  /* Add this */
      if ($dir = @dir($products_image_directory)) {
        while ($file = $dir->read() && $files_found < 3) {  /* Change this */
          $files_found++;  /* Add this */
          if (!is_dir($products_image_directory . $file)) {
            if (substr($file, strrpos($file, '.')) == $file_extension) {
              if(preg_match('/\Q' . $products_image_base . '\E/i', $file) == 1) {
                if ($file != $products_image) {
                  if ($products_image_base . str_replace($products_image_base, '', $file) == $file) {
                    //  echo 'I AM A MATCH ' . $file . '<br>';
                    $images_array[] = $file;
                  } else {
                    //  echo 'I AM NOT A MATCH ' . $file . '<br>';
                  }
                }
              }
            }
          }
        }
        if (sizeof($images_array)) {
          sort($images_array);
        }
        $dir->close();
      }
    I'd make it "prettier" but I can't remember how to 'style' colors and the color buttons aren't there right now!

  3. #3
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Limit additional images listed?

    Hi, thanks for this but its not working for me. to be fair i'm not yet on 1.5.0 yet, however the code is identical. When I implement this suggestion no images are shown at all? did it work for you or have you done this from theory?
    Phil Rogers
    A problem shared is a problem solved.

  4. #4
    Join Date
    Nov 2009
    Location
    UK
    Posts
    1,090
    Plugin Contributions
    0

    Default Re: Limit additional images listed?

    You could do it with CSS.

    Set in the admin, max add images per row of 3, and then fix in the CSS the max height for the additional images container to the height of the first row, so all the other images aren't visible. Of course they are loaded etc, but not viewable by the user.

  5. #5
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Limit additional images listed?

    I prefer not to hide stuff. search engines dont like that sort of thing.

    your initial idea looks like it should work but maybe its not quite coded right?
    Phil Rogers
    A problem shared is a problem solved.

  6. #6
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Limit additional images listed?

    not sure if the array() part has the file names at that point?

    if so could i implement something like this example:

    $input = array("a", "b", "c", "d", "e");

    $output = array_slice($input, 2); // returns "c", "d", and "e"
    $output = array_slice($input, -2, 1); // returns "d"
    $output = array_slice($input, 0, 3); // returns "a", "b", and "c"
    Phil Rogers
    A problem shared is a problem solved.

  7. #7
    Join Date
    Nov 2009
    Location
    UK
    Posts
    1,090
    Plugin Contributions
    0

    Default Re: Limit additional images listed?

    Quote Originally Posted by philip937 View Post
    I prefer not to hide stuff. search engines dont like that sort of thing.

    your initial idea looks like it should work but maybe its not quite coded right?
    Your not hiding anything, its not a hidden div, its just a reduced sized div. The content is all there and accessible, and search engines only ignore (not penalise) hidden content if it is blantantly spamming, other wise the millions of sites with tabbed divs which use display:none would be ranked down.

 

 

Similar Threads

  1. Replies: 2
    Last Post: 5 Sep 2014, 03:28 AM
  2. Is there an Easy way to limit additional Images PER PAGE?
    By NadiaUSA in forum General Questions
    Replies: 7
    Last Post: 29 Jul 2011, 06:57 PM
  3. Layout of Additional of Additional Product Images - Possible Bug?
    By RatMonkey in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 25 Mar 2011, 02:21 PM
  4. Replies: 14
    Last Post: 11 Dec 2009, 07:34 PM
  5. Additional Large Images WITHOUT additional Thumbnails
    By haasPlay in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 30 Sep 2006, 04: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