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?
Bookmarks