Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / how to add product image to the template header

how to add product image to the template header

Locked

Views: 719

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
1 Feb 2009, 9:47 AM
#1
weber avatar

weber

Zen Follower

Join Date:
Nov 2005
Posts:
157
Plugin Contributions:
0

how to add product image to the template header

I want to show the product(shopping cart items) images on header of my site. I find that

$productArray[$i]["productsImage"]

can display the images, however, it comes with the width/height of the photo, how to get the product images url only....

9 Feb 2009, 12:05 PM
#2
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Location:
Bath, Somerset
Posts:
1,054
Plugin Contributions:
2

Re: how to add product image to the template header

The easest way is to create your own array, using an SQL query. You can then decide if you want specific products, or a random selection drawn from the database.

You just need to obtain the products_image variable from the products table within the database.

$header_products_rs = $db->Execute("select p.products_image, pd.products_name from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd where p.products_id = pd.products_id and pd.language_id = '".(int)$_SESSION['languages_id']."' order by rand() limit 1");
echo zen_image(DIR_WS_IMAGES.$header_products_rs->fields['products_image'], $header_products_rs->fields['products_name']);

Please note that this code has not been tested, and is meant only as a pointer in the right direction.

Absolute