Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
X
Post

Show Thumbnails in Virtuemart Shopping Cart

show thumbnails on virtuemart shopping cart

Greetings,

Virtuemart doesn't come with the feature of showing thumbnails in shopping cart, how ever it is really easy to implement this awesome feature to Virtuemart, this modification is working on Virtuemart 1.1.x. And please make sure you SAVED your original files in case things messed up.  This modification will let you show thumbnails in shopping cart and check out process only. Not in the shopping cart module!

Make these files handy:

  • Components/com_virtuemart/themes/default/template/basket:
  • basket_b2b.html.php
  • basket_b2c.html.php
  • ro_basket_b2b.html.php
  • ro_basket_b2b.html.php
  • administrator/components/com_virtuemart/html:
  • basket.php
  • ro_basket.php

Add the following code lines to all 4 template/basket files.  The code to add is displayed on the second line.  The first line of code is a guide to show where to add the new code line.

<tr align="left" class="sectiontableheader">
        <th><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_FORM_THUMB_IMAGE') ?></th>

  <tr valign="top" class="<?php echo $product['row_color'] ?>">
    <td><?php echo $product['product_thumb_image'] ?></td>

Now we need to add the code that displays the image.  Add the following code to the basket.php and ro_basket.php files.  Once again, the first line of code is a guide that shows you where to place the code.

$product_rows[$i]['product_sku'] = $ps_product->get_field($cart[$i]["product_id"], "product_sku");
      //prepare thumb image
      if( $ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_thumb_image") ) {
                $product_thumb_image = $ps_product->get_field($_SESSION['cart'][$i]["product_id"], "product_thumb_image");
      }
      else {
            $product_thumb_image = 0;
      }
      if( $product_thumb_image ) {
         if( substr( $product_thumb_image, 0, 4) != "http" ) {
            if(PSHOP_IMG_RESIZE_ENABLE == '1') {
               $product_thumb_image = $mosConfig_live_site."/components/com_virtuemart/show_image_in_imgtag.php?filename=".urlencode($product_thumb_image)."&newxsize=".PSHOP_IMG_WIDTH."&newysize=".PSHOP_IMG_HEIGHT."&fileout=";
            }
            else {
               if( file_exists( IMAGEPATH."product/".$product_thumb_image )) {
                        $product_thumb_image = IMAGEURL."product/".$product_thumb_image;
                    }
                    else {
                        $product_thumb_image = IMAGEURL.NO_IMAGE;
                    }
            }
         }
      }
      else {
         $product_thumb_image = IMAGEURL.NO_IMAGE;
      }
      $product_rows[$i]['product_thumb_image'] = "<a href=\"$url\">"
     . "<img width=60 src= $product_thumb_image />"
      . "</a><br />";
      //end of prepare thumb image

 

I hope you found this modification usefull. Source: forum.virtuemart.net

Leave a comment  

name*

email*

website

Submit comment