Products Images In The Products List (Admin Side)

interkob

Avatar: interkob

2013-09-04 12:18

This function will show small image of each product together with product ID. It would be useful for admins who have a lot of products or products with very similar names. It's easier to find the product you need by seeing its image.

1. Open core/files.php and paste new function. You can change image size. I use 70px wide.
* find the code:

 // end function getDefaultImage


... and change it with the followin:

 // end function getDefaultImage
  
  /**
  * Displays a small image
  */
  
public function getSmallImage$iLink$iLinkType 1$bLinks null$sLink null ){
    if( isset( 
$this->aImagesDefault[$iLinkType][$iLink] ) ){
      return 
'<img src="'.DIR_FILES.$this->aImagesDefault[$iLinkType][$iLink]['iSizeValue1'].'/'.$this->aImagesDefault[$iLinkType][$iLink]['sFileName'].'" alt="'.( isset( $this->aImagesDefault[$iLinkType][$iLink]['sDescription'] ) ? $this->aImagesDefault[$iLinkType][$iLink]['sDescription'] : $this->aImagesDefault[$iLinkType][$iLink]['sFileName'] ).'" width="70" />';
    }
  } 
// end function getSmallImage



2. Open core/products-admin.php
* in the function ListProducts change the code:

$iCount count$aProducts );


... with:

$iCount count$aProducts );
      
$oFile Files::getInstance( );



* the final step is to find in the same file:

<td class="id">
            
'.$aData['iProduct'].'
          
</td>


... and change it with:

<td class="id">
            
'.$aData['iProduct'].$oFile->getSmallImage( $aData['iProduct'], 2, true ).'
          
</td>



Now go to admin side, open products list and you are supposed to see small images in the left side of each product. This upgrade is not professional, but it's ok.

Also we can do the same in shorter way, for example, by using the current default getDefaultImage function...

» Quick.Cart v6.x

interkob@gmail.com

Back to top
about us | contact