if(!$_SESSION['sale']){$_SESSION['sale']=false;}; //данную глобальную переменную необходимо прописать в php файле отвечаюшие за вывод цены для акции
$SALE = $_SESSION['sale'];
if ($getVar == "pricing") { // цены
//$SALE = true;
$endDate = "16.10.2018";
$array_pricing = array(
"com.b2c.all.programs.1.month" => array( "price" => "$2", "discount" => "$1.49" ),
"com.b2c.all.programs.3.month" => array( "price" => "$5", "discount" => "$3.49" ),
"com.b2c.all.programs.6.month" => array( "price" => "$9", "discount" => "$6.49" ),
"com.b2c.all.programs.12.month" => array( "price" => "$12", "discount" => "$8.49" ),
"com.b2c.all.streams.1.month" => array( "price" => "$2", "discount" => "$1.49" ),
"com.b2c.all.streams.3.month" => array( "price" => "$5", "discount" => "$3.49" ),
"com.b2c.all.streams.6.month" => array( "price" => "$9", "discount" => "$6.49" ),
"com.b2c.all.streams.12.month" => array( "price" => "$12", "discount" => "$8.49" ),
"com.b2c.all.programs.all.streams.1.month" => array( "price" => "$3", "discount" => "$1.99" ),
"com.b2c.all.programs.all.streams.3.month" => array( "price" => "$7", "discount" => "$4.99" ),
"com.b2c.all.programs.all.streams.6.month" => array( "price" => "$12", "discount" => "$8.49" ),
"com.b2c.all.programs.all.streams.12.month" => array( "price" => "$20", "discount" => "$13.99" )
);
if ( !$SALE ) { //если акции нет, очищаем discount
foreach ($array_pricing as &$price) {
unset($price["discount"]);
}
} else {
$array_pricing["endDate"] = $endDate;
}
echo json_encode( $array_pricing ); // вывод на страницу статуса
if ( !$SALE ) { //если акции нет, очищаем discount
<button class="change_false_or_true">Send Ajax</button>