Hi again all,
I've managed to fix the _LRG & _MED image links in the feed (not that i'm sure anyone else has even noticed this issue).
In includes/classes/google_base.php find the function: google_base_image_url around line 505:
Code:
// creates the url for the products_image
function google_base_image_url($products_image) {
if($products_image == "") return "";
if (defined('GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL') && GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL != '') {
if (strpos(GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL, HTTP_SERVER . '/' . DIR_WS_IMAGES) !== false) {
$products_image = substr(GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL, strlen(HTTP_SERVER . '/' . DIR_WS_IMAGES)) . $products_image;
} else {
return GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL . rawurlencode($products_image);
}
}
$products_image_extention = "/".substr($products_image, strrpos($products_image, '.'))."/";
$products_image_base = preg_replace($products_image_extention, '', $products_image);
$products_image_medium = $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extention;
$products_image_large = $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extention;
// check for a large image else use medium else use small
if (!file_exists(DIR_WS_IMAGES . 'large/' . $products_image_large)) {
if (!file_exists(DIR_WS_IMAGES . 'medium/' . $products_image_medium)) {
$products_image_large = DIR_WS_IMAGES . $products_image;
} else {
$products_image_large = DIR_WS_IMAGES . 'medium/' . $products_image_medium;
}
} else {
$products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_large;
}
if ((function_exists('handle_image')) && (GOOGLE_PRODUCTS_IMAGE_HANDLER == 'true')) {
$image_ih = handle_image($products_image_large, '', LARGE_IMAGE_MAX_WIDTH, LARGE_IMAGE_MAX_HEIGHT, '');
$retval = (HTTP_SERVER . DIR_WS_CATALOG . $image_ih[0]);
} else {
$retval = (HTTP_SERVER . DIR_WS_CATALOG . rawurlencode($products_image_large));
}
return str_replace('%2F', '/', $retval);
}
I've changed this to:
Code:
// creates the url for the products_image
function google_base_image_url($products_image) {
if($products_image == "") return "";
if (defined('GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL') && GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL != '') {
if (strpos(GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL, HTTP_SERVER . '/' . DIR_WS_IMAGES) !== false) {
$products_image = substr(GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL, strlen(HTTP_SERVER . '/' . DIR_WS_IMAGES)) . $products_image;
} else {
return GOOGLE_PRODUCTS_ALTERNATE_IMAGE_URL . rawurlencode($products_image);
}
}
$products_image_extention = substr($products_image, strrpos($products_image, '.'));
$products_image_base = preg_replace("/" . $products_image_extention . "/", '', $products_image);
$products_image_medium = $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extention;
$products_image_large = $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extention;
// check for a large image else use medium else use small
if (!file_exists(DIR_WS_IMAGES . 'large/' . $products_image_large)) {
if (!file_exists(DIR_WS_IMAGES . 'medium/' . $products_image_medium)) {
$products_image_large = DIR_WS_IMAGES . $products_image;
} else {
$products_image_large = DIR_WS_IMAGES . 'medium/' . $products_image_medium;
}
} else {
$products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_large;
}
if ((function_exists('handle_image')) && (GOOGLE_PRODUCTS_IMAGE_HANDLER == 'true')) {
$image_ih = handle_image($products_image_large, '', LARGE_IMAGE_MAX_WIDTH, LARGE_IMAGE_MAX_HEIGHT, '');
$retval = (HTTPS_SERVER . DIR_WS_CATALOG . $image_ih[0]);
} else {
$retval = (HTTPS_SERVER . DIR_WS_CATALOG . rawurlencode($products_image_large));
}
$retval = str_replace('%2F', '/', $retval);
$retval = str_replace('%28', '(', $retval);
return str_replace('%29', ')', $retval);
}
With regards to the first change, I noticed it was added slashes before and after the file extension, which was being reused later on and then when used with file_exists, always returned false.
The second change is an optional one. I have some image names which contain brackets (), these were being converted to %28 and %29, which caused an issue with the file in my browser, so I've just reverted these back to brackets.
Oh and if you want to have the images link to https:// rather than http:// (like I do as my store is fully SSL enabled using HSTS), then you should amend ADMIN/includes/boxes/extra_boxes/googfroogle_tools_dhtml.php from
Code:
$za_contents[] = array('text' => BOX_GOOGLEFROOGLE, 'link' => zen_href_link(FILENAME_GOOGLEFROOGLE, '', 'NONSSL'));
to
Code:
$za_contents[] = array('text' => BOX_GOOGLEFROOGLE, 'link' => zen_href_link(FILENAME_GOOGLEFROOGLE, '', 'SSL'));
One extra thing I noticed was that the Tools >Google Merchant Center Feeder admin page layout was screwed up with the description on the right hand side and off the screen. I fixed this by altering the css and position of the divs:
ADMIN/googlefroogle.php lines 141 -> 144 remove the lines in red
Code:
#contentwrapper{float:left;width:100%;}
#columnLeft{margin-right:250px;}
.container{margin:0 10px 10px;}
#columnRight{float:left;margin-left:-250px;width:250px;}
lines 154 -> 158 add the lines in green
Code:
<div id="columnLeft">
<div class="container">
<h1><?php echo HEADING_TITLE; ?></h1>
<br>
<div><img src="images/googlebase.gif" width="230" height="30"></div>
<div class="smallText"><?php echo TEXT_GOOGLE_PRODUCTS_LOGIN_HEAD; ?></div>
<div class="smallText"><?php echo TEXT_GOOGLE_PRODUCTS_LOGIN; ?></div>
<br><br>
<form method="get" action="<?php echo HTTP_SERVER . DIR_WS_CATALOG . FILENAME_GOOGLEFROOGLE . ".php"; ?>" name="google" target="googlefeed" onsubmit="window.open('', 'googlefeed', 'resizable=1, statusbar=5, width=600, height=400, top=0, left=50, scrollbars=yes');setTimeout('location.reload(true);', 5000);">
<label for="feed">Feed Type:</label>
And finally lines 208 -> 216 remove the lines in red:
Code:
</div>
<div id="columnRight">
<div class="container">
<div><img src="images/googlebase.gif" width="230" height="30"></div>
<div class="smallText"><?php echo TEXT_GOOGLE_PRODUCTS_LOGIN_HEAD; ?></div>
<div class="smallText"><?php echo TEXT_GOOGLE_PRODUCTS_LOGIN; ?></div>
</div>
</div>
<!-- body_eof //-->
I hope this helps some of you!!
Bookmarks