WordPress.org

Forums

Amazon Link
[resolved] Showing list price, not just live price (6 posts)

  1. milanouser
    Member
    Posted 2 years ago #

    Hi Paul,

    first: thanks for this very nice plugin. Saves me a lot of headache learning the Amazon API.

    Just a little question: is it possible to retrieve from Amazon the "list price" (or original price" of items, so that you could show something like:
    Now EUR 10.00 instead of EUR 15.00(or the typical strikeout in red)

    I am pretty sure that Amazon API does provide this original price, but have no idea how to retrieve it. Would be great if that could be included in your plugin, like, say:
    %ORIGINALPRICE% or something alike.

    Thanks

    http://wordpress.org/extend/plugins/amazon-link/

  2. paulstuttard
    Member
    Plugin Author

    Posted 2 years ago #

    If the API provides the list price then I'm sure I can add it to the plugin. I should be doing an update soon so I'll make sure that's one of the changes I put in.

    Cheers,

    Paul

  3. milanouser
    Member
    Posted 2 years ago #

    Paul, thanks a lot. Looking forward to that!

    Having another little hiccup now with the plugin (please forgive me for asking):

    I am trying to wrap the shortcode into a responsive table. Simplified it looks like this:

    <div width="90%"> //table 90% of content width
    <table width="100%">
    [amazon asin=... ]     //item 1
    [amazon asin=... ]     //item 2
    </table></div>

    using a template like:

    <tr>
      <td width="50%">%LINK_OPEN%%TEXT%%LINK_CLOSE%</td>
      <td width="20%">%PRICE%</td>
      <td width="30%">%LINK_OPEN%Buy it%LINK_CLOSE%</td>
    </tr>

    As a result, however, for some reason I have two <br> line breaks inserted in between the <div> and the <table> tags!
    They do not seem to be from WP, as the wpautop functions inserts <br /> tags, not `
    .

    That makes me wonder if it could be your plugin inserting these line breaks, maybe because the template functions "realizes" that the table markup is "incomplete" (as the <table> and </table> tags are outside the template?

    If so, can I somehow, somewhere change that - or even better: override it, so that I do not need to temper with the plugin code directly?

    Thanks a million

  4. milanouser
    Member
    Posted 2 years ago #

    sorry, that messed up sentence was to be:
    They do not seem to be from WP, as the wpautop function inserts <br /> tags, not <br>, i.e. without slash. Here we get the <br>, slash-less!

  5. paulstuttard
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    The plugin shouldn't affect anything in the post other than replacing the [amazon...] content. I had a search through the code just in case and could not find any <br> tags in the code apart from innocuous javascript.

    Similarly the Template parser only changes the %...% items. What you are trying to do should just work, very odd.

    Just tried doing the same on my site and if I 'inspect' the page using Chrome, I too see the double <br>. However if I 'view source' they are not there, just the html as you put in the post (Also the other 'br' tags in the rest of my post are rendered as <br\>when 'viewing source' but rendered as <br> when 'inspecting elements'.

    So the double <br> being inserted might be to do with some other unrelated part of the table? I noticed Chrome has also added 'tbody' tags as well.

    Hope this helps...

    Paul

  6. milanouser
    Member
    Posted 2 years ago #

    OK, found the culprit: it's the usual suspect: wpautop function!

    So WP thinks it should "space things out a little" (wp-includes\formatting.php, line 223), and table is such a "spacable" item.
    Have no how to get WP not to do it, don't want to mess with WP code directly, and generally disabling the wpautop function is no option either, so all I can do is work with negative margins to "lift" the table up again. What a mess...

    As for the 'tbody': have not found out where that comes from, but as long as it does not disturb my layout I can live with it.

    Anyway, thanks again for all your help - and the speed of it! 5 stars from me!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Amazon Link
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic