Author Topic: Ajax Mini Cart Product Image Problem  (Read 2360 times)

weigruf

  • Beginner
  • *
  • Posts: 2
Ajax Mini Cart Product Image Problem
« on: June 13, 2012, 13:34:21 pm »
Hello!

I have succesfully edited some php files to show he product image thumbnail in the mini cart. I did that by adding the following code to:

my_template/helpers/cart.php in function prepareAjaxData():

Code: [Select]

                        if(!empty($product->image)) {
$this->data->products[$i]['image'] = JHTML::link($url, $product->image->displayMediaThumb('',false), 'title="'.$product->product_name.'"');
} else {
$this->data->products[$i]['image'] = '';
}

and...in my_template/mod_virtuemart_cart/default.php inside the foreach ($data->products as $product) loop:
 
Code: [Select]
<?php if ($product['image'] != '') { echo $product['image']; }?>
to actually display the  proudct image. The image is displayed right for every product but when I try to login as a user I am getting the following error in my_shop_url/component/users/?view=login page:

Code: [Select]
Fatal error: VirtueMartCart::prepareAjaxData() [<a href='virtuemartcart.prepareajaxdata'>virtuemartcart.prepareajaxdata</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;VmImage&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /blah...blah.../components/com_virtuemart/helpers/cart.php on line 1444
Thanks in advance!

weigruf

  • Beginner
  • *
  • Posts: 2
Re: Ajax Mini Cart Product Image Problem
« Reply #1 on: June 14, 2012, 11:30:24 am »
Fixed the error. :) Please lock the thread.

p.barg

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 165
    • Barg IT
Re: Ajax Mini Cart Product Image Problem
« Reply #2 on: September 06, 2012, 10:30:11 am »
Would you share your solution here?