Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Image titles??


Guest

Recommended Posts

Hello,

 

I've added additional images to my store in the 'Products Description' area. I'd like to use the products name as the title for each images, just like it is when you hover over the image for the product.

 

I've tried:

<img src="asd.gif" alt="<?php echo $products_name; ?>">

and

<a  onClick="details=window.open('m15series_files/ar001m1.jpg')" title="<?php echo $products_name; ?>"> something </a>

 

just using "<?php echo $products_name; ?>" alone wont even pull up the prodict name.

 

How can I do this?

 

TIA :-)

Link to comment
Share on other sites

if I understood you correctly, you want to use php in the description field ... you need the eval function for that:

 

http://www.oscommerce.com/forums/index.php?showtopic=157369

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Thanks, I quickly copied and pasted that code but It just left me with the code showing in the end.

Would you help me alittle with it or break it down for me to understand. I'm not very good with php as you can see.

 

<?php $product_info['products_description'] = "
<table border=0 width=100% cellspacing=0 cellpadding=0><tr><td width=100%>
<?php include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); ?>
</td></tr></table>
"; ?>

<?php eval (' ?> ' . $product_info['products_description'] . ' <?php '); ?>

That code left me with no new table and "<?php eval (' ?> ' . $product_info['products_description'] . ' <?php '); ?>" showing.

 

Thanks

Link to comment
Share on other sites

try an echo before the eval

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

nope no luck... :-(

its weird... in the preview and as a updated product display the page acts like theres an open tag somewhere but there isnt...

 

<?php $product_info['products_name'] = "
<table border=1 width=100% cellspacing=0 cellpadding=0><tr><td width=100%>
<?php include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); ?>
</td></tr></table>
"; ?>

<?php echo eval (' ?> ' . $product_info['products_name'] . ' <?php '); ?>

 

Why wont a simple echo work? Its all pulling from the same info

Link to comment
Share on other sites

playing with it some more...

shouldnt "<?php echo $product_info['products_name'] ?>" bring up the products name?

 

I made a simple little php file and for what I wanted it works just cant figure out why I cant do it in this.

 

<html>
hello world :-)<BR><BR>
<?php 
$test = "test title"
?>
<a href="http://www.cnn.com" title="<?php echo $test ?>">
<img src="2.gif"></a>
<BR><BR>should have worked
</html>

Link to comment
Share on other sites

playing with it some more...

shouldnt "<?php echo $product_info['products_name'] ?>" bring up the products name?

 

I made a simple little php file and for what I wanted it works just cant figure out why I cant do it in this.

 

<html>
hello world :-)<BR><BR>
<?php 
$test = "test title"
?>
<a href="http://www.cnn.com" title="<?php echo $test ?>">
<img src="2.gif"></a>
<BR><BR>should have worked
</html>

is that not what you have added as php to the products descriptin? I have not used eval myself, so please google it.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Well for one lets look at this code

 

<?php echo eval (' ?> ' . $product_info['products_name'] . ' <?php '); ?>

 

 

You have this

 

 ' . $product_info['products_name'] . '

 

between ?> and <? so how is the PHP engine suppose to render php code if you have it closed off.

 

This should work <?php echo $product_info['products_name'] ?> if not try the above like this.

 

<?php echo eval (' . $product_info['products_name'] . '); ?>

 

can't promise you anything though.

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

<html>
hello world :-)<BR><BR>
<?php 
$test = "test title"
?>
<a href="http://www.cnn.com" title="<?php echo $test ?>">
<img src="2.gif"></a>
<BR><BR>should have worked
</html>

 

That was just something I simple made up to see if what I wanted to do would work in a clean environment and it does.

I've tried a simple echo in the products description and it doesnt bring up the product name. Maybe I'm calling for the wrong name. I've tried:

<?php echo $products_name; ?>
<?php echo $product_info['products_name'] ?>
<?php echo eval (' . $product_info['products_name'] . '); ?>

with no luck.

 

I guess I'll just keep fighting with it. Thanks for your time :-)

Link to comment
Share on other sites

Try this:

 

<?php echo $product_info['products_name']; ?>

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

can you please rephrase your first plans?

 

were you adding images to products description? if yes, with what code?

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

I don't see why you can't just add the Alt name manually since you are having to add the <img src... yada yada yada. I know by default the thumbnails do this. So you could look up that code and see how they have it.

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

Sorry dont mean to be confusing you.

I'm adding a table in the products description to organize more information. I'm also adding more images in the description that customers can click and view a larger image. The 'main' image for the product that osCom lets you add has a title based on the products name. I'd like to do that with the additional pictures I'm adding. Have their title also be the products name.

 

Example of what I have is:

<table class="des" width="100%" border="1" cellpadding="0" cellspacing="0">
<TR>
<td>Weight</td>
<td>2737.0g</td>
</tr><tr>
<td>blah </td>
<td>asda</td>
</tr><tr>
<td>aseseaf</td>
<td>sadfasdf</td>
</tr><tr>
<td>asdfasdf</td>
<td>300</td>
</tr><tr>
<td>asdfesf</td>
<td>sadfasdf</td>
</tr><tr>
<td>asdfasdf</td>
<td>asdfasdf</td>
</tr><tr>
<td>asdfasdf</td>
<td>asdfasdfa</td>
</tr><tr>
<td valign="top">Notes</td>
<td>Metal Body <br>
more description here<BR>
and here too...</td>
</tr>
<!##### Pictures go below here ####>
<TR><TD colspan="2" align="middle">
<a style="cursor:help" onClick="details=window.open('m15series_files/ar001m1.jpg', 'details', 'scrollbars= no toolbar=no, status = no, height =350, width = 650')" 
title="<?php echo $product_info['products_name'] ?>">
<img src="m15series_files/ar001m1.jpg" border="0" width="100"></a>
</TD></TR></table>

Link to comment
Share on other sites

I don't see why you can't just add the Alt name manually since you are having to add the <img src... yada yada yada. I know by default the thumbnails do this. So you could look up that code and see how they have it.

 

thought I'd save myself some time insted of editing every image code. but I think I'm wasting more time trying to figure this out. lol

 

The default code in "product_info.php" is:

<td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
		  </td>

but since I know little to nothing of php its all rather jiberish to me. :-(

 

Thanks for your help

Link to comment
Share on other sites

<img src="m15series_files/ar001m1.jpg"  alt="PICTURE TITLE HERE" border="0" width="100"></a>

 

Sounds like the easiest way is just to manually enter each one. I mean you are hard coding the img in and you have to add the php code anyways to each one. Sometimes you can't copy and past everything.

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

gimme a sec and let me look further into the code

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

Yea it might be just as easy to add the title to the alt tag. I see your intentions which isn't a bad idea. It might be just as easy to enter each one anyways. Instead of copy and pasting the php code into each alt. Just copy and past the Alt=title into each one for that product.

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

so you have not been adding to your products description (database field) at all? hehe ... you want to add it to your products detail page :-)

 

 

well that's a piece of cake.

 

Show me the code for your extra images and I add the name and whatever you want.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

like I said before, I don't know php too well... :-(

 

The image codes are

<a style="cursor:help" onClick="details=window.open('m15series_files/ar001m1.jpg', 'details', 'scrollbars= no toolbar=no, status = no, height =350, width = 650')" 
title="###Where I'm trying to call the echo###">
<img src="m15series_files/ar001m1.jpg" border="0" width="100"></a>

Link to comment
Share on other sites

like I said before, I don't know php too well... :-(

 

The image codes are

<a style="cursor:help" onClick="details=window.open('m15series_files/ar001m1.jpg', 'details', 'scrollbars= no toolbar=no, status = no, height =350, width = 650')" 
title="###Where I'm trying to call the echo###">
<img src="m15series_files/ar001m1.jpg" border="0" width="100"></a>

 

 

title is not going to work you need to add it like this

 

<img src="m15series_files/ar001m1.jpg" ALT="TTILE GOES HERE" border="0" width="100">

 

so it would be like this

 

<a style="cursor:help" onClick="details=window.open('m15series_files/ar001m1.jpg', 'details', 'scrollbars= no toolbar=no, status = no, height =350, width = 650')" 
<img src="m15series_files/ar001m1.jpg" ALT="TTILE GOES HERE" border="0" width="100"></a>

 

Now TTILE GOES HERE can be the manually entered title or if you figure it the php code.

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

you want the same image to show for all products?

 

<a style="cursor:help" onClick="details=window.open('m15series_files/ar001m1.jpg', 'details', 'scrollbars= no toolbar=no, status = no, height =350, width = 650')">
<?php echo tep_image('m15series_files/ar001m1.jpg', $product_info['products_name'], '100'); ?></a>

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

the title code works just fine. Its ment to bring the title next to the curser. The Alt code is if the image isnt there, kinda like a place holder.

 

I just cant get the echo to pull the product name.

 

What I would like to have is: HERE with the Product name popping up when you hover.

If its not doable then oh well. I'll just add the Product name in for each image.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...