Announcement

Collapse
No announcement yet.

RRP Show Saving %

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

    #16
    As you say it should work.

    Not doing anything daft are you like using a £ or a , in the value?

    Mike
    -----------------------------------------

    First Tackle - Fly Fishing and Game Angling

    -----------------------------------------

    Comment


      #17
      No, nothing daft, falls over as soon as a 4 digit number is used, bizarre!

      Comment


        #18
        Ok. I've put this in the default site.

        As you say it doesn't work with 1000 and above.

        Echoing the $rrp shows that sellerdeck is inserting a , into the value which I assume is the problem. Presumably it's the variable type or the way we're referencing it. Norman would probably know in an instant but I can never remember these things.

        I'll take another look and see if I can work it out.

        Mike
        -----------------------------------------

        First Tackle - Fly Fishing and Game Angling

        -----------------------------------------

        Comment


          #19
          Amend your code to display the two variables before the calculation is made. That will point out what they look like to PHP.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #20
            Ahah. You've done that, the variables are OK but it's that pesky number_format bunging in a comma.

            Solution - don't use number_format until it's time to output the rrp:
            Code:
            <actinic:block php="true" >
            	$rrp = '<actinic:variable name="RRP" selectable="false" />';
            	if (empty($rrp)) {$rrp = 0;}
            	$rawprice = <actinic:variable name="ProductPriceRaw" selectable="false" />;
            	// display if there's a saving to show
            	if ( ($rrp != 0) && ($rrp > $rawprice) )
            		{
            		$savepercent = round((($rrp - $rawprice) / $rrp) * 100);
            		echo "<h3 class=\"rrp_price\">";
            		echo "RRP: £" . number_format($rrp,2) . "<span class=\"percent\"> (SAVING YOU $savepercent%)</span>";
            		echo "</h3>";
            		}
            </actinic:block>
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #21
              Many thanks Norman, much appreciated, what a relief.

              Comment

              Working...
              X