diff --git a/plugins/redshop_export/category/category.php b/plugins/redshop_export/category/category.php index cc5919bd003..a6775692360 100644 --- a/plugins/redshop_export/category/category.php +++ b/plugins/redshop_export/category/category.php @@ -204,11 +204,32 @@ protected function processData(&$data) $item = (array)$item; foreach ($item as $column => $value) { - if ($column == 'category_full_image' && $value != "") { - if (JFile::exists(REDSHOP_FRONT_IMAGES_RELPATH . 'category/' . $value)) { - $item[$column] = REDSHOP_FRONT_IMAGES_ABSPATH . 'category/' . $value; + $idCate = $item['id']; + $db = JFactory::getDbo(); + + if ($item['category_full_image'] == "") { + $fullImage = RedshopHelperMedia::getMedia('category',$idCate,'full','images'); + $fullImageName = $fullImage[0]->media_name; + if (is_null($fullImageName)) { + $item['category_full_image'] = ''; } else { - $item[$column] = ""; + if (file_exists(JPATH_SITE . '/media/com_redshop/images/category/' . $idCate .'/'.$fullImageName)) { + $item['category_full_image'] = $fullImageName; + } else { + $item['category_full_image'] = ""; + } + } + } elseif ($item['category_thumb_image'] == "") { + $thumbImage = RedshopHelperMedia::getMedia('category',$idCate,'back','images'); + $thumbImageName = $thumbImage[0]->media_name; + if (is_null($thumbImageName)) { + $item['category_thumb_image'] = ''; + } else { + if (file_exists(JPATH_SITE . '/media/com_redshop/images/category/' . $idCate .'/'.$thumbImageName)) { + $item['category_thumb_image'] = $thumbImageName; + } else { + $item['category_thumb_image'] = ""; + } } } else { $item[$column] = str_replace(array("\n", "\r"), "", $value);