Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Converting html to php - need help Please


Davee

Recommended Posts

Hi

 

I need help with converting the manufactures image to link to the product url into php

 

 <a href='http://www.hp.com' target="mfr_window" class="main" title="Click to visit manufacturer's website"><img src='http://image.jpg' border= '0'></a>

 

I have tried but still yet to get it right :(

 

Thanks in advance

 

Dave

Link to comment
Share on other sites

What part of it do you want to do in PHP? If you put what you wrote in a php file in between a ?> and a <?php, the file would just pass it along as html, unless it was inside a control path that wasn't taken.

 

PHP is just a way to generate HTML, nothing special about it. If you want the "http://www.hp.com" and "http://image.jpg" to be pulled dynamically based on the database, then that is different. The question is where you would want to do this: on what PHP page and where on the page. Is there something similar already there? For example, have you checked includes/boxes/manufacturers.php? Most likely, the line would look like:

<a href="<?php echo tep_href_link($product_array['products_url']); ?>" target=mfr_window" class="main" title="Click to visit manufacturer\'s web site"><?php echo tep_image(DIR_WS_IMAGES . $product_array['products_image'], 'Click to visit manufacturer's web site', '', '', 'border="0"'); ?></a>

However, the exact code would depend on the location from which you were calling it. Is $product_array correct? Do you need to use a different variable name? Do you need to run a SQL query to get that info?

 

Hth,

Matt

Link to comment
Share on other sites

Many Many Thanks for your reply :)

 

I am trying to use the manufactures image in product info & use the image as a link to the Manufacturers url

 

This is displayed in the manufacturers info box as eg "hp Homepage"

 

This is the code from manufacturers info as text

 if (tep_not_null($manufacturer['manufacturers_url'])) $manufacturer_info_string .= '<tr><td valign="top" class="infoBoxContents">- </td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&manufacturers_id=' . $manufacturer['manufacturers_id']) . '" target="_blank">' . sprintf(BOX_MANUFACTURER_INFO_HOMEPAGE, $manufacturer['manufacturers_name']) . '</a></td></tr>';

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...