Thanks Ray.
You mean like this:
On the cart page:
Filter recordset:
<?php
$rsEventsAktion = new WA_MySQLi_RS("rsEventsAktion",$db_i,1);
$rsEventsAktion->setQuery("select `events`.`EventAktionCode` AS `GutscheinCode`,`events`.`EventAktionVon` AS `EventAktionVon`,`events`.`EventAktionBis` AS `EventAktionBis`,`events`.`EventTitel` AS `EventTitel` from `events` where (now() between `events`.`EventAktionVon` and `events`.`EventAktionBis`) AND `events`.`EventAktionCode` = ?");
$rsEventsAktion->bindParam("s", "".(isset($_SESSION['GutscheinCode'])?$_SESSION['GutscheinCode']:"") ."", "-1"); //WAQB_Param1
$rsEventsAktion->execute();
?>
Define 2nd Session:
<?php
@session_start();
if("" == "") {
$_SESSION["GutscheinCode2"] = "".($rsEventsAktion->getColumnVal("GutscheinCode")) ."";
}
?>
In the cart definition:
//eCart Rule
function WAEC_eCart_DegustationWeine10() {
$totalDiscount = 0;
if (true && (($this->ConditionalTotal("Quantity", "GutscheinCodeArtikel", "1") > 0) && ((isset($_SESSION['GutscheinCode'])?$_SESSION['GutscheinCode']:"") == "".$_SESSION['GutscheinCode2'] .""))) {
$totalDiscount += ($this->ConditionalTotal("TotalPrice", "GutscheinCodeArtikel", "1") * 0.1);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
Can I also use the value of the filtered recordset directly like this?
//eCart Rule
function WAEC_eCart_DegustationWeine10() {
$totalDiscount = 0;
if (true && (($this->ConditionalTotal("Quantity", "GutscheinCodeArtikel", "1") > 0) && ((isset($_SESSION['GutscheinCode'])?$_SESSION['GutscheinCode']:"") == "".($rsEventsAktion->getColumnVal("GutscheinCode")) .""))) {
$totalDiscount += ($this->ConditionalTotal("TotalPrice", "GutscheinCodeArtikel", "1") * 0.1);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule