osCmax v2.5 User Manual
Page 1 of 9 123 ... LastLast
Results 1 to 10 of 81
Like Tree1Likes

Google Base New Fields

This is a discussion on Google Base New Fields within the Custom Mods and Hacks forums, part of the osCmax V2.5 Forums category; Anyone know if the new oscmax matches the new Google base requirements for feeds? Google Merchant Center Announcements: We've made ...

      
  1. #1
    Active Member
    Join Date
    Nov 2004
    Location
    California
    Posts
    158
    Rep Power
    25


    Default Google Base New Fields


  2. #2
    Member Luxoria's Avatar
    Join Date
    Sep 2010
    Location
    VA, USA
    Posts
    58
    Rep Power
    26


    1 out of 1 members found this post helpful.

    Default Re: Google Base New Fields

    I took a peek into the v2.5-RC-2 fm-feed-configs/google-simple.php file and it has not been updated to reflect the newer Google feed requirements.

    From what I gather it's missing availability, shipping_weight, and google_product_category. Some missing optional elements include quantity, online_only, color, and additional_image_link.



    For shipping weight I added the following into the google-simple.php file...

    PHP Code:
       'shipping_weight'     =>   array('output' => 'shipping_weight',
                                                                         
    'type' => 'FUNCTION',
                                                                         
    'options' => array('STRIP_HTML''STRIP_CRLF')
                                                                        ), 
    Then add the following to the functions area...
    PHP Code:
    function shipping_weight($product) {
      
      
    //manually add tare weight for now (temp)
      
    return $product['products_weight'] + 1;
      


    Note: I did not take the time to pull the tare weight from the database so I just manually entered in the value of '1'.
    ________________________


    For quantity I use...

    PHP Code:
                                             'quantity'            =>   array('output' => 'google_quantity',
                                                                         
    'type' => 'FUNCTION',
                                                                         
    'options' => array('STRIP_HTML''HTML_ENTITIES''STRIP_CRLF')
                                                                        ), 
    and...

    PHP Code:
    function google_quantity($product) {
      
      return 
    $product['products_quantity'];  
      


    ________________________


    I also added the use of additional_image_link and MOPICS...

    PHP Code:
    'additional_image_link'       =>   array('output' => 'additional_images_link',
                                                                         
    'type' => 'FUNCTION',
                                                                         
    'options' => array('STRIP_HTML''STRIP_CRLF')
                                                                        ), 
    and...

    PHP Code:
    //functions to support MO_PICS in additional_images_link function
    function mopics_file_exists($file_base$file_types DYNAMIC_MOPICS_THUMB_IMAGE_TYPES) {
            
    $file_types str_replace(' '''$file_types);
            
    $file_types preg_split('/[,]/'$file_types);        
            foreach (
    $file_types as $file_type) {
                if (
    file_exists($file_base '.' $file_type)) {
                    return 
    $file_type;            }
            }        
            return 
    false;
        }
        function 
    mopics_match_pattern($pattern) {
            if (
    preg_match('/{.*}/U'$pattern$matches)) {
                return 
    $matches[0];
            }
            return 
    false;    }
        function 
    mopics_getmethod($pattern) {
            return 
    str_replace(array('{''}'), ''mopics_match_pattern($pattern));
        }    
        function 
    mopics_get_imagebase($image$pre_append '') {
            return 
    $pre_append substr($image, ((DYNAMIC_MOPICS_MAINTHUMB_IN_THUMBS_DIR == 'true') ? strlen(DYNAMIC_MOPICS_THUMBS_DIR) : 0), ((DYNAMIC_MOPICS_MAINTHUMB_IN_THUMBS_DIR == 'true') ? (strrpos($image'.') - strlen(DYNAMIC_MOPICS_THUMBS_DIR)) : strrpos($image'.')) );
        }


    function 
    additional_images_link($product) {
        
    $images '';

    ///BEGIN MOPICS

        // Set the thumbnail basename; replaces "imagebase" in the user's pattern
        
    $image_base mopics_get_imagebase($product['products_image'], DIR_WS_IMAGES DYNAMIC_MOPICS_THUMBS_DIR);
        
    // Set the large image's basename; replaces "imagebase" in the user's pattern
        
    $image_base_lg mopics_get_imagebase($product['products_image'], DIR_WS_IMAGES DYNAMIC_MOPICS_BIGIMAGES_DIR);
        
    // Get the counting method for the user's pattern (1,2,3; a,b,c; A,B,C; etc)
        
    $i mopics_getmethod(DYNAMIC_MOPICS_PATTERN);
            
    // Set the search for the str_replace pattern search/replace
        
    $search = array('imagebase'mopics_match_pattern(DYNAMIC_MOPICS_PATTERN));
        
    // Set the initial replace for the str_replace pattern search/replace
        
    $replace = array($image_base$i);
        
    // Are there any extra thumbnails for this product?
        
        
    $loopcount 0;
        
        
    $first_into_flag 0;
        
        
    // Loop until all of this product's thumbnails have been found and displayed
            
    while ($loopcount++ < 100) {        
                
    $image_ext mopics_file_exists(str_replace($search$replaceDYNAMIC_MOPICS_PATTERN));            
                if (
    $image_ext != '') {                
                
    // Set large image replacement for the str_replace pattern search/replace
                
    $replace_lg = array($image_base_lg$i);
                
    // Only link to the popup if a larger image exists            
                
    if ($lg_image_ext mopics_file_exists(str_replace($search$replace_lgDYNAMIC_MOPICS_PATTERN))) {
                    
    // Set the lar3ge image for this loop
                    
    $image_lg str_replace($search$replace_lgDYNAMIC_MOPICS_PATTERN) . '.' $lg_image_ext;                       
                                     
                    if (
    $first_into_flag == 0$images $images tep_href_link($image_lg);  
                    if (
    $first_into_flag == 1$images $images ',' tep_href_link($image_lg);
                    
                    
    $first_into_flag 1;
              
                } 
    //if if large image exists
                
            
    //end if ext                 
                // Increase current count
                
    $i++;
                
    // Update the replace for the str_replace pattern search/replace for next image in the sequence
                
    $replace = array($image_base$i);        
        } 
    //end while                
                
                
        ///END MOPICS        
                
       
    return $images;

    The MOPICS code works and outputs :
    link,link,link,link
    ...however I have yet to verify if Google has properly read the links.


    _________________


    When it comes to availability....

    PHP Code:
     'availability'        =>   array('output' => 'google_availability',
                                                                         
    'type' => 'FUNCTION',
                                                                         
    'options' => array('STRIP_HTML''STRIP_CRLF')
                                                                        ), 
    and...

    PHP Code:
    function google_availability($product) {
      
      if  (
    $product['products_quantity'] > 0) return 'in stock';
      
      return 
    'out of stock';  
     


    __________________


    All my items are online only so I just use...

    PHP Code:
      'online_only'        =>   array('output' => 'yes',
                                                                         
    'type' => 'VALUE'
                                                                        
    ), 

    ______________________


    The tricky part is adding support for google_product_category. If the merchant feed has only products fitting in a certain category then the code is simple, like...

    PHP Code:
      'google_product_category'        =>   array('output' => 'Home & Garden > Lighting > Night Lights',
                                                                         
    'type' => 'VALUE'
                                                                        
    ), 
    However, if the store stocks items spread across multiple categories it will be possibly necessary to add the google_product_category information into the database when adding the product to the database (at the new product screen in admin). This mod requires core modification.

    Hope this helps... you may look at my feed file if you wish, but it's geared specifically for my store, database, and coding style. Also note, the functions really need to have generic names, ie remove 'google', then have them placed into the proper location of the file 'feedmachine_loadingbay.php' so they can be used by other feed configs such as bing and thefind.

    -R
    Attached Files Attached Files
    My live osCmax store: Lighted Wall Art

  3. #3
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,013
    Rep Power
    36


    Thumbs up Re: Google Base New Fields

    Very good grounding for an updated google feed.
    Thanks for sharing.
    Hosting plans with installation, configuration, contributions, support and maintenance.

  4. #4
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,659
    Rep Power
    49


    Default Re: Google Base New Fields

    Can someone link this into the bugtracker to be updated?

    Thanks,
    pgmarshall
    _______________________________

  5. #5
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,013
    Rep Power
    36


    Default Re: Google Base New Fields

    BTW, clever template design, Lux., I thought my eyes were going screwy for a minute.
    Hosting plans with installation, configuration, contributions, support and maintenance.

  6. #6
    Member Luxoria's Avatar
    Join Date
    Sep 2010
    Location
    VA, USA
    Posts
    58
    Rep Power
    26


    Default Re: Google Base New Fields

    Lol, thanks. I invested great effort and time into aligning my template with my products. =)

    Oh, pgm, IDK how to link this into the bug tracker, unless you mean just make a report.
    My live osCmax store: Lighted Wall Art

  7. #7
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,659
    Rep Power
    49


    Default Re: Google Base New Fields

    Just report it as a bug and post the URL into the notes - so I can link back to this thread and add your excellent work to the core.

    Thanks for contributing Lux.

    Regards,
    pgmarshall
    _______________________________

  8. #8
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,013
    Rep Power
    36


    Lightbulb Re: Google Base New Fields

    I suggest, in the first instance, we call Luxoria's modified file google-rc2a.php and use it as a basis for the 'production' one. This way the original is untouched and, for example, the
    Code:
    function shipping_weight($product)
    can be looked at.
    Hosting plans with installation, configuration, contributions, support and maintenance.

  9. #9
    New Member
    Join Date
    Jun 2011
    Posts
    18
    Rep Power
    0


    Default Re: Google Base New Fields

    So, will there be an updated generic file that can be used?

  10. #10
    Active Member
    Join Date
    Apr 2007
    Posts
    207
    Rep Power
    6


    Default Re: Google Base New Fields

    any update on when this will be done, getting close to googles dead line.

Page 1 of 9 123 ... LastLast

Similar Threads

  1. Google base feeds
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 06-25-2009, 01:00 AM
  2. Google base feeds
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 02-12-2009, 06:11 AM
  3. Google base feeds
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 02-10-2009, 10:10 AM
  4. Google base feeds
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 02-08-2009, 08:00 AM
  5. Best way to upload to Google Base?
    By markw10 in forum osCMax v2 Features Discussion
    Replies: 1
    Last Post: 06-13-2008, 09:22 AM

Bookmarks

Posting Permissions

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