示例#1
0
 public function __construct()
 {
     //Setting up order fees
     $options = new Options();
     $fees = $options->getSaleFees();
     $this->tax_percent = $fees["fees_tax_percent"];
     $this->paypal_ratepercent = $fees["fees_paypal_ratepercent"];
     $this->paypal_extrafee = $fees["fees_paypal_extrafee"];
     //Main loggging, addDebug,addInfo,addNotice,addWarning,addError,addCritical,addAlert,addEmergency
     $this->log = new Logger('vibepuntacana');
     $this->log->pushHandler(new StreamHandler(MAIN_LOG, Logger::WARNING));
 }
示例#2
0
 public function getValidPackageByGuid($guid)
 {
     $db = new clsDBdbConnection();
     $guid = $db->esc($guid);
     //status_id 2 = active
     $sql = "select id,guid,title,title_summary,price,valid_to,status_id,details from packages\n                where status_id = 2 and guid = '{$guid}' ";
     $db->query($sql);
     $row = array();
     $options = new Options();
     $saleFees = $options->getSaleFees();
     $db->next_record();
     $package_id = (int) $db->f("id");
     $row["guid"] = $db->f("guid");
     $row["title"] = $db->f("title");
     $row["title_summary"] = $db->f("title_summary");
     $row["price"] = $db->f("price");
     $row["valid_to"] = $db->f("valid_to");
     //Calculating sale fee for 1 package, quantity changes after order submision and qty selected
     $qty = 1;
     $subtotal = $row["price"] * $qty;
     $tax_total = $saleFees["fees_tax_percent"] * $subtotal;
     $paypal_totalfee = $saleFees["fees_paypal_ratepercent"] * $subtotal + $saleFees["fees_paypal_extrafee"];
     $sale_fee = $tax_total + $paypal_totalfee;
     //Only 2 decimal places for amounts
     $sale_fee = number_format($sale_fee, 2);
     $row["sale_fee"] = $sale_fee;
     $row["status_id"] = $db->f("status_id");
     $row["details"] = nl2br($db->f("details"));
     $row["package_images"] = $this->getImagesByPackageId($package_id);
     $db->close();
     return $row;
 }