
Originally Posted by
suedouglas
Not sure if this is the right forum for php questions, but I'm having trouble finding a PHP forum
I'm trying to display the manufacturers image on the product info page which when clicked goes to their url to see all that manufacturers products
My coding is in the following .php file:
/includes/templates/mytemplate/templates/tpl_product_info_display.php The problem is that only the first manufacturers image is shown on all products, even those that belong to the second manufacturer. Can anyone spot what I have wrong please? (I've resorted to hardcoding the urls and images which is why I need an if statement, as I couldn't get it to work at all when trying to get the manufacturers url and image from the database, and since there are only two of us ...!)
This is my problem coding:
<?php
$manufacturers_name = zen_get_products_manufacturers_name($product_info->fields['products_id']);
If ($manufacturers_name = "Sandie Burchell") {
?>
<a href="index.php?main_page=index&manufacturers_id=3"> <img src="/images/sandie_burchell.jpg"> </a>
<?php
} elseif ($manufacturers_name = "Sue Douglas") {
?>
<a href="index.php?main_page=index&manufacturers_id=4"> <img src="/images/sue_douglas.jpg"> </a>
<?php
}
?>
If I'm totally in the wrong forum for this question, could anyone recommend a good (preferably free!) PHP forum that would be able to help me please?
Thanks!
You've used assignment operators (single equal sign) instead of equality operations (double equal sign):
Code:
<?php
$manufacturers_name = zen_get_products_manufacturers_name($product_info->fields['products_id']);
If ($manufacturers_name == "Sandie Burchell") {
?>
<a href="index.php?main_page=index&manufacturers_id=3"> <img src="/images/sandie_burchell.jpg"> </a>
<?php
} elseif ($manufacturers_name == "Sue Douglas") {
?>
<a href="index.php?main_page=index&manufacturers_id=4"> <img src="/images/sue_douglas.jpg"> </a>
<?php
}
?>