Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

How to conditionally display acbc summed price and overt discount

Hi Guys,

I am hoping to use an overt discount mechanism (post BYO) in an ACBC study - as an example I want a final price attribute to show

£<discounted summed price> per month for 12 months then £<summed price>

So I hope to be able to have a discount variable (-£5/-£10/-£20) that can reference the summed price as part of that.

Is this possible?


asked Oct 16, 2019 by djtindall Bronze (600 points)
So respondents ultimately see two price-related attributes in the ACBC?  The first row being the discount, and the second row showing the summed price as well as the summed price minus the discount?
I'd be happier to hide the discount and just show the two-pronged discounted/summed price attribute instead.

As a bit of background, this is how media companies legally have to advertise new customer offers
Another option here is (which might be the easiest) is if I have some set discounts (negative summed price attributes) which all combine into a single discount feature - and then I get to show the summed price both with and without the discounted total?

1 Answer

0 votes
I would start by creating a list of discounts.  Each item's display text should look something like this:

<input type="hidden" class="discount" value="5"/>

With "5" being replaced with "10," "20," or any other discount price.  (You can optionally add internal labels to each item so you don't end up with all this HTML in analysis.)

In your list of attributes, add this HTML to the attribute that represents summed price:

<input type="hidden" id="summed"/>

(Again, I would recommend adding an internal label.)

Now you can create your ACBC exercise using these lists.  You'll want to keep the discount attribute from showing up in BYOs, Must Haves, or Unacceptables as respondents won't actually be seeing this attribute.

Finally, add this script to your screener and choice questions:

    // Hide discounts
    // Update summed price
        var summedPrice = Number($(this).text().replace(/[^0-9.]/g, ''));
        var discount = Number($('td:nth-child(' + ($(this).closest('td').index() + 1) + ') .discount').val());
        $(this).text('£' + (summedPrice - discount) + ' per month for 12 months then £' + summedPrice);
answered Oct 16, 2019 by Zachary Platinum Sawtooth Software, Inc. (212,950 points)
That's excellent - thank you very much.

Would it be possible to do a similar thing, but using the pricing adjustments table to differentiate between the discounted price and total price?
I'm not sure I follow.  Do you mean defining the discount values in the pricing table?  That could be done, but then the discount value would be changed by the "Vary prices from/to" fields.
Ahhh thats good to know, so in that instance the discount would be as flexible as price, so as the price changed the discount as a proportion of the price would change too...

Ok, so another option would be to hard code each individual feature cost (pre-discount, pre-variation), using your method above to arrive at a summed non-discounted price (original values), and then show that alongside the price adjusted/variable price - does that sound like it will work?
That is how I set up my ACBC to write and test my code.  It seems to work, but you'll want to try it yourself to make sure it looks how you want.

If you go this route, you'll want to keep this in mind during analysis.  All Lighthouse Studio knows about is the summed price it created, not the altered summed price we created with the JavaScript.  So if you see a price in analysis, that's the price without the discount - you'll need to do the subtraction again with the discount variable to know what the altered price was.
Excellent - thanks, I'll let you know how it goes!
Hi Zachary,

I have now changed approach and am looking to show the sum of base price variables - so its exactly the same as the above, apart from I need to sum an array of discount class values in the summed price calculation.
How would I go about this?


So multiple attributes have levels with the "discount" class?
or any class really, but yes.

I have sort of flipped it so I have the base price hard coded and will then compare it to the varied summedprice

I would like to show the sum of a class rather than (summedprice - discount)
Replace line 9 of my JavaScript with this:

var discount = 0;
$('td:nth-child(' + ($(this).closest('td').index() + 1) + ') .discount').each(function(){
    discount += Number($(this).val());

Now you can use "summedPrice + discount" to write the total.
Excellent, works exactly as I needed!
Show price before discount