Hi,
Sorry for the late response, for some reason I did not get an email notifying of your post.
The first part of your request would be really difficult to do inside the plugin, it is built around the concept of a single ASIN for each locale. Multiple ASINs causes it to create multiple links.
The best way to achieve what you want would be do pre-process the data then send the preferred ASIN to the plugin. I might be able to provide some example code for this if it is something you might consider?
The second part I have been thinking about for some time, i.e. some sort of ‘health check’ page to check the settings and affiliate IDs are entered correctly and all the links are render correctly. The key problem is that with a large site it would generate a large number of AWS requests in a very short period of time, this would probably cause the AWS server to reject most of the requests.
Paul
For the 1st part, if you can provide some sample code, that could help.
For the 2nd part, you don’t need to run a health check for all links at a specific time. Everytime your plugin runs (because the visitor has accesed a page with an Amazon link), it detects if the link has failed, doesn’t it?. In that case it should report it through an email, an alert in the WP dashboard, etc.
Hi,
This is the code to do a basic price check and show the lowest price, you could wrap it in a shortcode callback to allow you to put it in a post:
<?php
if (isset($awlfw)) {
$asins = array('0340993782', '014311977X', '0340994398');
$best_price = 999999;
$best_product = NULL;
foreach ($asins as $asin) {
$details = array_pop($awlfw->cached_query($asin));
// Strip $,EURO,£, etc.
$raw_price = preg_replace('/[^0-9.]/','',$details['offer_price']);
if ($raw_price < $best_price) {
$best_price = $raw_price;
$best_product = $details['asin'];
}
}
if (!empty($best_product)) {
echo amazon_shortcode("asin=$best_product&live=1&template=wishlist");
}
}?>
The second part I’ll add to the list of potential enhancements for the next version of the plugin.
Paul