Author Topic: Show product thumbs in backend products list  (Read 1475 times)

acchile

  • Beginner
  • *
  • Posts: 8
Show product thumbs in backend products list
« on: January 07, 2011, 16:24:24 pm »
Hi folks!

I work with jewelry, and because of this, I need to see thumbs of products in any list I use.

I am trying to hack the "administrator/components/com_virtuemart/html/product.product_list.php" sile to achieve that, so I am on edge of my knowledge in vm functions use :) and I need help.

After this, in line 247:

Code: [Select]
// these are the columns in the table
$columns = Array(  '#' => '',
"<input type=\"checkbox\" name=\"toggle\" value=\"\" onclick=\"checkAll(".$num_rows.")\" />" => "",

I added:

Code: [Select]
$VM_LANG->_('PHPSHOP_PRODUCT_THUMBADM') => "width=\"30%\"",
This Languege label I created in language file with name: 'Image'

And I added this

Code: [Select]
$listObj->addCell( $db->f("product_thumb_image") );
before this:
Code: [Select]
// The link to the product form / to the child products
if( $vmLayout == 'standard') {
$tmpcell = vmCommonHTML::hyperLink( $link, $text, '', 'Edit: '.$text );
} else {
$tmpcell = vmCommonHTML::hyperLink($link, $text, '', 'Edit: '.$text, 'onclick="parent.addSimplePanel( \''.$db->getEscaped($db->f("product_name")).'\', \''.$link.'\' );return false;"');
}

if( $ps_product->parent_has_children( $db->f("product_id") ) ) {
$tmpcell .= "&nbsp;&nbsp;&nbsp;<a href=\"";
$tmpcell .= $sess->url($_SERVER['PHP_SELF'] . "?page=$modulename.product_list&product_parent_id=" . $db->f("product_id"));
$tmpcell .=  "\">[ ".$VM_LANG->_('PHPSHOP_PRODUCT_FORM_ITEM_INFO_LBL'). " ]</a>";
}
$listObj->addCell( $tmpcell );

And I got a column showing me the name of thumb image. It´s a start but my goal is to show a thumb and a link to big file.

Someone can help me?
I search in foruns but found nothing about this

Tks,

Acchile

zanardi

  • Contributing Developer
  • Full Member
  • *
  • Posts: 878
    • GiBiLogic
Re: Show product thumbs in backend products list
« Reply #1 on: January 09, 2011, 00:13:41 am »
db->f("product_thumb_image") is only the name of the image file. You should give full path and wrap it in an <img> tag. Something like:

Code: [Select]
$listObj->addCell( '<img src="/components/com_virtuemart/shop_image/product/' . $db->f("product_thumb_image") . '" />' );

There are better ways but this is the basic one.
--
Francesco (zanardi)
http://extensions.gibilogic.com
@gibilogic on Twitter