Announcement

Collapse
No announcement yet.

Display donation amount

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

  • Display donation amount

    Our site donates a percentage of the gross profit to a local charity. I would like to display the dollar amount the charity would receive for each item on the site. Does anyone have an idea how we could display something like this.

    For example, we would want to display the dollar amount from this formula - (Sales Price - Cost)*.10

    Where would I put this formula so its displayed with each product? How can I write something like that.

    Thanks,
    Dan

  • #2
    Well if you wanted to use a code like that on ever item I would want to do it in the edit template editor section so you only have to do it once. I have never done this but I am pretty sure you would want to add your code to one of the following:

    product_index.html
    product_makeanoffer_new.html
    product_review_list.html
    product_review_new.html

    Just put your code into one then save, and clean website cache under store settings at the bottom then you can see if its the way you want it to look. You can always revert it to the previous version at the bottom of the template page you edited. Hope this helps you out.
    Jimmy

    Comment


    • #3
      Should be fairly simple. Does it make a difference whether it is shows by way of dynamic or manual entry on the admin side? How many products do you have?

      Comment


      • #4
        Originally posted by GlowExpress View Post
        Should be fairly simple. Does it make a difference whether it is shows by way of dynamic or manual entry on the admin side? How many products do you have?
        I want it to be dynamic. We have thousands of products that we sell and the pricing changes quit often.

        Comment


        • #5
          haha, I was afraid you were going to say that. I will take a look and see what I can figure out. Won't be right away, but I will get to it.

          Comment


          • #6
            Here you go:
            Code:
            <script type="text/javascript">
            var cost = "[cost]"; 
            var price = "[price]";
            var newprice = price.replace("$", "");
            var net;
            net=cost - newprice;
            donate=net*.10;
            document.write("$");
            document.write(donate.toFixed(2));
            document.write(" will be donated");
            </script>
            Enjoy!
            .
            Clayton
            Go Live Industries

            Comment


            • #7
              I think it might conflict within the product page and not show any variables at all. Gonna give it shot in a template and see what happens. Solid straight build though.

              Comment


              • #8
                Got it
                Had my subtraction backwards. In my demo I had the cost higher then the price. Should work now. Unless the 0 in front of the cents bothers you.
                Code:
                <script type="text/javascript">
                var cost = "[cost]"; 
                var price = "[price]";
                var newprice = price.replace("$", "");
                var net;
                net=newprice - cost;
                donate=net*.10;
                document.write("$");
                document.write(donate.toFixed(2));
                document.write(" will be donated");
                </script>
                .
                Clayton
                Go Live Industries

                Comment


                • #9
                  I am glad that I had the opportunity to play with this one.

                  I see a lot of potental like:

                  A)
                  Use promo code discount
                  and get $0.54 off this item

                  B)
                  Our Price: $10.00
                  Discount: $-0.54
                  You Pay: $9.46

                  This will come in very handy when we do a storewide promotion in the forth quarter.
                  .
                  Clayton
                  Go Live Industries

                  Comment

                  Working...
                  X