AbanteCart Community
Shopping Cart Operations => Support => Topic started by: cookie on January 24, 2014, 06:18:04 PM
-
Hi,
I noticed that images have a field called "description" attached to them, but that information is not used anywhere!
How can I pull the description in php to include it in a template?
(and by the occasion, maybe the image title as well)
Thanks!
-
Cookie the images are in this path:
storefront>view>default_html5>image
The description is probably an "alt" message you can if the image doesn't render for some reason. Also an excellent SEO technique, using "alt" tags on images. Every image should have one. However, you'll need to add the "alt" tag to the image in the HTML.
Gordon
-
Hi,
Well actually I am looking for the php bit to get that image description.
I tried <?php echo $image['description']; ?>
but it does nothing.
The info is saved in the database but something is not properly defined somewhere.
Nope, that bit is not used as "alt", just the name is used everyhwere and for everything. Wonder why ?!?
This is the code from product.tpl
<img src="<?php echo $image_url; ?>" alt="<?php echo $image['title']; ?>" title="<?php echo $image['title']; ?>">
I'd like to display that description bellow the image, there is not that much info on the page anyways.
Do you have an idea how to get that working?
Thx
-
Hi,
Well actually I am looking for the php bit to get that image description.
I tried <?php echo $image['description']; ?>
but it does nothing.
The info is saved in the database but something is not properly defined somewhere.
Nope, that bit is not used as "alt", just the name is used everyhwere and for everything. Wonder why ?!?
This is the code from product.tpl
<img src="<?php echo $image_url; ?>" alt="<?php echo $image['title']; ?>" title="<?php echo $image['title']; ?>">
I'd like to display that description bellow the image, there is not that much info on the page anyways.
Do you have an idea how to get that working?
Thx
OK, as you can see, those calls are simply calling an image, with the "alt" text, in this case the "alt" text is the title and also the third call is calling the title. They are NOT calling any description. You'll have to add the description in HTML under that line of code, assuming your description isn't too long. It would require you to rewrite every product page, not an easy task. Alternately, you can write a the php to call that info, but I'm not sure if you have that skill set.
There is ample room on the Insert product page for a description of the item you're selling. The "alt" title will show before the image loads, the title is under the image. A great example is the dashboard when you log into your Amin panel.
The description that is displayed with the product is in a different block of php. Look at this product page on my website http://wholesaleostomysupplies.com/index.php?rt=product/product&path=65_74&product_id=113 and you'll see the description below the add to cart button. Is that not sufficient for your needs?
If you want to add the description right under your product image, you'll need to re-write that entire piece of php that displays the image, and that will be a real chore, As you can see in my example, I add as much descriptive info as I can in the product name box when building the product page.
I think I have covered what you want to know, I'm not entirely sure exactly what or where you want the description.
Alternately, you can use an image editor and add the text to the image, if it's not that much text.
-
well, the thing is I want to display products with a bunch of images and options, each image and each option earning their very own description.
So I thought I could make use of that image description to achieve that and yes, that would require to edit the product.tpl
But it's obvious that the parameter "image [description]" was lost somewhere along the way and it does not work.
I managed to pull the title with <?php echo $image['title']; ?>
but when I try <?php echo $image['description']; ?>
that brings out nothing!!
I also did not get it working for the options images, that seems to be an other story
I do not seem to find any of the info I need >:(
-
try to replace file public_html/core/engine/resources.php (i added image description) see attachment
and then try to use echo $image['description'] in your tpl
-
Hi,
Thank you v.much for the file! I replaced it and than tried to use the following in product.tpl
<div class="custom_img_name"><?php echo $image['title']; ?></div>
<div class="custom_img_desc"><?php echo $image['description']; ?></div>
echo $image['title']; works, echo $image['description']; not :-[
I checked the image does have a description defined in the library ....
Any ideas what am I doing wrong?
Thx