Exemple #1
0
 public function displayOrder2(GWF_Module $module, GDO $gdo, GWF_User $user, $sitename)
 {
     if (!$gdo instanceof GWF_Orderable) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     if (!$gdo->canOrder($user)) {
         return $this->error('err_can_order');
     }
     if (false === ($paysite = GWF_PaymentModule::getPaymentModule($sitename))) {
         return $this->error('err_paysite');
     }
     $paysite->onLoadLanguage();
     $this->onLoadLanguage();
     $price = $gdo->getOrderPrice($user);
     $fee_perc = round($this->cfgGlobalFeeBuy() + $paysite->cfgSiteFeeBuy(), 2);
     $fee = round($price * $fee_perc / 100, 2);
     $price_total = $price + $fee;
     # Insert the order
     require_once 'GWF_Order.php';
     if (false === ($order = GWF_Order::insertOrder($module, $gdo, $paysite, $user, $price_total))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $tVars = array('order' => $gdo->displayOrder($module), 'price' => self::displayPrice($price), 'fee' => self::displayPrice($fee), 'has_fee' => $fee > 0, 'fee_percent' => sprintf('%0.2f%%', $fee_perc), 'price_total' => self::displayPrice($price_total), 'buttons' => $paysite->displayPaysiteButton($module, $order, $gdo, $user), 'paymodule_info' => $paysite->lang('paymodule_info2'));
     return $this->templatePHP('order.php', $tVars);
 }