shopp_googlebase_spec_map

filters the associative array of SpecNames => Google Base element suffixes to use for automatically mapping product specs to Google Base feed elements.

add_filter( 'shopp_googlebase_spec_map', [callback] )

@param array $map the associative array of SpecNames => Google Base element suffixes to use for automatically mapping product specs to Google Base feed elements.

Description

filters the associative array of SpecNames => Google Base element suffixes to use for automatically mapping product specs to Google Base feed elements.

If you create a spec in the Product Editor that has a name that exactly matches one of the keys in the spec map, a corresponding Google Base name-spaced (g:) element will appear in the feed, with the value of that spec.

Examples of default mappings:

  • MPN – maps to mpn element
  • Color – maps to color element
  • Material – maps to material element
  • Pattern – maps to pattern element
  • Size – maps to size element
  • Gender – maps to gender element
  • Age Group – maps to age_group element
  • Google Product Category – maps to google_product_category element
  • UPC – maps to gtin element
  • EAN – maps to gtin element
  • JAN – maps to gtin element
  • ISBN-13 – maps to gtin element
  • ISBN-10 – maps to gtin element
  • ISBN – maps to gtin element
  • Brand – maps to brand element

Say you have a spec called ISBN on your WordPress for Dummies book product, with the value 0470592745. The g: namespace is automatically added to the mapped gtin element, to produce markup like the following in your rss/Google Base feed:
<g:gtin>0470592745</g:gtin>

Example

// register filter callback
add_filter('shopp_googlebase_spec_map', 'shopp_googlebase_spec_map_fltr');

// create filter function
function shopp_googlebase_spec_map_fltr( $map ) {
    // provide an alternative image url by ImageURL spec
    $map['ImageURL'] = 'image_link';

    // provide an alternative gtin by GTIN spec
    $map['GTIN'] = 'gtin'; 
    return $map;
}

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar