Hey guys,
I’m currently updating an EE1.7x ecommerce site using CartThrob to EEV2.x.
I needed a way of showing discounted pricing on the front end. The client didn’t want to go through 3000+ products and change the sale price on each, so I am allocating a ‘status’ of Discount5, Discount10 etc to each product and then using a math plugin to display the discounted price.
I’m trying to use the ‘status’ parameter in a switchee statement as follows to reduce overhead - before I was just using ‘if statements’:
{exp:channel:entries channel="products" url_title="{last_segment}" dynamic="no" disable="category_fields|pagination|member_data" status="open|Discount5|Discount10|Discount15|Discount20|Discount25"}
{exp:switchee variable='status' parse='inward'}
{case value='Discount5'}
<div class='OldPrice'>NZ${exp:number_format number='{product_price}' decimals='2'}</div>
<div class='ProductPrice'>NZ${exp:math:percentMe num1='{product_price}' num2='5'}</div>
{/case}
{case value='Discount10'}
<div class='OldPrice'>NZ${exp:number_format number='{product_price}' decimals='2'}</div>
<div class='ProductPrice'>NZ${exp:math:percentMe num1='{product_price}' num2='10'}</div>
{/case}
{case value='Discount15'}
<div class='OldPrice'>NZ${exp:number_format number='{product_price}' decimals='2'}</div>
<div class='ProductPrice'>NZ${exp:math:percentMe num1='{product_price}' num2='15'}</div>
{/case}
{case value='Discount20'}
<div class='OldPrice'>NZ${exp:number_format number='{product_price}' decimals='2'}</div>
<div class='ProductPrice'>NZ${exp:math:percentMe num1='{product_price}' num2='20'}</div>
{/case}
{case value='Discount25'}
<div class='OldPrice'>NZ${exp:number_format number='{product_price}' decimals='2'}</div>
<div class='ProductPrice'>NZ${exp:math:percentMe num1='{product_price}' num2='25'}</div>
{/case}
{case default="yes"}
<div class='ProductPrice'>NZ${exp:number_format number='{product_price}' decimals='2'}</div>
{/case}
{/exp:switchee}
{/exp:channel:entries}This breaks the page layout at the price.
I’ve tried it without using the other plugins but same result. Have also tried it without the “default=‘yes’” and just a ‘value=“open”’ instead.
Can anyone see what’s going wrong?
Cheers
Steve