News:

Looking for documentation? Take a look on our wiki

Main Menu

External image url (custom field) in category view in VM3

Started by Tiger78, November 04, 2015, 17:53:52 PM

Previous topic - Next topic

Tiger78

Hello,

I use this code in category.php (category view) in VM 2.6.20 and it works. So the external image will be displayed.

<?php 
          
if (!empty($product->customfields))  {        
              foreach (
$product->customfields as $field)   {   
                if (
$field->display) {
                   if (
$field->custom_title == "external produkt-image-url") {  ?>
         
                      <img src="<?php echo $field->display ?>"  />
                      <?php   }    
               } 
             } 
           }  
          
?>



Now I have updated to VM 3 (3.0.11.4).
But the code does not work in ../sublayouts/products.php

How can I read the image-url (custom field) from the database?
I canĀ“t figure out what has changed in database.

Thanks!




PRO

I use this in my products layout

layout-position is   category_swatch

      <?php if   (!empty($product->customfieldsSorted[category_swatch]))   {      
   foreach ($product->customfieldsSorted[category_swatch] as $field) {
    echo '<div class="swatch"><a title="'.$product->product_name.'" href="'.$product->link.$ItemidStr.'">';
echo $field->display.'</a><div class="wrap"></div></div>';
      } } ?>