I am trying to reference a products image in the related products template, default_relatedproducts.php
obviously $this->product->image[0]->file_url references the current products im viewings image url, but I need to grab the image of the related product.
Ideally I want to output related products in a floated div and manipulate them with a jQuery carousel.
Sadly, I can't work out where I can reference whats going on. I have this output:
<span class="product-field-display">
<a title="Related Product" href="x"><img alt="" src="http://mysite.com/components/com_virtuemart/assets/images/vmgeneral/filetype_jpg.png"> Related Product </a>
</span>
I've got some custom paths to my images, using a php thumbnail generation script.
How can I reference the products image for related products and get access to all its variables?
So the problem is when I want to reference the product->variables, its referencing the current product detail page i'm on, not the related product.
It's also outputting http://mysite.com/components/com_virtuemart/assets/images/vmgeneral/filetype_jpg.png instead of my product image..
http://forum.virtuemart.net/index.php?topic=100696.0
$this-> refers to the ID thats in the url.
I can't refer to it by using $product->product_name
I can't refer to anything in the default_relatedproducts.php :/
$field->display outputs the related product
How am I supposed to customise <?php echo $field->display ?>
field->display is the HTML
But over it is HTML (link with image) and how and where I can customize it ?
EG:
<a href="#" title="Title"><img src="/images/stories/virtuemart/product/xxx.jpg" alt="xxx"><span class="vm-img-desc">xxx</span> xxx</a>
BanquetTables, how do you customise the output of field->display? Where is that code located, outside of the core in inside?
This controls the fields->display
$field->display = $this->displayType($field->custom_value,$field->field_type,$field->is_list,$field->custom_price,$row,0);
Line 556 of customfields.php.
I don't know why default_relatedproducts.php is not other templating systems. Would it not be much BETTER to have this in a template, like default.php where I can use all product variables..
Can anyone answer, how can I modify how it outputs the related product structure, the curremlt HTML is not good enough.. ?
Any ideas ?
no idea
So people just put up with the output as stock?
lol. :(
Was able to get a reference to the related product using these lines in the foreach loop and then could get data out and use it like a regular template... probably not the best way of doing things though.
$productModel = VmModel::getModel ('product');
$relative = $productModel->getProduct ($field->custom_value);
$imageModel = VmModel::getModel('media');
$images = array();
foreach($relative->virtuemart_media_id as $cur_image) {
$imageModel->_id = $cur_image;
$images[] = $imageModel->getFile();
}