VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: weigruf on June 13, 2012, 13:34:21 PM

Title: Ajax Mini Cart Product Image Problem
Post by: weigruf 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():


                        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:

<?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:

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!
Title: Re: Ajax Mini Cart Product Image Problem
Post by: weigruf on June 14, 2012, 11:30:24 AM
Fixed the error. :) Please lock the thread.
Title: Re: Ajax Mini Cart Product Image Problem
Post by: p.barg on September 06, 2012, 10:30:11 AM
Would you share your solution here?