[eluser]vitoco[/eluser]
I think that if you use product_id (int) as name for the images, you can put it as index in the images array and then call it inside the products foreach
Code:
// product_id = 100001 => image => 100001.png/gif/jpeg
In get_images() function =============================
Code:
foreach ($files as $file) {
// GET product_id FROM $file ( only digits )
$product_id = preg_replace("/[^0-9]/", "", $file );
// MAKE THE INDEX EXPLICIT
$images [ $product_id ]= array (
'url' => $this->gallery_path_url . $file,
'thumb_url' => $this->gallery_path_url . 'thumbs/' . $file
);
}
In products foreach =============================
Code:
<?
// ASSUMING THAT $product->product_id have the product_id
?>
<?php foreach($products as $product): ?>
<?php echo 'Product Name' ?> :
<?php echo $product->name; ?><br>
<?php echo 'Product Price' ?> :
<?php echo $product->price; ?><br>
COLOR :<?php echo $product->option_color; ?><br>
SIZE :<?php echo $product->option_size; ?><br>
IMG: <img src="<?php echo $images[ $product->product_id ]['url'] ?>"/><br>
THUMB: <img src="<?php echo $images[ $product->product_id ]['thumb_url'] ?>"/><br>
<?php endforeach; ?>
Saludos