Ejemplo n.º 1
0
 $subtotal_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($total);
 if ($_REQUEST["page"] == "checkout.index" && !empty($_POST["do_coupon"])) {
     /* process the coupon */
     /* make sure they arent trying to run it twice */
     if (@$_SESSION['coupon_redeemed'] == true) {
         $vmLogger->warning($VM_LANG->_('PHPSHOP_COUPON_ALREADY_REDEEMED', false));
     } else {
         require_once CLASSPATH . "ps_coupon.php";
         $vars["total"] = $total;
         ps_coupon::process_coupon_code($vars);
     }
 }
 // DISCOUNT
 $discount_word = ' ';
 $payment_discount_display = '0';
 $payment_discount = $ps_checkout->get_payment_discount($payment_method_id, $total);
 if (PAYMENT_DISCOUNT_BEFORE == '1') {
     if ($payment_discount != 0.0) {
         $payment_discount_before = true;
         if ($payment_discount > 0.0) {
             $discount_word = $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT');
         } else {
             $discount_word = $VM_LANG->_('PHPSHOP_FEE');
         }
         $total -= $payment_discount;
         $payment_discount_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($payment_discount - $payment_discount * 2);
     }
     // COUPON DISCOUNT
     $coupon_display = '';
     if (PSHOP_COUPONS_ENABLE == '1' && @$_SESSION['coupon_redeemed'] == true) {
         $total -= $_SESSION['coupon_discount'];
Ejemplo n.º 2
0
 /**
  * Returns all payment_methods with given selector in a Radiolist
  *
  * @param string $selector A String like "B" identifying a type of payment methods
  * @param int $payment_method_id An ID to preselect
  * @param boolean $horiz Separate Items with Spaces if true, else with <br />
  * @return string
  */
 function list_payment_radio($selector, $payment_method_id, $horiz)
 {
     global $CURRENCY_DISPLAY, $ps_checkout;
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     $auth = $_SESSION["auth"];
     $db = new ps_DB();
     if (!isset($ps_checkout)) {
         $ps_checkout = new ps_checkout();
     }
     require_once CLASSPATH . 'ps_shopper_group.php';
     $ps_shopper_group = new ps_shopper_group();
     $q = "SELECT shopper_group_id from #__{vm}_shopper_group WHERE ";
     $q .= "`default`='1' ";
     $db->query($q);
     if (!$db->num_rows()) {
         $q = "SELECT shopper_group_id from #__{vm}_shopper_group";
         $db->query($q);
     }
     $db->next_record();
     $default_shopper_group_id = $db->f("shopper_group_id");
     $q = "SELECT payment_method_id,payment_method_discount, payment_method_discount_is_percent, payment_method_name from #__{vm}_payment_method WHERE ";
     $q .= "(enable_processor='{$selector}') AND ";
     $q .= "payment_enabled='Y' AND ";
     $q .= "vendor_id='{$ps_vendor_id}' AND ";
     if ($auth["shopper_group_id"] == $default_shopper_group_id) {
         $q .= "shopper_group_id='{$default_shopper_group_id}' ";
     } else {
         $q .= "(shopper_group_id='{$default_shopper_group_id}' ";
         $q .= "OR shopper_group_id='" . $auth["shopper_group_id"] . "') ";
     }
     $q .= "ORDER BY list_order";
     $db->query($q);
     $has_result = false;
     // Start radio list
     while ($db->next_record()) {
         $has_result = true;
         echo "<input type=\"radio\" name=\"payment_method_id\" id=\"" . $db->f("payment_method_name") . "\" value=\"" . $db->f("payment_method_id") . "\" ";
         if ($selector == "' OR enable_processor='Y") {
             echo "onchange=\"javascript: changeCreditCardList();\" ";
         }
         if (($db->f("payment_method_id") == $payment_method_id || $db->num_rows() < 2) && !@$GLOBALS['payment_selected']) {
             echo "checked=\"checked\" />\n";
             $GLOBALS['payment_selected'] = true;
         } else {
             echo "/>\n";
         }
         $discount = $ps_checkout->get_payment_discount($db->f("payment_method_id"));
         echo "<label for=\"" . $db->f("payment_method_name") . "\">" . $db->f("payment_method_name");
         if ($discount > 0.0) {
             echo " (- " . $CURRENCY_DISPLAY->getFullValue(abs($discount)) . ") \n";
         } elseif ($discount < 0.0) {
             echo " (+ " . $CURRENCY_DISPLAY->getFullValue(abs($discount)) . ") \n";
         }
         echo "</label>";
         if ($horiz) {
             echo " ";
         } else {
             echo "<br />";
         }
     }
     return $has_result;
 }