Forums / Templates, Stylesheets, Page Layout / manufacture logo on product info page

manufacture logo on product info page

Started by 100asa on 1 Jan 2014, 4:14 PM · Views: 1,745

Results 1 to 12 of 12
1 Jan 2014, 4:14 PM
#1
100asa avatar

100asa

Totally Zenned

Join Date:
Oct 2006
Location:
Italy
Posts:
636
Plugin Contributions:
0

manufacture logo on product info page

Why I've this custom code:

<?php
   if ($check_image = zen_get_products_manufacturers_image((int)$_GET['products_id'])) {
     echo '<a class="manufacturer" href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers_id) . '">' . zen_image(DIR_WS_IMAGES . $check_image) . '</a>' . "\n" ;
   } else {
     echo 'NO IMAGE';
   }
 
 ?> 

that show manufaturer logo on my product info page, but the link at the manufacturer all products page don't work? Where is the issue?

1 Jan 2014, 8:59 PM
#2
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: manufacture logo on product info page

100asa:

Why I've this custom code:

<?php if ($check_image = zen_get_products_manufacturers_image((int)$_GET['products_id'])) { echo '<a class="manufacturer" href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers_id) . '">' . zen_image(DIR_WS_IMAGES . $check_image) . '</a>' . "\n" ; } else { echo 'NO IMAGE'; } ?>
> that show manufaturer logo on my product info page, but the link at the manufacturer all products page don't work? Where is the issue?

The manufacturers id needs to be added to /includes/modules/pages/product_info/main_template_vars.php

find:
```php
  $products_manufacturer = $manufacturers_name;

add below it:

  $manufacturers_id = $product_info->fields['manufacturers_id'];

and your posted code will work!

2 Jan 2014, 6:45 AM
#3
100asa avatar

100asa

Totally Zenned

Join Date:
Oct 2006
Location:
Italy
Posts:
636
Plugin Contributions:
0

Re: manufacture logo on product info page

Great! Thank you so much!

2 Jan 2014, 7:23 AM
#4
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: manufacture logo on product info page

100asa:

Great! Thank you so much!

NP, glad I could help!

11 Sep 2014, 2:22 PM
#5
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: manufacture logo on product info page

Hey, this is a great trick!

I want to manipulate it a bit further, though. Specifically, I want to do two things:

  1. Remove the link entirely
  2. Control the size of the image displayed

Removing the link:
That seems so simple, but I cannot figure out how to alter the code without killing the image! Can someone please show me what I need to do?

Controlling the size of the image displayed:
The site I'm working on features dozens of manufacturers. The logos have been uploaded in various sizes. The code in the OP simply outputs the logo as is. Is there a simple snippet of code that can be added to retain aspect ratio, but limit the width or height (whichever is greater) to, say, 60p?

Thanks!

11 Sep 2014, 2:38 PM
#6
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: manufacture logo on product info page

Also, in the event there is no image available, I'd rather just skip it and not output the NO IMAGE file.

Can I simply do this (strip off the last statement):

<?php if ($check_image = zen_get_products_manufacturers_image((int)$_GET['products_id'])) { echo '<a class="manufacturer" href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers_id) . '">' . zen_image(DIR_WS_IMAGES . $check_image) . '</a>' . "\n" ?>
11 Sep 2014, 2:54 PM
#7
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: manufacture logo on product info page

Plz ignore that last idea. Automatically resizing is not practical and I don't really want to do that! :)

11 Sep 2014, 3:22 PM
#8
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: manufacture logo on product info page

Ok, I think this is working correctly now. Can somebody please take a peek and let me know if I did something wrong?

First, I did not do this because I did not want to link the image to anything:

The manufacturers id needs to be added to /includes/modules/pages/product_info/main_template_vars.php

Then I did add this code to the product info page:

<!--bof Mfg logo image -->
<?php
   if ($check_image = zen_get_products_manufacturers_image((int)$_GET['products_id'])) {
     echo '<a class="manufacturer" href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers_id) . '">' . zen_image(DIR_WS_IMAGES . $check_image) . '</a>' . "\n" ;
   } else {
     echo ' ';
   }
 
 ?> 

<!--eof Mfg logo image -->
11 Sep 2014, 5:23 PM
#9
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: manufacture logo on product info page

The code below still allows the image to be clicked and redirects to the homepage.

To only add the image, try:

<!--bof Mfg logo image --> <?php if ($check_image = zen_get_products_manufacturers_image((int)$_GET['products_id'])) { echo zen_image(DIR_WS_IMAGES . $check_image) . "\n" ; } else { echo ' '; } ?> <!--eof Mfg logo image -->

Feznizzle:

Ok, I think this is working correctly now. Can somebody please take a peek and let me know if I did something wrong?

First, I did not do this because I did not want to link the image to anything:

Then I did add this code to the product info page:

<!--bof Mfg logo image --> <?php if ($check_image = zen_get_products_manufacturers_image((int)$_GET['products_id'])) { echo '<a class="manufacturer" href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers_id) . '">' . zen_image(DIR_WS_IMAGES . $check_image) . '</a>' . "\n" ; } else { echo ' '; } ?> <!--eof Mfg logo image -->
11 Sep 2014, 6:33 PM
#10
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: manufacture logo on product info page

Thanks, rbarbour!

You are right, that code had the link still in it. This is the code I meant to post:

<!--bof Mfg logo image -->
<?php
   if ($check_image = zen_get_products_manufacturers_image((int)$_GET['products_id'])) {
     echo '<a class="manufacturer">' . zen_image(DIR_WS_IMAGES . $check_image) . '</a>' . "\n" ;
   } else {
     echo ' ';
   }
 
 ?> 

<!--eof Mfg logo image -->

^ That code did not end up with a link because I took the href out. But my code is dif than what you posted, yours is cleaner. Best I can tell (I'm terrible with php!), it appears I'm calling on a style when it's not really necessary.

I already handed the work back to my client as finished (seems to work fine). If you don't think my version of the code will cause a problem, I'm inclined to call it a day.

What do you think?

11 Sep 2014, 6:36 PM
#11
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: manufacture logo on product info page

Should be good!

Feznizzle:

Thanks, rbarbour!

You are right, that code had the link still in it. This is the code I meant to post:

<!--bof Mfg logo image --> <?php if ($check_image = zen_get_products_manufacturers_image((int)$_GET['products_id'])) { echo '<a class="manufacturer">' . zen_image(DIR_WS_IMAGES . $check_image) . '</a>' . "\n" ; } else { echo ' '; } ?> <!--eof Mfg logo image -->
> 
> ^ That code did not end up with a link because I took the href out. But my code is dif than what you posted, yours is cleaner. Best I can tell (I'm terrible with php!), it appears I'm calling on a style when it's not really necessary.
> 
> I already handed the work back to my client as finished (seems to work fine). If you don't think my version of the code will cause a problem, I'm inclined to call it a day. 
> 
> What do you think?
11 Sep 2014, 6:39 PM
#12
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: manufacture logo on product info page

Thanks!

rbarbour:

Should be good!