Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008
    Posts
    30
    Plugin Contributions
    0

    Default changed code for hovering large image. Is it correct?

    I don't quite know in which part of the forum I am suppost to post this, but this seemed the best option.

    I want to have larger images shown when I hover over the images in the product listing. I know that Image Handler can do this (and more) but I wanted the large images, not the medium ones. Nobody could help me, so I created some code myself (from another javascript).

    I know virtually no php (yet) so I would really appreciate if somebody could look at the code.

    I changed two files:

    includes/functions/html_output.php
    and
    includes/modules/product_listing.php

    (1) what is the difference between
    includes/functions/html_output.php and
    admn/includes/functions/html_output.php ? I used the first, is that correct?

    (2) in includes/modules/product_listing.php I changed the part in which the productListing-data is generated.
    it was (in fact, there were two similar lines, changed them both)

    Code:
                $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a>';
    and I changed it into
    Code:
                $lc_text = '<a class="thumb" href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '<span>' . zen_image_anjo(DIR_WS_IMAGES . 'large/' . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</span></a>';
    the function zen_image that is called above is also changed (in file includes/functions/html_output.php) but not much: I merely commented a few lines to get rid of the width and heigth
    Code:
          // BMZ IH2: intval for width and height since proportional images
          // calculate float. int is needed for the code to validate
    //anjo afm niet nodig      if ($image_size[0] < $width and $image_size[1] < $height) {
    //anjo        $image .= ' width="' . $image_size[0] . '" height="' . intval($image_size[1]) . '"';
    //anjo      } else {
    //anjo        $image .= ' width="' . round($width) . '" height="' . round($height) . '"';
    //anjo      }
    The hover part of this all is done in some css statements

    It works, but I am not certain it is correct and stable and I am certainly not certain it will not give any problems somewhere else.

    Is it correct? and should I also change the admn/includes/functions/html_output.php?

  2. #2
    Join Date
    Sep 2008
    Posts
    106
    Plugin Contributions
    0

    Default Re: changed code for hovering large image. Is it correct?

    I cannot help you much here, but the admn files are your administrator files and, if I'm not mistaken, are the files used on the configuration side ie: those files called upon in the admin configuration when you are changing settings.

    Have you thought about using the lightbox contribution. - I have it, but have yet to take a closer look at it; although I know it is used to produce the professional looking Javascript generated images seen on many commercial sites now and I am fairly certain it is just the thing you are looking for.

    http://www.zen-cart.com/index.php?ma...roducts_id=273

 

 

Similar Threads

  1. v150 Is this a correct code change for PHP 5.3?
    By dbltoe in forum Contribution-Writing Guidelines
    Replies: 7
    Last Post: 13 Sep 2012, 10:04 PM
  2. Image hovering/image sizing
    By Designzbylou in forum Customization from the Admin
    Replies: 2
    Last Post: 24 Aug 2010, 04:18 PM
  3. Hovering over Image Buttons
    By mattzeiler in forum General Questions
    Replies: 1
    Last Post: 25 May 2008, 08:25 PM
  4. Replies: 1
    Last Post: 19 Oct 2007, 02:39 AM
  5. only large image & correct ratio
    By Jaysun in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 22 Jan 2007, 07:59 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