The Amazon Showcase widget inlines the randomized selection from your showcase, so that’s basically incompatible with a “super cache” if you still want the random behavior. This little patch makes the selection asynchronously so you still get the expected behavior. Included is an .htaccess to allow requests to the php script for those of you who have your wp-content and/or plugins locked down.

diff -u -b -B -N -r --exclude CVS -urN -w .amazon-showcase-wordpress-widget/amazonshowcase.php amazon-showcase-wordpress-widget/amazonshowcase.php
--- .amazon-showcase-wordpress-widget/amazonshowcase.php	2009-11-27 17:53:06.000000000 -0600
+++ amazon-showcase-wordpress-widget/amazonshowcase.php	2009-12-11 19:31:56.000000000 -0600
@@ -1261,6 +1261,11 @@
 	}
 }

+function AMZSCAsyncFooter() {
+	echo '<script type="text/javascript">$("#amzsc-async").hide().load("' . plugins_url('amazon-showcase-wordpress-widget/amazonshowcase.php') . '?amzscid=" + amzscShowcaseId).fadeIn("slow");</script>' . "\n";
+}
+
+if (class_exists('WP_Widget')) {
 class AMZSCWidget extends WP_Widget {
 	/** constructor */
 	function AMZSCWidget() {
@@ -1272,12 +1277,18 @@
 		extract($args);
 		if (!empty($instance['showcase_id'])) {
 			$title = apply_filters('widget_title', $GLOBALS['AmazonShowcase']->_showcases[$instance['showcase_id']]->_name);
-			?>
-				<?php echo $before_widget; ?>
-				<?php if ( $title ) echo $before_title . $title . $after_title; ?>
-				<?php echo amazonshowcase($instance['showcase_id']); ?>
-				<?php echo $after_widget; ?>
-			<?php
+
+			echo $before_widget;
+
+			if ($title) {
+				echo $before_title . $title . $after_title;
+			}
+
+			echo '<div id="amzsc-async"></div><script type="text/javascript">var amzscShowcaseId=\'' . $instance['showcase_id'] . '\';</script>';
+
+			add_action('wp_footer', 'AMZSCAsyncFooter');
+
+			echo $after_widget;
 		}
 	}

@@ -1313,6 +1324,7 @@
 	}

 }
+}

 /**
  * Display a showcase anywhere in a theme.
@@ -1351,12 +1362,22 @@
 				$GLOBALS['AmazonShowcase']->AjaxRemoveShowcaseItem($_REQUEST["amzshcs_showcase_identifier"], $_REQUEST["amzshcs_item_identifier"]);
 				break;
 		}
-	} else {
 		// If Wordpress was initialized correctly, go ahead and enable the plugin
-		if (defined('ABSPATH') && defined('WPINC')) {
+	} else if (defined('ABSPATH') && defined('WPINC')) {
 			add_action('init', array('AmazonShowcase', 'Enable'), 1000, 0);
 			add_action('widgets_init', create_function('', 'return register_widget("AMZSCWidget");'));
+	} else if (isset($_REQUEST["amzscid"])) {
+		$wp_root = '../../..';
+
+		if (file_exists($wp_root . '/wp-load.php')) {
+			require_once($wp_root . '/wp-load.php');
+		} else {
+			require_once($wp_root . '/wp-config.php');
 		}
+
+		AmazonShowcase::Enable();
+
+		amazonshowcase($_REQUEST["amzscid"]);
 	}
 }

diff -u -b -B -N -r --exclude CVS -urN -w .amazon-showcase-wordpress-widget/.htaccess amazon-showcase-wordpress-widget/.htaccess
--- .amazon-showcase-wordpress-widget/.htaccess	1969-12-31 18:00:00.000000000 -0600
+++ amazon-showcase-wordpress-widget/.htaccess	2009-12-11 18:19:30.000000000 -0600
@@ -0,0 +1,7 @@
+Order allow,deny
+
+# amazon showcase -cgs
+<FilesMatch ^amazonshowcase.php$>
+	Allow from all
+</FilesMatch>
+
  • Digg
  • Delicious
  • StumbleUpon
  • Technorati Favorites
  • Reddit
  • Yahoo Buzz
  • Twitter
  • DZone
  • Google Bookmarks
  • LinkedIn
  • Amazon Wish List
  • Share/Bookmark