News:

Support the VirtueMart project and become a member

Main Menu

SOLVED - Question regarding echo image url in vm2

Started by neptoon, July 21, 2012, 01:10:13 AM

Previous topic - Next topic

neptoon

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!!!

ivus


neptoon

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.. :)

ivus

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.