Announcement

Collapse
No announcement yet.

Trying to display discounted price in a tooltip

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

    Trying to display discounted price in a tooltip

    Hi all,

    Has anyone tried to implement wz_tooltip.js in Actinic?
    http://www.walterzorn.com/tooltip/tooltip_e.htm

    I am trying to add a tooltip that will display some text along with a php variable. The idea is to have an image next to the price of items that are included in % discount group so that when you hover over the image a tool tip displays the discounted price.

    I have everything working except the price will not display.

    onmouseover="Tip('Show discounted <?php echo $savepercent?> here')"

    displays in the tooltip as

    “Show discounted here”

    ...no price!

    My modified layout, based on “Standard Tax Exclusive Price” is shown below

    Code:
    <!--	<actinic:variable name="ProductPriceDescription" /> -->
    
    	<div align="right" valign="middle"><actinic:variable name="PreFormattedPrice" value="Product Price Excluding Tax" />
    
    	<actinic:block if="%3cactinic%3avariable%20name%3d%22IsFirstQuantityBreak%22%20%2f%3e">
    		<actinic:block if="%3cactinic%3avariable%20Name%3d%22QuantityDescMax%22%2f%3e%20%3d%3d%201">
    			(<actinic:variable Name="QuantityDescMax"/> item)
    		</actinic:block>
    		<actinic:block if="%3cactinic%3avariable%20Name%3d%22QuantityDescMax%22%2f%3e%20%3e%201">
    			(<actinic:variable Name="QuantityDescMax"/> or fewer items)
    		</actinic:block>
    	</actinic:block>
    	<actinic:block if="%3cactinic%3avariable%20name%3d%22IsMiddleQuantityBreak%22%20%2f%3e">
    		(<actinic:variable Name="QuantityDescMin"/> to <actinic:variable Name="QuantityDescMax"/> items)
    	</actinic:block>
    	<actinic:block if="%3cactinic%3avariable%20name%3d%22IsLastQuantityBreak%22%20%2f%3e">
    		(<Actinic:Variable Name="QuantityDescMin"/> or more items)
    	</actinic:block>
    
    <actinic:block if="%3cactinic%3avariable%20name%3d%22GroupID%22%20%2f%3e%20%20%3d%3d%203" >
    
    
    	<actinic:block php="true">
    
    $rawprice = <actinic:variable name="ProductPriceRaw" selectable="false" />;
    
    {
    //  $savepercent = ROUND(($rawprice - $rawprice * 0.15), 2);
      $savepercent = number_format(($rawprice - $rawprice * 0.15), 2, ".", " ");
    //  echo "or £$savepercent";
      }
    
    
    </actinic:block>
    <span class="link"><a href="javascript: void(0)" onmouseover="Tip('Show discounted <?php echo $savepercent?> here')" onmouseout="UnTip()"><img src="info1.jpg" style="padding-bottom: 2px; padding-right: 5px; vertical-align: middle; border-style:none;"/></a></span>
    
    </actinic:block>
    
    
    
    
    	<actinic:block if="%3cactinic%3avariable%20name%3d%22IsTaxMessageShown%22%20%2f%3e">
    	<span class="actxxsmall">
    <!--		(Exc VAT)&nbsp;<actinic:block if="%3cactinic%3avariable%20name%3d%22IsTax1Used%22%20%2f%3e"><actinic:variable name="TaxName1"/> at <actinic:variable name="TaxRate1"/>%</actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsTax1AndTax2Used%22%20%2f%3e"> and </actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsTax2Used%22%20%2f%3e"><actinic:variable name="TaxName2"/> at <actinic:variable Name="TaxRate2"/>%</actinic:block>)-->
    	</span>
    	</actinic:block>
    	</div>
    Thanks for any help.

    Regards
    Lee

    #2
    Image added to help show what I'm trying to do.

    Any ideas anyone?

    Thanks Lee
    Attached Files

    Comment


      #3
      The problem you have is that actinic parses blockif PHP on the PC before uploading but this bit

      onmouseover="Tip('Show discounted <?php echo $savepercent?> here')"

      is trying to write the value for $savepercent via php on the server.

      To make this work you'll need to use a blockif to write the value for $savepercent.

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

      First Tackle - Fly Fishing and Game Angling

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

      Comment


        #4
        Thanks mike,

        I have tryed...
        Code:
        <span class="link"><a href="javascript: void(0)" onmouseover="Tip(‘
        
        <actinic:block php="true">
        
        $rawprice = <actinic:variable name="ProductPriceRaw" selectable="false" />;
        {
          $savepercent = number_format(($rawprice - $rawprice * 0.15), 2, ".", " ");
            echo "or £$savepercent";
          }
        </actinic:block>
        
        after discount')" onmouseout="UnTip()"><img src="info1.jpg" style="padding-bottom: 2px; padding-right: 5px; vertical-align: middle; border-style:none;"/></a></span>
        But wz_tooltip.js doesn’t work if the Tip(‘text’) is over more than one line. So in the code
        Code:
        onmouseover="Tip(‘text to display')"
        is ok,

        but
        Code:
        onmouseover="Tip(‘text to 
        display')"
        is not

        ...I'm probably trying to do this in completely wrong way!

        Lee

        Comment


          #5
          Once you've define $savepercent as in the first post then I would do something like this:

          <actinic:block php="true">
          echo "<span class='link'>";
          echo "<a href='javascript: void(0)' onmouseover='Tip('Show discounted $savepercent here')' onmouseout='UnTip()'>";
          echo "<img src='info1.jpg' style='padding-bottom: 2px; padding-right: 5px; vertical-align: middle; border-style:none;'/>";
          echo "</a></span>";
          </actinic:block>
          Mike
          -----------------------------------------

          First Tackle - Fly Fishing and Game Angling

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

          Comment


            #6
            Thanks for the help Mike, works a treat.
            Just needed a small change to one line – change ‘ to \”

            Code:
            echo "<a href=\"javascript: void(0)\" onmouseover=\"Tip('Show discounted £$savepercent here')\" onmouseout=\"UnTip()\">";
            Thanks again for the time you spent on this, I really appreciate it.
            Regards
            Lee

            Comment

            Working...
            X