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

problem to get child product image [SOLVED]

Started by eag, December 12, 2013, 04:09:35 AM

Previous topic - Next topic

eag

Hi, this is the scenario.


  • 1 parent product, named "parent product"
  • 3 childs products, named "child 1", "child 2" and "child 3".
all childs products with image, parent product no image.

I modify my override template, my-template/html/com_virtuemart/productdetails/default.php
To get the child product list, and build my custom HTML with child product image, add this code:
$model = new VirtueMartModelProduct();
$test = $model->getProductChildIds($this->product->product_parent_id);
$test2 = $model->getProducts($test);
var_dump($test2);


I load product detail page, to a "child 1", and in var_dump I can see only file_url and file_url_thumb in "child 1" data, in "child 2" doen's appear.
If I load product detail page, "child 2", in var_dump, only appears file_url and file_url_thumb in "child 2" data.
If I load product detail page, "child 3", in var_dump, only appears file_url and file_url_thumb in "child 3" data.

I tried others functions like this, but not solve the problem:
$model = new VirtueMartModelProduct();
$test = $model->getProductChildIds($this->product->product_parent_id);
    foreach($test as $testproduct){
          $test2 = $model->getProduct($testproduct, false);
          var_dump($test2);
    }


is a bug? any idea to solve it?


Enviroment
Joomla 2.5.15
Virtuemart 2.0.24c

Milbo

You missed to add the medias to your products

$productModel->addImages($products,1);
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

eag

Thanks Milbo,

this solve the problem.

Is there any place to find this documentation?

Thanks again