Author Topic: How to add Image and Price product on Topten Module  (Read 8699 times)

barock

  • Beginner
  • *
  • Posts: 3
How to add Image and Price product on Topten Module
« on: February 14, 2009, 16:29:23 pm »
Hey everyone, is there anyone of you know how to show the image and the price on topten module.
please share if you know about it...
regard Zidni

zoom

  • Beginner
  • *
  • Posts: 1
Re: How to add Image and Price product on Topten Module
« Reply #1 on: March 02, 2009, 01:06:48 am »
Hello, I just got the images and the prices to work in TopTen Bestselling Products Module ;D

Here's what to do:
edit file: mod_virtuemart_topten.php

Use this way to add just the product images:

Find: (around line 38)
Code: [Select]
$list  = "SELECT p.product_id, p.product_sales as sales, p.product_parent_id, p.product_name, c.category_id, c.category_flypage";

Change to:
Code: [Select]
$list  = "SELECT p.product_id, p.product_sales as sales, p.product_parent_id, p.product_name, c.category_id, c.category_flypage, p.product_thumb_image ";


Then find: (around line 77)
Code: [Select]
<tr class="<?php echo $sectioncolor ?>">
      <td width="15%"><?php printf("%02d"$tt_item); ?></td>
      <td width="85%">
        <a href="<?php $sess->purl(URL "index.php?page=shop.product_details&flypage=$flypage&product_id=" $pid "&category_id=" $db->f("category_id")) ?>">
<?php $db->p("product_name");?></a>
      </td>
    </tr>

Change to:
Code: [Select]
<tr class="<?php echo $sectioncolor ?>">
      <td width="15%"><hr color="#d8d8d8"><b>#<?php printf("%02d"$tt_item); ?></b></td>
      <td width="85%"><hr color="#d8d8d8">
        <a href="<?php $sess->purl(URL "index.php?page=shop.product_details&flypage=$flypage&product_id=" $pid "&category_id=" $db->f("category_id")) ?>">
            <?php $db->p("product_name");?></a><div><img src="<?php printf(URL "/components/com_virtuemart/shop_image/product/" $db->f("product_thumb_image")) ?>" width="200" /></div> 
      </td>
    </tr>

I hacked this code above completely and then just recently found someone else in the forum that has done it a different way. This way above allows you to set any size image width. 



=====================================

Here's how to add Both the Price and the Image at the same time:

Find this:
Code: [Select]
$list  = "SELECT p.product_id, p.product_sales as sales, p.product_parent_id, p.product_name, c.category_id, c.category_flypage";
$list .= "FROM #__{vm}_product p, #__{vm}_product_category_xref pc, #__{vm}_category c WHERE ";
$q = "p.product_publish='Y' AND ";
$q .= "pc.product_id = p.product_id AND ";
$q .= "pc.category_id = c.category_id AND ";
$q .= "p.product_sales > 0 ";
$q .= "GROUP BY p.product_id ";
$q .= "ORDER BY sales DESC, p.product_name ";
$list .= $q . " LIMIT 0, $num_topsellers ";

Change to:
Code: [Select]
$list  = "SELECT p.product_id, p.product_sales as sales, p.product_parent_id, p.product_name, c.category_id, c.category_flypage, p.product_thumb_image, d.product_price ";
$list .= "FROM #__{vm}_product p, #__{vm}_product_category_xref pc, #__{vm}_category c, #__{vm}_product_price d WHERE ";
$q = "p.product_publish='Y' AND ";
$q .= "pc.product_id = p.product_id AND ";
$q .= "pc.category_id = c.category_id AND ";
$q .= "p.product_id = d.product_id AND ";
$q .= "p.product_sales > 0 ";
$q .= "GROUP BY p.product_id ";
$q .= "ORDER BY sales DESC, p.product_name ";
$list .= $q . " LIMIT 0, $num_topsellers ";

Then find: (around line 77)
Code: [Select]
<tr class="<?php echo $sectioncolor ?>">
      <td width="15%"><?php printf("%02d"$tt_item); ?></td>
      <td width="85%">
        <a href="<?php $sess->purl(URL "index.php?page=shop.product_details&flypage=$flypage&product_id=" $pid "&category_id=" $db->f("category_id")) ?>">
<?php $db->p("product_name");?></a>
      </td>
    </tr>

Change to:
Code: [Select]
<tr class="<?php echo $sectioncolor ?>">
            <td width="85%"><hr color="#d8d8d8">
        <a href="<?php $sess->purl(URL "index.php?page=shop.product_details&flypage=$flypage&product_id=" $pid "&category_id=" $db->f("category_id")) ?>">
            <?php $db->p("product_name");?></a><div><img src="<?php printf(URL "/components/com_virtuemart/shop_image/product/" $db->f("product_thumb_image")) ?>" width="200" /></div> 
            #<?php printf("%02d"$tt_item); ?> --- $<?php $db->p("product_price");?>
       </td>
       </tr>
This pricing code was found in the forum.



That's it.

Ummm, I wonder if there's a way to add the cart button?
Maybe it would also be nice to make these options selectable via the admin...
Dan



doniafrizal

  • Beginner
  • *
  • Posts: 7
Re: How to add Image and Price product on Topten Module
« Reply #2 on: May 28, 2009, 12:03:26 pm »
Hi,

you can download my modified Virtuemart Top Ten module at this link >> http://www.ziddu.com/download/4934812/mod_virtuemart_topten.zip.html

By using this module, you can show product image, and also add to cart button. This one, we can called it extended featured product module.

Thanks
Doni Afrizal

JanJ

  • Beginner
  • *
  • Posts: 10
Re: How to add Image and Price product on Topten Module
« Reply #3 on: February 20, 2011, 16:57:47 pm »
Hello,

this topic was very helpfull for me, that what exactly what I was searching. I am a problem with VM modules since I updated it to latest version. The content (images and the whole content of module) jumps like there was a padding. I would really appriciate if anyone could help me with that.

You can see my page here: http://fetis.si/nova

Thanks,
Jan

Kub

  • Beginner
  • *
  • Posts: 14
Re: How to add Image and Price product on Topten Module
« Reply #4 on: April 06, 2011, 13:47:28 pm »
Thank you :)

gargantouas

  • Beginner
  • *
  • Posts: 15
Re: How to add Image and Price product on Topten Module
« Reply #5 on: March 12, 2012, 14:15:16 pm »
Should anyone want to display the default noimage.gif if there is no image for the product can follow this:
Code: [Select]
<?php $product_image $db->f("product_thumb_image")==NULL true false;
  if($product_image !=1) { ?>

      <img src="components/com_virtuemart/shop_image/product/<?php $db->p("product_thumb_image");?>" border="0" />
      <?php } else {
  ?>

      <img src="components/com_virtuemart/themes/default/images/noimage.gif" border="0" />
      <?php
  } 
?>


ngoctuankt3

  • Beginner
  • *
  • Posts: 1
Re: How to add Image and Price product on Topten Module
« Reply #6 on: May 11, 2012, 03:56:43 am »
Thank , this topic was very helpfull for me.