I try to creating a simple image module. To the point, the only problem is data is not saved/not loaded everytime I visit this module back. Here's my code in controller:
Code: Select all
if (isset($this->request->post['photo_image'])) {
$photo_images = $this->request->post['photo_image'];
} elseif (isset($this->request->get['photo_image'])) {
$photo_images = $this->model_module_photo->getProductImages($this->request->get['photo_image']);
//$photo_images = $this->model_catalog_product->getProductImages($this->request->get['photo_image']);
//$photo_images = $this->request->get['photo_image'];
} else {
$photo_images = array();
}
$data['photo_images'] = array();
foreach ($photo_images as $photo_image) {
if (is_file(DIR_IMAGE . $photo_image['image'])) {
$image = $photo_image['image'];
$thumb = $photo_image['image'];
} else {
$image = '';
$thumb = 'no_image.png';
}
$data['photo_images'][] = array(
'image' => $image,
'thumb' => $this->model_tool_image->resize($thumb, 100, 100)
);
}
Someone can help me figured it out? Thanks