VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: neptoon on July 21, 2012, 01:10:13 AM

Title: SOLVED - Question regarding echo image url in vm2
Post by: neptoon on July 21, 2012, 01:10:13 AM
I've been trying to echo the image url in vm2 so i can customize my product category page. I found online that this should work

<?php echo $this->product->images[0]->file_url_thumb; ?>

but this doesn't work. i try to just echo it on the page to see if it gives me any output and it does not. i saw the other method to pull this but it adds all the <img src="'/> and so on.. just trying to get the raw url. or is this even possible?  do i need to import any variables?



the correct way was <?php echo $product->images[0]->file_url_thumb; ?> , thank you again for pointing out that first post.. ;) had to read it a couple times to get the grasp of things..  YOUR DA MAN!!!
Title: Re: Question regarding echo image url in vm2
Post by: ivus on July 21, 2012, 10:29:49 AM
Hi neptoon,

you must have missed the first post of this board.

http://forum.virtuemart.net/index.php?topic=100696.0 (http://forum.virtuemart.net/index.php?topic=100696.0)
Title: Re: Question regarding echo image url in vm2
Post by: neptoon on July 21, 2012, 15:26:21 PM
Ok so that should have worked then? I saw the first post. i'm just stuck.. i was looking through the database and couldn't even find where it was storying those image urls. only found the categories images in db under media. still getting the hang of this new vm2 thought i was making progress.. :)
Title: Re: SOLVED - Question regarding echo image url in vm2
Post by: ivus on July 22, 2012, 12:44:50 PM
Hi neptoon,

VM is a massive beast, but it is what it is. Joomla! is what it is... However PHP hasn't changed much over the years, you still go about grabbing data the same way. My best advice for finding values and code debugging (like when you expect a variable to be a certain value and it is) is to use the following piece of code... make sure you try it... in many different places.



  echo '<pre>'; print_r( $this ); echo '</pre>';



then move it down inside a loop and use this



  echo '<pre>'; print_r( $this->product ); echo '</pre>';



Can you see a pattern forming? You can basically substitute the variable inside the print-r to what ever variable/object you want to test.

Good luck.