Announcement

Collapse
No announcement yet.

Discount price on product pages

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

    #16
    Go with sledgehammer approach lol:

    $Discount = int(<Actinic:Variable Name="DiscountInfo" encoding="perl" selectable="false"/>);

    or

    $Discount = intval(<Actinic:Variable Name="DiscountInfo" encoding="perl" selectable="false"/>);

    or

    $Discount = strval(<Actinic:Variable Name="DiscountInfo" encoding="perl" selectable="false"/>);

    Comment


      #17
      Code:
      <actinic:block php="true">
      	//	$Str = <Actinic:Variable Name="DiscountInfo"/> ;
      		$Str = "30" ;
      		$Discount = intval($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>
      This works
      BUT
      Code:
      <actinic:block php="true">
      		$Str = <Actinic:Variable Name="DiscountInfo"/> ;
      	//	$Str = "30" ;
      		$Discount = intval($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>
      This does not

      and also tried all of these:
      Code:
      <actinic:block php="true">
      	// $Discount = intval(<Actinic:Variable Name="DiscountInfo" encoding="perl" selectable="false"/>)
      	// $Discount = strval(<Actinic:Variable Name="DiscountInfo" encoding="perl" selectable="false"/>); 
      		$Discount = int(<Actinic:Variable Name="DiscountInfo" encoding="perl" selectable="false"/>);
      		
      		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>
      with different errors
      intval error = Parse error: parse error in main line 6
      strval error = Warning: wrong paraneter count for strval() in main on line 3
      int error = Fatal Error: Call to undefined function int() in mani line 4
      David Cunningham

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

      Comment


        #18
        What happens if you just do a simple echo of the contents of that variable?

        Comment


          #19
          Code:
          <actinic:block php="true">
          	$Str = <Actinic:Variable Name="DiscountInfo"encoding="perl" selectable="false" /> ;
          	$Discount = intval($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>

          Comment


            #20
            Nope - sorry - had already tried that - but tried again and no joy.
            David Cunningham

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

            Comment


              #21
              More testing and eventually got it

              the echo did not work so looked deeper
              it all seems to need to be inside a Block
              Code:
              <actinic:block if="%3cactinic%3avariable%20name%3d%22IsRestrictedToCustomer%22%20%2f%3e%20%21%3d%20true" >   
                 <actinic:block php="true">
              	$Str = <Actinic:Variable Name="DiscountInfo"encoding="perl" selectable="false" /> ;
              	$Discount = intval($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>
              </actinic:block>
              Thanks for your help - so simple in the end.....

              I think this could be a useful wee bit of code for many users....
              David Cunningham

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

              Comment


                #22
                Nice one, a happy ending for a Friday night.

                Comment


                  #23
                  Yes a good way to start the w/e - I can see further fun with this though so I need to set aside some time next week.

                  We also want to show the price on the section page and I am using code from this forum to do that but the working code we got just now does not work at that level when cut-n-pasted over to the section layout.

                  Not done any diagnosis yet though .... I can, I think, understand why - but worth a try I guess.

                  Have to shut down now - family giving off and I have a flight to catch at 6:40am and still to pack..

                  Thanks for your help today - much appreciated
                  David Cunningham

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

                  Comment


                    #24
                    Copy pasting can sometimes creep some gremlins in, make sure you have a block on product list and one inside that on productprice. The AUG code might paste better if not.

                    Comment


                      #25
                      Here's what i've used for the past 3 or 4 years with no problems on a section link layout:

                      Code:
                      <actinic:block type="ProductList" ><actinic:block type="PriceList" ><actinic:variable name="PriceLayout" /></actinic:block></actinic:block>

                      Comment

                      Working...
                      X