PDA

View Full Version : Adding an image next to the name link at allprods.tpl.php



icecold
07-19-2005, 03:08 AM
hi i was trying to add an image in allprods.tpl.php listing, however what i did doesn't seem to work, what further modification I have to do, here is a what i did :

THis is the original code "

$products_query = tep_db_query("SELECT p.products_id, pd.products_name FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd WHERE p.products_id = pd.products_id AND p.products_status = 1 AND pd.language_id = $this_language_id ORDER BY pd.products_name");
"

So what i did here is simply add p.products_image to the query, so i can select the column with the images names:

"$products_query = tep_db_query("SELECT p.products_id, pd.products_name, p.products_image FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd WHERE p.products_id = pd.products_id AND p.products_status = 1 AND pd.language_id = $this_language_id ORDER BY pd.products_name");"

The i try to add another element to the array $products_array calling it image and pointing it to products_image:

"
$products_array[] = array('id' => $products['products_id'],
'name' => $products['products_name'],
'image' => $products['products_image']);
}
"
but my problems are with the echo statement as I was not able to output the result i was expecting, instead what it did was messing up with the links url adding the products_image name, like http://www.domain.com/link/allwhatever.jpg/http ... etc
so as I didn't find what the code exactly does, i need some input here ...

what i want is to display

image --- prod

modyfing the template allprods.tpl.php