News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

How do achieve the product thumb (url)?

Started by nkamp, December 24, 2016, 00:38:55 AM

Previous topic - Next topic

nkamp

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

nkamp

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

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

nkamp

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


GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation