In a follow up to our popular blog post describing the process of getting AMTU 1 set up on a Centos server, this post describes how to get the latest version 2 of AMTU running.
Things have moved on and thankfully it is a lot easier than it was.
Firstly get Sun Java installed. You will need to get the URL for downloading the RPM from here:
http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1637588.html
Accept the agreement, download the correct RPM version and then pause it. Copy the download URL and paste it into this command:
cd /tmp
wget [paste-url]-here]
rpm - jre [hit tab to complete]
Now check the correct java version is being used:
java -version
You should get something looking like:
[root@94 tmp]# java -version
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
Now you can install AMTU
wget https://d28hcfptedr5ia.cloudfront.net/install/AMTU_unix.sh
chmod +x AMTU_unix.sh
./AMTU_unix.sh
Keep hitting enter to get to the bottom of the terms and then agree, agree to all the other options. That is AMTU installed.
The final step is to configure this using the CLI configure utitlity.
You need to create an xml file for the AMTU configuration. You can see a sample file in /opt/amtu/xml/sample.xml.
Lets copy that file and then edit it accordingly.
cd /opt/amtu/xml
cp sample.xml configuration.xml
vim configuration.xml
You do need to be signed up for MWS to get some of the keys etc that are required. If not already, go to this page and hit the sign up button.
https://developer.amazonservices.co.uk/index.html
Once you have updated the XML configuration you run this command to apply it:
/opt/amtu/Utilities/configure SETUP /opt/amtu/xml/configuration.xml
If you get some error messages at this point, edit the configuration and try again. Once you have the configuration set you can start the daemon.
/opt/AMTU/Utilities/amtu_daemon start
If you want to serve up text files for download (perhaps product feeds etc) then you might like this little snippet.
Not only will it force the file to be downloaded but it allows you to specify a custom filename that it should be saved as.
if(isset($_GET['download_file'])){
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=Export.txt");
readfile('Export.txt');
die;
}
So now that everyone uses Google Shopping, Google are making life difficult for the merchants and they all have to jump through hoops.
The current push from Google is enforcing some things that are very difficult for small companies to conform with :-
* EAN Numbers – This is the BIG one, Google are making EAN Numbers required – for some retailers, they just don’t exist, and for a lot of older or cheaper shopping cart systems, they don’t have anywhere to enter them.
* Google Category – This is a fairly obvious one, they are attempting to enable shoppers to browse products and find a motherboard for instance with a 1156 socket rather than a CPU that fits an 1156 socket. The answer is to add an extra field to a site’s category system to map site categories to Google categories, or to restructure your products into google’s categorisations.
* Product Images – Google are making this mandatory as well, which most people are getting round by using stock or illustration-only images.
* Availability – This one actually helps retailers, putting orderable products that are out of stock in front of customers, and is a small change to most scripts exporting to Google
The above changes are being phased in now but should your feed suddenly stop working, how big is the impact on your business? Whilst some of the changes are little tweaks, such as the availability flag, others require fairly substantial changes in the back-end of many cart systems. We are getting many aggrieved businesses contacting us asking for fast turnaround on their Google products feed as they are loosing money all the time that Google are rejecting their products.
What normally (given past changes) has been little tweaks for feeds to be compatible has lately become hours and hours of work both on developers and store-owners. Are you ready to jump through the latest burning hoop Google is holding out for you?
If you want to offer a csv feed and want the results to be on demand and like the idea of avoiding messing about righting to files on the server etc, you might like this little manuever.
You will notice I’m using a non standard db_query function, just assume that this does all the sensible stuff it should.
Also the query needs to be modified to suit.
The trick is writing to PHP’s built in php://output stream which is basically just STDOUT.
Note the headers which are specifically required to get IE to accept the file as a download. Other browsers will accept less headers but will also work fine with these.
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"file.csv\";");
header("Content-Transfer-Encoding: binary");
$outstream = fopen("php://output", 'w');
$sql = " select * from a_table";
$q = db_query("$sql");
$header = false;
while ($r = mysql_fetch_assoc($q)) {
if (!$header) {
fputcsv($outstream, array_keys($r));
$header = true;
}
fputcsv($outstream, $r);
}
fclose($outstream);