Announcement

Collapse
No announcement yet.

showing a second calculated price for each product

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

    showing a second calculated price for each product

    I have a site I am building on which I would really like to have two prices shown. One is an inc. VAT internet only price, the other is a reference to an inc. VAT in store price.

    this is to enable me to add a flat £9 charge insured delivery for products bought online, but also then to show a price if the customer decided to come to the client's high street stores to buy it there instead. They can only buy at the online price of course, the other needs to be a reference, calculated by adding £9 to the inc VAT price.

    (just thinking ahead - for once) if it was possible to have products grouped so the smaller or larger ones might have a different fixed charge perhaps, this might be groovy.

    thanks.
    D

    #2
    Two ways (there are more).

    1) The simple but hard work way:

    Create a Custom Property (STOREPRICE), into which you'll put e.g. "In store £12.34" and add CUSTOMVAR:STOREPRICE into Act_ProductPrice.html.

    2) The Automatic way:

    Create a custom property (STOREDIFF), and set it in Design / Options / Site Defaults to be 9.

    Edit Act_ProductPrice.html and where you want this extra price displayed add
    Code:
    <script language=JavaScript>
    <!--
    storeprice('NETQUOTEVAR:COST','CUSTOMVAR:STOREDIFF');
    //-->
    </script>
    and in Act_Primary.html, just above the </head> statment add
    Code:
    <script language=JavaScript>
    <!--
    function storeprice(cost,diff){
      if ( diff == '' ) return;
      cost = cost.replace(/&#38;#46;/g,".");   	// restore decimal point ( &#46; )
      cost = cost.replace(/&#\d+;/g,"");	// strip all escaped characters
      cost = parseFloat(cost);		// extract the first number
      if ( isNaN(cost) ) return;		// fail silently on errors
      diff = diff - 0;			// make numeric
      cost = cost + diff;
      document.write(' (In store: £' + cost.toFixed(2) + ') ');
    }
    //-->
    </script>
    Now in any sections where the Custom Property STOREDIFF is set you'll get it added to each price. If you leave STOREDIFF blank then no additional price is generated.
    You can set STOREDIFF on a per Product or per Section basis if you like.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      brilliant, thanks Norman.

      Comment


        #4
        Make sure you revisit the patch above. I had to edit it as the Forum was munging some of the code. It's OK now.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Originally posted by NormanRouxel
          munging
          just made this my word of the day - no idea what it means but it sounds great


          Bikster
          SellerDeck Designs and Responsive Themes

          Comment


            #6
            The Forum insistes on expanding any & # 123 ; type entities even when inside [ c o d e ] .. [ / c o d e ] tages. Result munged text and minging results.

            PS I've just edited the patch above so it doesn't care what currency you're using and so it will work OK if you have more than 1 currency displayed.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Originally posted by NormanRouxel
              The Forum insistes on expanding any & # 123 ; type entities even when inside [ c o d e ] .. [ / c o d e ] tages. Result munged text and minging results.

              PS I've just edited the patch above so it doesn't care what currency you're using and so it will work OK if you have more than 1 currency displayed.
              Norman,

              *Eagle* groveling at the feet of a literal Genie

              Thank you, Thank you, Thank you, check PayPal in about a week....
              Isaiah 40:31But they that wait upon the LORD shall renew [their] strength; they shall mount up with wings as eagles; they shall run, and not be weary; [and] they shall walk, and not faint.

              Comment


                #8
                Originally posted by NormanRouxel

                ...Create a custom property (STOREDIFF), and set it in Design / Options / Site Defaults to be 9...
                Norm,

                Just a quick one, should the type in Advanced|Custom Properties be an integer or doesn't it matter?

                Thanks
                Eagle
                Isaiah 40:31But they that wait upon the LORD shall renew [their] strength; they shall mount up with wings as eagles; they shall run, and not be weary; [and] they shall walk, and not faint.

                Comment


                  #9
                  The default setting of Text is correct. I use Text type because that's the only one available to Catalog users. Business users get additional Date and Integer types.
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment

                  Working...
                  X