Google Base Not Showing Images

Help, I need a code fix, my google base export is not showing the images of the products.

[quote name=‘bigjmart’]Help, I need a code fix, my google base export is not showing the images of the products.[/QUOTE]


function fn_exim_get_image_url($product_id, $object_type, $pair_type, $get_icon, $get_detailed, $lang_code)
{
$get_flash = false;

$image_pair = fn_get_image_pairs($product_id, $object_type, $pair_type, $get_icon, $get_detailed, $lang_code);

if (isset($image_pair['icon']['absolute_path']) && is_file($image_pair['icon']['absolute_path'])) {
if (!$get_flash && isset($image_pair['icon']['is_flash']) && $image_pair['icon']['is_flash']) {
return false;
} else {
return 'http://' . Registry::get('config.http_host') . $image_pair['icon']['http_image_path'];
}
}

if (!empty($image_pair['image_id'])) {
$image = fn_get_image($image_pair['image_id'], $object_type, 0, $lang_code);

if (isset($image['absolute_path']) && is_file($image['absolute_path'])) {
if (!$get_flash && isset($image['is_flash']) && $image['is_flash']) {
return false;
}

return 'http://' . Registry::get('config.http_host') . $image['http_image_path'];
}
}

if (!empty($image_pair['detailed_id'])) {
$image = fn_get_image($image_pair['detailed_id'], 'detailed', 0, $lang_code);

if (isset($image['absolute_path']) && is_file($image['absolute_path'])) {
if (isset($image['is_flash']) && $image['is_flash']) {
if ($get_flash) {
// No need to call fn_generate_thumbnail()
return 'http://' . Registry::get('config.http_host') . $image['http_image_path'];
} else {
return false;
}
}

$image = fn_generate_thumbnail($image['image_path'], Registry::get('settings.Thumbnails.product_details_thumbnail_width'), Registry::get('settings.Thumbnails.product_details_thumbnail_height'), false);
if (!empty($image)) {
return 'http://' . Registry::get('config.http_host') . $image;
}
}
}

return false;
}




Can someone tell me what lines to insert this in in the controlers/admin.exim.php file???

[quote name=‘bigjmart’]Help, I need a code fix, my google base export is not showing the images of the products.[/QUOTE]



Hello, bigjmart



In order to fix this bug try to replace the following part of code:



function fn_export_image($image_id, $object, $backup_path = '')
{
$images_path = (!empty($backup_path) ? fn_strip_slashes($backup_path) : (DIR_IMAGES . 'images_backup')) . '/' . $object . '/';

// if backup dir does not exist then try to create it
if (!is_dir($images_path)) {
fn_mkdir($images_path);
}

$image_data = db_get_row("SELECT image_id, image_path FROM ?:images WHERE image_id = ?i", $image_id);
if (empty($image_data)) {
return '';
}

$alt_data = db_get_hash_single_array("SELECT lang_code, description FROM ?:common_descriptions WHERE ?:common_descriptions.object_id = ?i AND ?:common_descriptions.object_holder = 'images'", array('lang_code', 'description'), $image_id);
$alt_text = '{';
if (!empty($alt_data)) {
foreach ($alt_data as $lang_code => $text) {
$alt_text .= '[' . $lang_code . ']:' . $text . ';';
}
}
$alt_text .= '}';

$path = $images_path . basename($image_data['image_path']);
$orig_path = DIR_IMAGES . $object . '/' . floor($image_id / MAX_FILES_IN_DIR) . '/' . $image_data['image_path'];

if (is_file($orig_path)) {
fn_copy($orig_path, $path);
}

return $path . (!empty($alt_data) ? '#' . $alt_text : '');
}




with this one:



function fn_export_image($image_id, $object, $backup_path = '')
{
$images_path = (!empty($backup_path) ? fn_strip_slashes($backup_path) : (DIR_IMAGES . 'images_backup')) . '/' . $object . '/';

// if backup dir does not exist then try to create it
if (!is_dir($images_path)) {
fn_mkdir($images_path);
}

$image_data = db_get_row("SELECT image_id, image_path FROM ?:images WHERE image_id = ?i", $image_id);
if (empty($image_data)) {
return '';
}

$alt_data = serialize (db_get_hash_single_array("SELECT lang_code, description FROM ?:common_descriptions WHERE ?:common_descriptions.object_id = ?i AND ?:common_descriptions.object_holder = 'images'", array('lang_code', 'description'), $image_id));
$alt_text = '{';
if (!empty($alt_data)) {
foreach ($alt_data as $lang_code => $text) {
$alt_text .= '[' . $lang_code . ']:' . $text . ';';
}
}
$alt_text .= '}';

$path = $images_path . basename($image_data['image_path']);
$orig_path = DIR_IMAGES . $object . '/' . floor($image_id / MAX_FILES_IN_DIR) . '/' . $image_data['image_path'];

if (is_file($orig_path)) {
fn_copy($orig_path, $path);
}

return $path . (!empty($alt_data) ? '#' . $alt_text : '');
}




in the “exim.php” file, located in the “controllers/admin” directory.



Thank you.

CS Cart Support: This code does not want to work. Please help… any other fix?

CS Cart: This does not work!!! Please provide me with another fix to this bug.

[quote name=‘bigjmart’]CS Cart: This does not work!!! Please provide me with another fix to this bug.[/QUOTE]



Hello, bigjmart



The problem requires the investigation on your server. Please contact us via Customer Help Desk and provide us with a temporary access to your server.



Thank you.

is this being done for free or charge??? After all, it is a bug on the software.

[quote name=‘bigjmart’]is this being done for free or charge??? After all, it is a bug on the software.[/QUOTE]



Thank you for your reply.

It was a bug in your version. But I provided you with the fix. As you said it did not work for you.



So we need to investigate it on your server. If it is caused by the CS-Cart system bug it will be free.



Thank you.