Trying to sort this out in a display I am working on for hikashop in joomla. when a product has variants, it automatically inherits the parent images for each variant. so what i need to do is merge the images array into one, but only if they are duplicate images. when i print out the array, it looks like this, but is duplicated for each $variant and my diplay that i have coded will show each image:
Array
(
[0] => stdClass Object
(
[file_id] => 623
[file_name] =>
[file_description] =>
[file_path] => zinklogohoodie_black_greystitch.png
[file_type] => product
[file_ref_id] => 495
[file_free_download] => 0
[file_ordering] => 0
[file_limit] => 0
)
)
my code is this so far:
if(!empty($this->element->variants)):
echo "this product has variants";
foreach($this->element->variants as $variant):
print("<pre>".print_r($variant->images,true)."</pre>");
endforeach;
elseif(empty($this->element->variants)):
echo "this product has no variants";
endif;
how do i test for and then merge all instances of duplicate $variant->images
as well as the non duplicates into a single array?