コード例 #1
0
ファイル: CartTest.php プロジェクト: hyrmedia/microweber
 public function testSumCart()
 {
     empty_cart();
     $add_to_cart = array('content_id' => 1, 'qty' => 3, 'price' => 300);
     $cart_add = update_cart($add_to_cart);
     $cart_items = get_cart();
     $sum = cart_sum();
     $this->assertEquals($sum, 900);
     $this->assertEquals(isset($cart_add['success']), true);
     $this->assertEquals(!empty($cart_items), true);
 }
コード例 #2
0
ファイル: EpayGateway.php プロジェクト: minhkiller/microweber
    /**
     * Submit Payment Request
     *
     * Generates a form with hidden elements from the fields array
     * and submits it to the payment gateway URL. The user is presented
     * a redirecting message along with a button to click.
     *
     * @param none
     * @return void
     */
    public function submitPayment()
    {
        $this->prepareSubmit();
        //$rand = uniqid();
        $aj = mw()->url_manager->is_ajax();
        $ret = '';
        if ($aj == false) {
            $ret .= "<html>\n";
            $ret .= "<head><title>Processing Payment...</title></head>\n";
            $ret .= "<body onLoad=\"document.forms['gateway_form'].submit();\">\n";
        } else {
            $rand = uniqid();
        }
        $ret .= '<script  type="text/javascript">
$(document).ready(function(){
 
 
 $("#gateway_form_' . $rand . '").submit();

});
</script>';
        $ret .= "<p style=\"text-align:center;\"><h2>Please wait, your order is being processed and you";
        $ret .= " will be redirected to the payment website.</h2></p>\n";
        $ret .= "<form method=\"POST\" name=\"gateway_form\" id='gateway_form_{$rand}' ";
        $ret .= "action=\"" . $this->gatewayUrl . "\">\n";
        $amount = cart_sum(true);
        $kin = get_option('epayexpress_username', 'payments');
        $url_success = get_option('epayexpress_success', 'payments');
        $url_faild = get_option('epayexpress_failed', 'payments');
        $ret .= "<input type=\"hidden\" name=\"PAGE\" value=\"paylogin\"/>\n";
        $ret .= "<input type=\"hidden\" name=\"MIN\" value=\"{$kin}\" />\n";
        $ret .= "<input type=\"hidden\" name=\"INVOICE\" value=\"11111\"/>\n";
        $ret .= "<input type=\"hidden\" name=\"TOTAL\" value=\"1.00\"/>\n";
        $ret .= "<input type=\"hidden\" name=\"DESCR\" value=\"Description\"/>\n";
        $ret .= "<input type=\"hidden\" name=\"URL_OK\" value=\"{$url_success}\"/>\n";
        $ret .= "<input type=\"hidden\" name=\"URL_CANCEL\" value=\"{$url_failed}\"/>\n";
        //        foreach ($this->fields as $name => $value)
        //        {
        //              $ret .= "<input type=\"hidden\" name=\"$name\" value=\"$value\"/>\n";
        //        }
        $ret .= "<p style=\"text-align:center;\"><br/><br/>If you are not automatically redirected to ";
        $ret .= "payment website within 5 seconds...<br/><br/>\n";
        $ret .= "<input type=\"submit\" value=\"Click Here\"></p>\n";
        $ret .= "</form>\n";
        if ($aj == false) {
            $ret .= "</body></html>\n";
        }
        return $ret;
    }
コード例 #3
0
ファイル: big.php プロジェクト: hyrmedia/microweber
    _e("Price");
    ?>
</th>
        <th><?php 
    _e("Total");
    ?>
</th>
        <th><?php 
    _e("Delete");
    ?>
</th>
      </tr>
    </thead>
    <tbody>
      <?php 
    $total = cart_sum();
    foreach ($data as $item) {
        //$total += $item['price']* $item['qty'];
        ?>
      <tr class="mw-cart-item mw-cart-item-<?php 
        print $item['id'];
        ?>
">
        <td><?php 
        if (isset($item['item_image']) and $item['item_image'] != false) {
            ?>
          <?php 
            $p = $item['item_image'];
            ?>
          <?php 
        } else {