VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: nkamp on December 24, 2016, 00:38:55 AM

Title: How do achieve the product thumb (url)?
Post by: nkamp on December 24, 2016, 00:38:55 AM
Hello,

I'm bussy with a site to upgrade from joomla 2.5/vm2.x --> joomla 3.5 / vm3.0. I have a cart module (linelabox) which I like. I have made some changes to this module so that it works in joomla 3/vm3

But the vm2 way of showing the product thumb was this:
foreach($data->products as $product) {
// some code
<div class="image"><?php echo $product["image"]; ?></div>
// some code
}


What is a replacement for $product["ïmage"]? I have read some different opportunity's like :
$product->images[0]->getFileUrlThumb();
$this->product->images[0]->getFileUrlThumb();
$product->images[0]->displayMediaThumb('',false);


But this is not working.

Must I include a another php file?

I hope that someone can give me a tip in the right direction.

Thanks,

Nico
Title: Re: How do achieve the product thumb (url)?
Post by: nkamp on December 26, 2016, 11:54:30 AM
Hello,

I see that more have this question and most of the suggestions I've tried. Or is the question not clear or maybe strange???

I'm not familiar with PHP but this is a way to learn.
I assume that $product is a instantiation of a class and that it has different properties like images[array] or methods like displayMediaThumb().

The cart module $product["quantity"] returns the right value or $product["product_name"], returns the right name. So this seems right for me.

What is now the problem with the media thumb? Is this now replaced to another class?
One thing is that the cart module is on every page, also on pages without virtuemart shop category/products.

I've been looking in the database for the product fields but it was me not pointing in a direction that I thought, ok I have to search for that field. Till now I could not find code that was pointing me in a direction that I thought, that's a good example.

I hope that someone can help me further.

Nico
Title: Re: How do achieve the product thumb (url)?
Post by: GJC Web Design on December 26, 2016, 14:29:29 PM
the image was ONLY just incl. in the ajax that returns the product info in the cart module in release http://dev.virtuemart.net/attachments/download/1038/com_virtuemart.3.0.18.7_extract_first.zip

before the image was never returned and 3rd party cart modules used their own techniques to obtain the image/thumb

so your looking in the wrong place.. u need to study the code of the 3rd party module to see how they obtain the $product["image"]
prob a helper ajax or similar to get the image

the code snips your using are for the native product object and in any case will not work in this module code
Title: Re: How do achieve the product thumb (url)?
Post by: nkamp on December 27, 2016, 17:38:19 PM
Hello GJC Web Design,

Thanks for you're post. I was today already started with it, to look at two OPC, which show the pictures on the OPC page. Ok thanks again, now I don't have to look further in the existing module code to try to get this work in the way as it is. This is a good PHP training to copy properties/method(s) to this module 'cart' class or instantiate one the OPC classes in the cart class.

I will try to find out.

Nico

Title: Re: How do achieve the product thumb (url)?
Post by: GJC Web Design on December 27, 2016, 22:49:21 PM
Quotewhich show the pictures on the OPC page

in the main cart to show the image is simple.. it is in the cart object

but the cart MODULE is loaded by ajax and has never returned the product image until the very latest release