I'm trying to figure out the best way to code this. It's a new google base feed for Ubercart and I need to list all taxonomy terms related to the product node then grab my taxonomy term "manufacturer" from the list and list it under google xml "brand" attribute.

I first grab all the taxonomy terms

//-> Grab taxonomy terms for products
$terms = array();
foreach ($product->taxonomy as $term) {
$ancestors = taxonomy_get_parents_all($term->tid);
foreach ($ancestors as $ancestor) {
$terms[] = $ancestor->name;
}
}

raw output

DanelectroMini AmpsAmplifiers

I then use the implode function to comma separate each term

//->Product Type    
$output .= "<g:product_type>" . check_plain(implode(',', $terms)) . "</g:product_type>\n";

with commas

Danelectro,Mini Amps,Amplifiers

Now this is the part I'm trying to figure out? What's the best way to do this?

I need to somehow match the manufacturer to the product which in this case is "Danelectro" and list it with the
google xml brand attribute.

//->Brand Name
$output .= "<g:brand></g:brand>\n";

Any help would be appreciated.

Comments

alien73’s picture

Never mind.... used views instead with the custom views addon.
Ubercart Google base XML feed now works like a charm.

NecroHill’s picture

what the views addon have you used?