Announcement

Collapse
No announcement yet.

Discount price on product pages

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

    Discount price on product pages

    Hi,

    I have been browsing the forums for a while and can't find a solution.

    I want to apply a discount to a group of products and want to show the WAS and NOW price on the product page rather than just in the cart.

    Typical example £100 saved off a group of products.

    I have found the following post for a V7 site:
    http://community.actinic.com/showthread.php?p=234426

    I have tried to implement the code at the bottom of the post but can't get it to work, I am using V9.0.5

    Any suggestions?

    Cheers, Ben.

    #2
    You could create a "wasPrice" (call it what you like) variable and insert it into your product layout and then fill it out on the relevant products.

    Read up on blockifs in the forum, they will teach you to hide the variable in the layout it if not filled out and read up on variables in the inbuilt help to learn how to create those.

    Unless you use the 'customer message' on the prices tab to relay the info.

    Using the cost price field is an option also.

    Choices choices........

    Comment


      #3
      Hi Lee,

      Thanks for your response.

      I am looking for an automated process. I don't want to have to manually update on each product. I have dome something similar to what you have suggested for when products are out of stock.

      I looked into the 'custom message' however not sure how to relay the price info.

      Has anyone achieved anything similar?

      I'm sure its possible... but not sure of the best approach.

      Comment


        #4
        I don't think you will get anything automated reading from the discount for example. You could have some code (php) that worked out the old price from the new one, for instance:

        Old price = £120.00
        New price = £100.00

        For the above example, if you then had some php that multiplied the current price by 1.2, you could use this to show the 'was' price. You could then wrap all of this code in a blockif which decided whether it would show on a product or not. So on each product (unless all in same section so use parent could be used), you'd switch it on (if wanted) and the calc would be auto for you. You can only do this if a set % is occurring and don't get caught out by things like was £100, now £80 and thinking you need to add 20% back on, that won't work cos it will add 20% of 80 on ie 16, not 20.

        If you wanted to get real clever you could have a % variable set at product level and you insert the discount % and then get the php (if used) to use that to calc the price, rather than having a hard coded rigid % in. Fully dynamic then, you can set the % and switch it on when you want.

        Comment


          #5
          Use 'Reward Type' and 'Reward Amount' info?

          I was struggling with this recently as well.

          We just ran a promotion for 40% off and I wanted to use the variables for the 'Reward Type' and 'Reward Amount' (found under -Marketing >Discounts and Surcharges)

          Couldnt work out how to do this, so in the end just added code which could be shown/hidden by a block to test if the item is included in the promotion.

          If it helps anyone I used:
          Code:
          Was <del>£<actinic:variable name="ProductPriceRaw" /></del><br/> Now Only
          	<actinic:block php="true">
          echo "£" . number_format((0.01 * 60 * <actinic:variable name="ProductPriceRaw" encoding="perl" selectable="false"/>), 2);
          </actinic:block>
          <!-- In the formula above the second number is the REMAINING PERCENTAGE ,eg to give 10% off you must enter 90-->
          It works for us as there is no VAT on our products BUT you do have to manually change the code if you change the discount percentage.

          Really wanted to do something automatic like the OP using the discount info entered when the promotion is set up:

          eg If reward type ='£ off' then use this calculation
          If reward type ='% off' then use different calculation ..with the 'Reward amount' inserted into the calculation to give the answer.

          Anyone know if this is possible?

          Thanks Phil
          Esperto di tutto, maestro in niente

          Comment


            #6
            I've been tasked with sorting something out in this area after a client read my post, one day i will learn not to post about difficult things lol.

            My thinking so far is this: because actinic needs the price input against the product to be the price that is used, there is no auto 'was price'. This is going to have to be manually inserted somehow.

            My thinking is to have a variable "%off", if this is filled out, then i will use that to work out what the was price was and also via a blockif to decide whether to show the 'was price' on the layout.

            So if a product's new price is now £6 after you've applied an example 40% off prices promotion. I'd be looking to have '40' added into the variable. PHP can then be used to work out that the new price is now 60% of what it was, so if we divide it by 60 and multiply by 100, we get back to what it was priced at. eg:

            £6 / 60 = 10p and multiply by 100 to get your original £10.

            Also by having something added to that variable, we can use the isNotEmpty condition to get the was price showing on page.

            I've not looked in any great depth so far, but that's my first thoughts on the process.

            My fear is that the things people think are easy to find and get hold of are in fact buried deep in perl scripts.

            Comment


              #7
              things people think are easy to find and get hold of are in fact buried deep in perl scripts
              I think you're right, and I admit I stopped digging pretty quickly !!

              We might be coming at this from two different directions though.

              You're working out the 'Was Price' from the current product price whereas I am displaying the product price as the 'Was Price' and using a calculation to show what the actual price will be when added to cart.( because the promotion reduces this by 40% in the checkout.)

              My head is starting to hurt...
              Esperto di tutto, maestro in niente

              Comment


                #8
                Not sure if you are still looking for a way of doing this but we just tested this and seems to work fine.

                The below is based on a custom variable (Percentage Off RRP) which could be set to offer a blanket discount across everything or instead be at product level leaving you to add a 'percentage off RRP' to each product.

                We included a blockif to remove this entirely should no discount be added.

                Code:
                <actinic:block if="%3cactinic%3avariable%20name%3d%22Percentage%20Off%20RRP%22%20%2f%3e%20%21%3d%20%22%22">
                
                SAVE <actinic:variable name="Percentage Off RRP" />% (RRP 
                <actinic:block php="true">
                $percentage = 100 - <actinic:variable encoding="perl" name="Percentage Off RRP" selectable="false" />;
                echo "£" . number_format((<actinic:variable encoding="perl" name="ProductPriceRaw" selectable="false" /> / $percentage * 100), 2);
                </actinic:block>)
                
                </actinic:block>
                Webfaced - Award-Winning SellerDeck Web Design Agency

                Comment


                  #9
                  I have got this working very nicely by adding a new variable to add the % to so thank you all for that.
                  But - am I trying to be too clever here.
                  The variable DiscountInfo is the text description used to display on the product page driven by the discount so I thought, as we do not need it, why not just add the % in there as well and save having to manage the extra property with all the complexities of different discounts on different sections/products.
                  Problem - of course it is a text or string value so using several php ideas I tried to convert it to an integer so I could use it in the calculation instead of the new variable.
                  It does not seem to work - If I test it with a string value (i.e. $str = "30" ) it works.
                  Code:
                  <actinic:block php="true">
                  		$Str = <Actinic:Variable Name="DiscountInfo"/> ;
                  		$Discount = (int)$Str ;
                  		echo "<br>SALE PRICE £" . number_format(<actinic:variable encoding="perl" name="ProductPriceRaw" selectable="false" /> - (<actinic:variable encoding="perl" name="ProductPriceRaw" selectable="false" /> * $Discount / 100), 2);
                  </actinic:block>
                  Can anyone advice me if this should work and if so what I am doing wrong. I tried (float)$Str as well - I tried the code in the product layout and in the Standard Discount layout just to make sure.

                  The error I get is a Parse error: parse error in main on line 2

                  Thanks
                  David Cunningham

                  www.truska.com
                  -----------------------------
                  ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

                  Comment


                    #10
                    Why not set the variable type to number in the first place, doesn't have to be text.

                    Comment


                      #11
                      Thanks

                      I am using the variable DiscountInfo - the internal Actinic variable for the Description for Product set in Discounts | Cart Contents | Presentation and just typing a number into it - say 25 for 25% to match what is set up for that particular discount

                      I did not realise I could change this variable type so have just had a look in Design Library | Variable and can not find it. Where else can you manage the internal variables?

                      Changing this it would then limit the use of that field. In the short term that will be OK for us I think.

                      The whole purpose is to have the Sale Price shown on the product page but by getting the discount info from the Discounts system and not having to do it section by section and product by product (even with inherited values this will be big job to manage.
                      David Cunningham

                      www.truska.com
                      -----------------------------
                      ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

                      Comment


                        #12
                        Sorry i misunderstood, i thought this was your own variable and you'd not realised the type can be changed. If you are using a system variable, then it needs to remain as is and you need to do the convert as you are trying to. As it's an internal variable and used by the perl scripts, i suspect you will never get to it.

                        Comment


                          #13
                          Try:

                          $Discount = strval($Str);

                          or

                          $Discount = intval($Str);

                          Comment


                            #14
                            Ah! suspected that might be the case. But surely some simple php should be able to convert it. Not sure what that does not work.

                            I have played about for far too long today with it and the concept works great and if I hard code the value used as a string then convert it it seems to work. But I am not sure if the php is actually seeing $Str = "30" as a string or is too clever and realising it is a integer and therefore my conversion code (int)$Stg is actually doing nothing anyway. Must try and test for that actually.

                            All I need is a simple bit of php that will work based on converting DiscountInfo string into a Number.

                            Must be something there somewhere I would have thought.

                            Anyhow thanks for your interest anyway - onward we go and back to Google for more possible options.
                            David Cunningham

                            www.truska.com
                            -----------------------------
                            ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

                            Comment


                              #15
                              Did my 2 suggestions not work?

                              I'm wondering whether variable you are using is only read by a perl script and thus the internal php engine will not run it. Maybe a .php page name would address that if so and you could run some php online instead.

                              Is it an itallic variable?

                              Comment

                              Working...
                              X