So you’re running a Shopp, you’re going to need a Google Base Feed to stand a chance of attracting traffic.
I got upset at the amount of hacking required to make the Google Base feed (/shop/feed) work correctly.
Google constantly change the requirements for the products feed and it doesn’t seem possible to nicely modify the built in RSS feed for Google.
So here’s how I did mine. It is a little ugly, but it most importantly it works.
- Create a new page called Google Base Feed.
- Create a new page template in your current theme directory, I called mine template-google-base-feed.php
Here’s the code for that page template
<?php /* Template Name: Google Base Feed */ ?> <?php $googleBaseContent = "id product_url name description image_url price currency condition product_type\r\n"; shopp('catalog','catalog-products','show=100000000&load=false&order=newest'); if (shopp('category','hasproducts','')): while(shopp('category','products')): $googleBaseContent .= shopp('product','id','return=true')."\t". shopp('product','link','return=true')."\t". shopp('product','name','return=true')."\t". shopp('product','summary','return=true')."\t". shopp('product','coverimage','property=url&return=true')."\t". shopp('product','price','return=true')."\tGBP\tNew\tCategory\r\n"; endwhile; endif; ?> <?php trim($googleBaseContent); $filename = "GoogleBaseFeed_"; $contentLength = strlen($googleBaseContent); $content = $googleBaseContent; $filename .= date("dMy").".txt"; header('Pragma: private'); header('Cache-control: private, must-revalidate'); header("Content-Disposition: attachment; filename=".$filename); header("Content-type: text/plain"); header("Content-type: application/octet-stream"); header("Content-length: ".$contentLength); header("Content-Transfer-Encoding: binary"); echo $content; ?>
- Assign the new page template to the new page you created.
- Add your feed to Google with the path to your new page, probably /google-base-feed/
Sub note, my particular feed now needs a “Manufacturer”, so I can easily add this in the code above. Take a note of the last line where I have currently hardcoded Category, Currency and Condition.
PS, I’m not 100% sure on the “show=100000000” parameter, the function is limited to 1000, but I am not sure if it is over writeable.