Announcement

Collapse
No announcement yet.

A variable that displays within a certain price range

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

    A variable that displays within a certain price range

    I'm trying to get a variable ( an image of a voucher) to dispaly in my product layout when the price is over £100 and below £200. I'm OK creating my image variable and getting it to display but not when putting a condition around it to make it display (or not).

    My attempted (and incomplete)code goes something like this:

    <input type="image" src="<actinic:variable name="100PoundVoucher" /> >= 100.00 OR <= 200.00

    I realise it's unuseable code but I'm angling for any basic pointers (aside from RTFM!) that might get me nearer something useable - for starters I'm not sure how to address a product price and simply opted for decimal figures which is probably wrong, and I also lack any blocks (or block ifs?), nyway whoever'd be so kind to give me a steer i'd be grateful as I have tried searching but havn't managed to connect the dots on this one yet

    Thanks. Sean

    #2
    There is no polite way of saying it Sean, but you are doing this completely arse upwards. I don't think you are grasping blockifs, what they do and how you use them at all.

    Firstly, you want to get the image code into the layout, forget the part that decides whether it shows or not, get the image code working first. Why you are using input in your image tag, i'm not sure, but it's most likely wrong. It's important when you attack tasks like this to break it down into small workable chunks. A 100 x 100 image would be added by using the following:

    <img src="filename.jpg" width="100" height="100" alt="text description" title="text description" border="0"/>

    You then have a blockif which wraps around that code which decides on whether it shows or not. Within the blockif you have the price checking range. So the blockif goes along the lines of:

    ProductPriceRaw >= 100 AND ProductPriceRaw <= 200

    I think you will need to use ProductPriceRaw to do the calcs and this is probably net of VAT also, you will need to play with this part.

    So the logic goes:

    BlockIf (the price check is within this part)
    <img src="filename.jpg" width="100" height="100" alt="text description" title="text description" border="0"/>
    /Block

    The English reading of the block is then:

    IF the product price is equal to or more than £100 and product price is less than or equal to £200, then show this image.

    If the condition is not met, then nothing happens. With BlockIfs you need to forget the word 'Block', it doesn't block anything, it is just a block of code, the important part to take is the 'IF'. So you start by saying 'IF' and then the condition you put inside reads on from that. That is how it is variable on whether the image shows, decided by the product price. This condition is running on product price, in reality it can run on a number of things - a true/false value, a specific value, a specifc text value etc.

    Hope that helps and been as i tried to help i feel i can say RTFM.

    Comment


      #3
      Hi Lee, a preliminary thanks for the reply, I am no doubt going at the problem without the relevant skills/experience and am happy to be advised of it, I look forward to working through the process now you've spelt out a few issues for me - I have work to do

      Comment


        #4
        Worth mentioning that Actinic stores prices in pennies so 100 = £1.00 in case you are not getting the expected results in the blockif


        Bikster
        SellerDeck Designs and Responsive Themes

        Comment


          #5
          I think ProductPriceRaw is in pounds, not pence and is also nett of VAT. I'm pretty sure that is the one to use. I seem to recall Norman has mentioned using this variable is best also as he has used it in various addons.

          Comment


            #6
            Working Fine

            back again - all is good and works a treat.

            For anyone intersted the condition code (thanks Lee) that I'm running with is:

            <actinic:variable name="ProductPriceRaw" /> >= 100.00 AND <actinic:variable name="ProductPriceRaw" /> <= 200.00


            that wrapped around my variable:

            <image src="<actinic:variable name="100PoundVoucher" />" width="120" height="26" alt="discount voucher" title="discount voucher" border="0"/>


            I firstly entered my price amounts in pennies (10000) for £100 but actinic only responded to the pounds and pence format (for me). My place of setting for the variable was Site and Section and it automatically displays on all products btwn the stated price ranges. Am really pleased and can now move forward and roll out further voucher paramaters with what I've learnt.

            Great stuff - thanks Lee (and Jont)

            Comment


              #7
              Nice one Sean, i've never started an image tag with 'image' before, it has always been 'img', you might have found something out there (if it works) that I never knew.

              Comment


                #8
                I think that IMAGE is an ancient compatibility variation on IMG that was in early web browsers. Some browsers still understand it, but probably not all.

                Better use IMG like everyone else does.
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment

                Working...
                X