Announcement

Collapse
No announcement yet.

Microformat Class Around the Price

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Microformat Class Around the Price

    I have modified product layouts (in v9) for a client to include some hProduct Rich Snippets.
    I have coded most of the required classes without any issue except the Price.

    When I place a span class around the price it includes the currency symbol which causes Google to reject the class value.

    The price in SellerDeck is generated by some local php routines that live in actinic_main.php. I want to be able to have the span class around the numeric price value rather than also including the currency symbol. To complicate matters further the client also wants to use dual currencies (Pound and Euro) but only the Pound value is required for the class.

    Any ideas please on how I can do this? I'm presuming that it may require some changes in the actinic_main.php routine that formats the pricing?

    #2
    I've a feeling that the actinic_main.php routine doesn't do much. The prices are already formatted with currency symbols, thousand comma separators, etc before being passed in to that routine. It merely decides whether to display one price or two.

    E.g. If you're using Also Display Prices / Euros and have chosen format £1.00 / €1.12 then SecondCurrencyFormat merely contains %s / %s.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Do you think it might be possible to modify the formatting in the actinic-main routine to output something like:
      £<span class="price">120.99</span>/€124.99
      instread of
      £120.99/€124.99

      Comment


        #4
        Here's how I'd go about this. Assuming you're using Product Price Including Tax. Layout contains:
        Code:
        <actinic:block PHP='true'>priceformat("<actinic:variable name="SecondCurrencyFormat" selectable="false" />","<actinic:variable name="TaxInclusivePrice" selectable="false" />", "<actinic:variable name="TaxInclusivePriceAlt" selectable="false" />");</actinic:block>
        Change to:
        Code:
        <actinic:block PHP='true'>
        $formattedprice = "<actinic:variable name="TaxInclusivePrice" selectable="false" />";
        $reformattedprice = PHP CODE HERE TO PUT SPAN AFTER £ AND STRIP COMMAS IF REQUIRED;
        priceformat("<actinic:variable name="SecondCurrencyFormat" selectable="false" />",$reformattedprice, "<actinic:variable name="TaxInclusivePriceAlt" selectable="false" />");</actinic:block>
        The stuff in CAPS will be up to you depending on requirements.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          That makes sense. I'd also forgotten about the comma separators.
          I'll give it a go. Thanks.

          Comment


            #6
            TA-DA: Here it is.
            Code:
            <actinic:block PHP='true'>
            $formattedprice = "<actinic:variable name="TaxInclusivePrice" selectable="false" />";
            $formattedprice = str_replace(',', '', $formattedprice); // lose commas
            $reformattedprice = str_replace('£', '£<span class="price">', $formattedprice) . '</span>';
            priceformat("<actinic:variable name="SecondCurrencyFormat" selectable="false" />",$reformattedprice, "<actinic:variable name="TaxInclusivePriceAlt" selectable="false" />");</actinic:block>
            If Google is happy with commas, you can delete the lose commas line.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Brilliant Norman. Many thanks. You've saved me a few hours of trial and error.

              Comment


                #8
                You're welcome. I see we're neck and neck on the way to 10K posts (and I just bumped my score).
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  We are indeed - is it a race for the line?

                  Comment


                    #10
                    You may well win. I tend to only post where tricky techy help is needed.
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #11
                      Ooops! Bit of a backhanded compliment

                      (We know what you mean, Norman )

                      Comment

                      Working...
                      X