Page 1 of 2 12 LastLast
Results 1 to 10 of 505

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,824
    Plugin Contributions
    31

    Default Bug: Additional Images, 404 errors images googlebot

    In 1.13.0 a call was added to a function to add additional images into the feed.

    After quite some time seeing 404 errors in my server logs while googlebot was looking for images in the images root instead of subdirectories, I eventually find the problem here.

    So, for those of you with additional images (most people I imagine) have a look at your feed to see if the image path is correct for additional images. It should be already correct for the base image.

    If you find the additional images link to be pointing to /images/myimage01.jpg instead of /images/mysubdirectory/myimage_01.jpg (deliberate underscore: http://www.zen-cart.com/content.php?100), here is my fix.

    Rather than just fix what was broke, I took at look at the whole function and tried to improve it, and add comments for the terminally curious like me.

    So, in /classes/google_base.php at the start of the file, replace the entire function:
    PHP Code:
    function additional_images($products_image) {
          if (
    $products_image != '') {
            
    $images_array = array();
            
    // prepare image name
            
    $products_image_extension substr($products_imagestrrpos($products_image'.'));
            
    $products_image_base str_replace($products_image_extension''$products_image);

            
    // if in a subdirectory
            
    if (strrpos($products_image'/')) {
              
    $products_image_match substr($products_imagestrrpos($products_image'/')+1);
              
    $products_image_match str_replace($products_image_extension''$products_image_match) . '_';
              
    $products_image_base $products_image_match;
            }

            
    $products_image_directory str_replace($products_image''substr($products_imagestrrpos($products_image'/')));
            if (
    $products_image_directory != '') {
              
    $products_image_directory DIR_WS_IMAGES str_replace($products_image_directory''$products_image) . "/";
            } else {
              
    $products_image_directory DIR_WS_IMAGES;
            }

            
    // Check for additional matching images
            
    $file_extension $products_image_extension;
            
    $products_image_match_array = array();
            if (
    $dir = @dir($products_image_directory)) {
              while (
    $file $dir->read()) {
                if (!
    is_dir($products_image_directory $file)) {
                  if (
    substr($filestrrpos($file'.')) == $file_extension) {
                    if(
    preg_match("/" $products_image_base "/i"$file) == 1) {
                      if (
    $file != $products_image) {
                        if (
    $products_image_base str_replace($products_image_base''$file) == $file) {
                          
    $images_array[] = $this->google_base_image_url($file);
                          if (
    count($images_array) >= 8) break;
                        } else {
                          
    //  no match
                        
    }
                      }
                    }
                  }
                }
              }
              
    $dir->close();
            }
            return 
    $images_array;
          } else {
            
    // default
            
    return false;
          }
        } 
    with this
    PHP Code:
        function additional_images($products_image) {//eg. image_subdirectory/myimage.jpg
          
    if ($products_image != '') {
            
    $images_array = array();
            
    // prepare image name
            
    $products_image_extension substr($products_imagestrrpos($products_image'.'));//get the extension
            
    $products_image_base str_replace($products_image_extension''$products_image);//strip extension to get the (optional path and) base filename
            
    $products_image_directory str_replace(substr($products_imagestrrpos($products_image'/')), '',$products_image);//get the subdirectory path
            
             
    if (strrpos($products_image_base'/')) {//is the image in a subdirectory?
                 
    $products_image_base substr($products_image_basestrrpos($products_image'/')+1).'_';//strip the path and add the underscore: see http://www.zen-cart.com/content.php?100
                 
    $products_image_directory $products_image_directory.'/';
            }

            
    $products_image_match_array = array();
            if (
    $dir = @dir(DIR_WS_IMAGES $products_image_directory)) {
              while (
    $file $dir->read()) {
              if (!
    is_dir(DIR_WS_IMAGES $products_image_directory $file)) {
                if (
    $file != $products_image) {//ignore the primary image
                 
    if (preg_match("/" $products_image_base "/i"$file) == 1) {//does this filename contain the image base filename?
                  
    if ($products_image_base str_replace($products_image_base''$file) == $file) {//does this filename start with image base_?
                    
    if (substr($filestrrpos($file'.')) == $products_image_extension) {//does it have the same extension as the image base? 
                        
    $file $products_image_directory.$file;//add subdirectory path to filename for subsequent function call
                        
    if (GOOGLE_PRODUCTS_DEBUG == 'true') {echo 'google_base 36:additional image found $file='.$file.'<br />';}//debug
                        
    $images_array[] = $this->google_base_image_url($file);//this function needs image_subdirectory/myimage.jpg
                          
    if (count($images_array) >= 8) break;//only 10 images allowed by Google
                        
    } else {
                          
    //  no match
                        
    }
                      }
                    }
                  }
                }
              }
              
    $dir->close();
            }
            return 
    $images_array;
          } else {
            
    // default
            
    return false;
          }
        } 
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

  2. #2
    Join Date
    Jan 2012
    Location
    New England
    Posts
    238
    Plugin Contributions
    0

    Default Re: Bug: Additional Images, 404 errors images googlebot

    When I manually go in and create the file it is there, then I can download it and manually upload it to Google, but the part where it sends it to Google like it did when I first installed it seems to not work now... when I created the new feed it didn't show up in the list--only the first one I ever did is in the list--and my cron job seems to not be working either... if someone is willing to help me I'll post details (tell me what details you need)

  3. #3
    Join Date
    Jul 2007
    Posts
    2,169
    Plugin Contributions
    16

    Default Re: Bug: Additional Images, 404 errors images googlebot

    Deleted............
    Is your site Upgraded to the current version 1.5.4 Yet?
    zencart-upgrades-website-installation

  4. #4
    Join Date
    Jul 2006
    Posts
    308
    Plugin Contributions
    0

    Default Re: Bug: Additional Images, 404 errors images googlebot

    Are there any plans to exclude a list of products by product id from being put into the feed?

    Since Google Merchant Center is now a paid service through Adwords, with only a limited number o free clicks, it's now important to monitor and remove poor performing products from the feed.

  5. #5
    Join Date
    Jun 2012
    Posts
    94
    Plugin Contributions
    0

    Default Re: Bug: Additional Images, 404 errors images googlebot

    Hello, I am using Zen 1.5.0 and when I enable the UPC/ISBN/EAN in the configuration to TRUE and try to "confirm" I get this error: (

    Google Merchant Center Feeder v started 2013/02/18 16:42:36
    Feed file - /home8/wwrepair/public_html/parts/feed/google/wwrepair_products_en.xml
    Processing: Feed - Yes, Upload - No
    WARNING: An Error occurred, please refresh the page and try again


    If I change the UPC/ISBN/EAN back to false, it will upload only some of my products. I do use the UPC field but not ISBN (Numinix Product Fields Module). The last upload had 3017 and after trying to get the UPC to work it only uploads 1645 (again I have to disable the UPC filed in admin or I get an error). Any help is greatly appreciated. Thank you!

    I checked my debug log and this is what is says:
    [18-Feb-2013 17:12:59] PHP Warning: fopen(/home8/wwrepair/public_html/parts/module_version/google_merchant_center_feeder.txt) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /home8/wwrepair/public_html/parts/includes/classes/google_base.php on line 81
    [18-Feb-2013 17:12:59] PHP Warning: filesize() [<a href='function.filesize'>function.filesize</a>]: stat failed for /home8/wwrepair/public_html/parts/module_version/google_merchant_center_feeder.txt in /home8/wwrepair/public_html/parts/includes/classes/google_base.php on line 82
    [18-Feb-2013 17:12:59] PHP Warning: fread(): supplied argument is not a valid stream resource in /home8/wwrepair/public_html/parts/includes/classes/google_base.php on line 82
    [18-Feb-2013 17:12:59] PHP Warning: fclose(): supplied argument is not a valid stream resource in /home8/wwrepair/public_html/parts/includes/classes/google_base.php on line 83
    [18-Feb-2013 17:12:59] PHP Fatal error: 1054:Unknown column 'p.products_ean' in 'field list' :: SELECT distinct(pd.products_name), p.products_id, p.products_model, pd.products_description, p.products_image, p.products_tax_class_id, p.products_price_sorter, p.products_priced_by_attribute, p.products_type, GREATEST(p.products_date_added, IFNULL(p.products_last_modified, 0), IFNULL(p.products_date_available, 0)) AS base_date, p.products_date_available, m.manufacturers_name, p.products_quantity, pt.type_handler, p.products_weight, p.products_upc, p.products_isbn, p.products_ean
    FROM znc_products p
    LEFT JOIN znc_manufacturers m ON (p.manufacturers_id = m.manufacturers_id)
    LEFT JOIN znc_products_description pd ON (p.products_id = pd.products_id)
    LEFT JOIN znc_product_types pt ON (p.products_type=pt.type_id)WHERE p.products_status = 1
    AND p.products_type <> 3
    AND p.product_is_call <> 1
    AND p.product_is_free <> 1
    AND pd.language_id = 1
    AND (
    p.products_image IS NOT NULL
    OR p.products_image != ''
    OR p.products_image != 'no_picture.gif'
    )
    GROUP BY pd.products_name
    ORDER BY p.products_id ASC; in /home8/wwrepair/public_html/parts/includes/classes/db/mysql/query_factory.php on line 101

  6. #6
    Join Date
    Jul 2006
    Posts
    308
    Plugin Contributions
    0

    Default Re: Bug: Additional Images, 404 errors images googlebot

    Quote Originally Posted by fakeDecoy View Post
    Are there any plans to exclude a list of products by product id from being put into the feed?

    Since Google Merchant Center is now a paid service through Adwords, with only a limited number o free clicks, it's now important to monitor and remove poor performing products from the feed.
    I'm guessing no replies means that's a no? Just making sure before I try to go coding it myself.

  7. #7
    Join Date
    Feb 2006
    Location
    NM
    Posts
    750
    Plugin Contributions
    1

    Default Re: Bug: Additional Images, 404 errors images googlebot

    this all seems to be working except that google will only import 139 products out of my feeds. My feed has over 1,000 products. Is anyone else having that issue?

  8. #8
    Join Date
    Feb 2006
    Location
    NM
    Posts
    750
    Plugin Contributions
    1

    Default Re: Bug: Additional Images, 404 errors images googlebot

    problem solved...those darn special characters......items stopped loading when they started showing up in the list.....all loaded...boy, that was easy! Love this mod. We've been using an ancient version all these years in order to eliminate certain categories item by item, editing in excel. The option to by pass by category id is wonderful. At first I did not notice the extra menu options under Admin > Configuration....what a wonderful mod.

  9. #9
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Bug: Additional Images, 404 errors images googlebot

    Quote Originally Posted by fakeDecoy View Post
    I'm guessing no replies means that's a no? Just making sure before I try to go coding it myself.
    No replies means no one answered tis all.. perhaps because they don't know or noone has had time to answer...

    to answer your question I believe this mod already lets you include/exclude products.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  10. #10
    Join Date
    Feb 2006
    Location
    NM
    Posts
    750
    Plugin Contributions
    1

    Default Re: Bug: Additional Images, 404 errors images googlebot

    Quote Originally Posted by fakeDecoy View Post
    I'm guessing no replies means that's a no? Just making sure before I try to go coding it myself.
    At first i missed the options under Admin > Configuration and there you can exclude by Manufacturer and by Category ID. Perhaps you are referring to where I don't see either where you can exclude by Product ID but I would move those products into a category that you can exclude. Excluding by individual Product id could prove to be a maintenance nightmare....which is probably why the mod developer did not go there.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Google merchant Centre Feeder query
    By Phil Lomas in forum General Questions
    Replies: 13
    Last Post: 24 Dec 2013, 03:37 AM
  2. Google Base Feeder Support Thread [OLD]
    By numinix in forum All Other Contributions/Addons
    Replies: 3562
    Last Post: 2 Apr 2012, 06:30 PM
  3. Removing products from Google Merchant Feeder
    By wonderbread101 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 24 Dec 2011, 05:31 PM
  4. Google Merchant Center for Dummies?
    By xcergy in forum General Questions
    Replies: 7
    Last Post: 31 Mar 2010, 06:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg