Amazon Product API plugin that retrieves the list price and the lowest price
-
So I really want to make a plugin like this: https://www.convertazon.com/demo/ except without the cheesy loading bar and other stuff.
I’m just wondering if anyone has any experience creating Amazon product APIs and if you have any advice. I’ve never made a WP plugin myself.
This would go on top of the page:
<?php include("amazon_api_class.php"); $obj = new AmazonProductAPI(); try { $result = $obj->getItemByAsin(B0067HQL30); } catch(Exception $e) { echo $e->getMessage(); } function percent($Retail, $Low) { $count1 = $Retail - $Low; $count2 = $count1 / $Retail; $count3 = $count2 * 100; $count = number_format($count3, 2) . "%"; return $count; } $LowestP = $result->Items->Item->OfferSummary->LowestNewPrice->Amount; $MSRP = $result->Items->Item->ItemAttributes->ListPrice->Amount; $Savings = $MSRP - $LowestP; $LowestP2 = number_format($LowestP /100,2); $MSRP2 = number_format($MSRP /100,2); ?>
And this goes to the body of the page to style in however you’d like.
<h1> Percent: <?php echo percent($MSRP, $LowestP); ?> </h1> <h2> Retail Price:$ <?php echo $MSRP2; ?> </h2> <h1> Lowest Price:$ <?php echo $LowestP2; ?> </h1> <h2> Total Savings:$ <?php echo number_format($Savings /100,2); ?> </h2>
There is only one real dynamic aspect of the plugin, the string of the function getItemByAsin. I guess you’d just retrieve the value from the WYSIWYG editor, is that it?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Amazon Product API plugin that retrieves the list price and the lowest price’ is closed to new replies.