Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter thiloroe

    (@thiloroe)

    Sorry to bug you again,

    I have this custom template which makes a buy-button. It works correctly, but the syntax seems overly complicated to me:

    %LINK_OPEN%de#<div%LINK_OPEN%de# <div class=”CTAButton”><i class=”fa fa-shopping-cart” style=”padding-right:10px”></i>Bei Amazon %PRICE%DE#</div>%LINK_CLOSE%</div>%LINK_CLOSE%

    Does this look right to you?

    Best,
    Thilo.

    Plugin Author paulstuttard

    (@paulstuttard)

    Hi,

    Don’t think you need to nest the LINK_OPEN’s. This might work:

    %LINK_OPEN%de# <div class="CTAButton">
    <i class="fa fa-shopping-cart" style="padding-right:10px"></i>
    Bei Amazon %PRICE%DE#
    </div>%LINK_CLOSE%

    By the way – If you purely want German products/links across your site you can turn localisation off and set the default locale to Germany. Then you don’t need the %de# on all the template items.

    Or turn off localisation and then in the shortcode add the argument default_cc=de or default_cc=uk if you want country specific shortcodes.

    Just some ideas,

    Paul

    Plugin Author paulstuttard

    (@paulstuttard)

    Hi,

    To address your first question, the EUR part of the price is returned by Amazon.

    However in theory it would not be too difficult for me to knock up some code to replace EUR with € – character sets and encoded aside.

    Paul

    Plugin Author paulstuttard

    (@paulstuttard)

    If you add this to functions.php or the end of another plugin file:

    function alx_extras_euro ($price) {
          return str_replace ('EUR', '&euro;', $price);
       }
       add_filter('amazon_link_template_process_list_price', 'alx_extras_euro',11,1);
       add_filter('amazon_link_template_process_offer_price', 'alx_extras_euro',11,1);
       add_filter('amazon_link_template_process_latest_price', 'alx_extras_euro',11,1);
       add_filter('amazon_link_template_process_price', 'alx_extras_euro',11,1);

    Cheers,

    Paul

    Thread Starter thiloroe

    (@thiloroe)

    It would be great to be able to replace the currency code with a symbol (also $ etc), but not really high priority…

    About the other question. If I remove the nesting, the button itself doesn’t work as a link anymore. So I guess I just leave it.

    Good idea about the localisation. Thank you!

    Best,
    Thilo.

    Thread Starter thiloroe

    (@thiloroe)

    Wonderful! Works like charme. Thank you!

    What does Amazon return for US-Dollar and British Pound? USD for UD-dollar I assume and for pound?

    Great support by the way!

    Best,

    Thilo.

    Plugin Author paulstuttard

    (@paulstuttard)

    Hi,

    Amazon seem happy enough to return $ and £ for US and UK currencies, CDN$ for Canada, my browser does not support Japanese or Chinese character sets, so not sure if these are working!

    Paul

    Thread Starter thiloroe

    (@thiloroe)

    So this little fix of yours is a real service for my fellow Europeans! ??

    Thanks again!

    Thilo.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Replace currency code with symbol’ is closed to new replies.