Forums / Templates, Stylesheets, Page Layout / force featured products to display large image rater than standard image?

force featured products to display large image rater than standard image?

Started by bonnit on 2 Mar 2011, 1:47 PM · Views: 2,129

Results 1 to 10 of 10
2 Mar 2011, 1:47 PM
#1
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

force featured products to display large image rater than standard image?

im using optimised images for my site so all of my regular images are sized to display fast on the main product listing page with the large images only showing on the actual product listing page.

i am using featured products on the main page but i am only showing one or two at most so i would like the images to be bigger, by using the large version (_LRG) instead of the normal version.

i cant change settings in admin>config>images because the actual size of the photos is only 150px x 150px and i need them 300px - bigger than the original is.

ive noticed in featured_products.php the query string that calls the image is

$featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id
                           from (" . TABLE_PRODUCTS . " p
                           left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
                           left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
                           where p.products_id = f.products_id
                           and p.products_id = pd.products_id
                           and p.products_status = 1 and f.status = 1
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

what would i replace the p.products_image with to reference the large version?

i hope ive explained my self properly?

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion

3 Mar 2011, 9:30 AM
#2
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: force featured products to display large image rater than standard image?

i really hope someone may be able to help me with this, even just a push in the right direction perhaps?

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion

3 Mar 2011, 10:16 AM
#3
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: force featured products to display large image rater than standard image?

A. you can not stretch a image larger than what it is in ZC, so if the image is 150px by 150px that is what it is.

B. you could make the image bigger using image software then re-upload it to ZC

C. nothing you change in the code above will stretch an image larger than it is.

My suggestion is use a free image program to make the image 300px by 300px - upload it to ZC

then in your stylesheet set the image width & height to 300px by 300px

3 Mar 2011, 1:35 PM
#4
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: force featured products to display large image rater than standard image?

im not trying to make an image file bigger, you're right, my images are optimised at 150px x 150px, hence the reason for needing to know the reference i use in place of the regular "p.products_image" which instead of calling the database for image.jpg it will call image_LRG.jpg

if i resize the images they will be resized for the product listing too, negating the usefulness of having optimal sized images?

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion

3 Mar 2011, 5:50 PM
#5
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: force featured products to display large image rater than standard image?

bonnit:

i cant change settings in admin>config>images because the actual size of the photos is only 150px x 150px and i need them 300px - bigger than the original is.

I am sorry I assumed you were trying to stretch image to be bigger than the original is.

I am a bit lost here.

bonnit:

im using optimised images for my site so all of my regular images are sized to display fast on the main product listing page with the large images only showing on the actual product listing page.

If you are using the large images on your product listing page (i think you mean product_info page) you should be able to resize image on your featured products in your .css file by adding

#featuredDefault img {
width:;
height:;
}

you can resize up to the size of img used on product_info

4 Mar 2011, 10:37 AM
#6
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: force featured products to display large image rater than standard image?

i have done that and set the values in configuration too, but like you say i can only do it up to the maximum of my normal picture size.

in modules>featuredproducts.php it has a string where it calls the image itself

   'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a><br />' . $products_price);

i think i need to change the portion of code thats red, ive tried adding . 'large/' . to the code just after the directory call but its just showing no image.

so frustrating because im sure its really quite simple....

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion

4 Mar 2011, 10:59 PM
#7
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: force featured products to display large image rater than standard image?

The only way I see doing this is to hack the code for the featured product image display. I think that the image calls are in tpl_modules_products_featured_listing.php and you need to hi-jack the code for the large image and use calls similar to those found in tpl_modules_main_product_image.php.

This is a bit more than I can do, sorry

5 Mar 2011, 8:53 PM
#8
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: force featured products to display large image rater than standard image?

no problem at all, thanks for sticking with the thread :)

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion

6 Mar 2011, 1:05 AM
#9
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: force featured products to display large image rater than standard image?

just a suggestion but you could use the larger image as your default product image - shrink it on your product_info page with click to enlarge

then by removing image value (W/H) for featured product it will display the larger image

17 Oct 2012, 4:46 AM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: force featured products to display large image rater than standard image?

Ran across this thread in a "similar threads" list, and as there seem to be no similar threads to this with a resolution, thought I'd chime in...

Bonnit was on the right track with the line to modify for featured products images:```php
zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT)

You also really need to test for the existence of the large image, as the stock product_info page image code does. If there happens to be no large image, the zen_image function as posted would fall back on the "no image" image instead of the small image.

/includes/modules/pages/popup_image/header_php.php holds the code for this:
```php
  $products_image_extension = substr($products_image, strrpos($products_image, '.'));
  $products_image_base = preg_replace('|'.$products_image_extension.'$|', '', $products_image);
  $products_image_medium = $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension;
  $products_image_large = $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension;

  // check for a medium image else use small
  if (!file_exists(DIR_WS_IMAGES . 'medium/' . $products_image_medium)) {
    $products_image_medium = DIR_WS_IMAGES . $products_image;
  } else {
    $products_image_medium = DIR_WS_IMAGES . 'medium/' . $products_image_medium;
  }
  // check for a large image else use medium else use small
  if (!file_exists(DIR_WS_IMAGES . 'large/' . $products_image_large)) {
    $products_image_large = $products_image_medium;
  } else {
    $products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_large;
  }
``` You would need to precede this with ```php
$products_image = $featured_products->fields['products_image']; 
``` and then use $products_image_large in zen_image(): ```php
  zen_image($products_image_large, $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT)