I mentioned that I had created this mod in another post but I think it was imbedded in my Bing Shopping Export mod so I thought I would create this post for it.
Basically I just had to create a new function (was not easy figuring out the db query) and also a new array for Brand. Also, you can see in the below example where I have added UPC.
Note: Where you see “Manufacturer”, this is what you have named the feature so if your feature is named “Brand”, you will need to change it.
/schemas/exim/google.php
[COLOR="Blue"]'brand' => array (
'process_get' => array ('fn_exim_get_feature_variant', '#key', 'Manufacturer'),
'linked' => false
),[/COLOR]
// Please uncomment this code if you want to export ISBN feature to the google
/* 'ISBN' => array (
'process_get' => array ('fn_exim_get_feature', '#key', 'ISBN'),
'linked' => false
),*/
'upc' => array (
'process_get' => array ('fn_exim_get_feature', '#key', 'UPC'),
'linked' => false
),
),
);
// ------------- Utility functions ---------------
//
// This function get the feature value
function fn_exim_get_feature($product_id, $feature_name)
{
$feature = db_get_field("SELECT value FROM ?:product_features_values as a LEFT JOIN ?:product_features_descriptions as b ON a.feature_id = b.feature_id AND b.lang_code = ?s WHERE b.description = ?s AND a.product_id = ?i AND a.lang_code = ?s", CART_LANGUAGE, $feature_name, $product_id, CART_LANGUAGE);
return $feature;
}
[COLOR="Blue"]//
// This function gets the feature variant
function fn_exim_get_feature_variant($product_id, $feature_name)
{
$feature = db_get_field("SELECT variant FROM ?:product_feature_variant_descriptions AS a INNER JOIN cscart_product_features_values AS b ON a.variant_id = b.variant_id INNER JOIN cscart_product_features_descriptions AS c ON b.feature_id = c.feature_id AND b.lang_code= ?s WHERE c.description = ?s AND b.product_id = ?i AND a.lang_code = ?s", CART_LANGUAGE, $feature_name, $product_id, CART_LANGUAGE);
return $feature;
}[/COLOR]