Example #1
0
$email = '*****@*****.**';
$info = compact('username', 'password', 'realname', 'phone', 'email');
$customer = Customer::create($info);
test(1, 1, array('name' => 'register Customer, db'));
begin_test();
test(User::check($username, $password), true, array('name' => 'User::check($username, $password)'));
begin_test();
$username = '******';
$password = '******';
$user = User::getByName('root');
$superadmin = $user->instance();
$admin = $superadmin->createAdmin(compact('username', 'password'));
$ideal_arr = array('name' => $username, 'password' => md5($password), 'type' => 'Admin');
$id = Pdb::lastInsertId();
$real_arr = Pdb::fetchRow('name, password, type', User::$table, array('id=?' => $id));
test($real_arr, $ideal_arr, array('name' => 'Super Admin create Admin, db'));
begin_test();
$prd_types = Product::types();
$info = array('name' => '唯爱心形群镶女戒_test', 'type' => reset(array_keys($prd_types)), 'material' => json_encode(array('PT950', '白18K金', '黄18K金', '红18K金')), 'rabbet_start' => '0.30', 'rabbet_end' => '0.60', 'weight' => 9, 'small_stone' => 3, 'st_weight' => 2.1, 'images' => array('400' => array('/test/static/img/i400-1.jpg', '/test/static/img/i400-2.jpg', '/test/static/img/i400-3.jpg'), 'thumb' => array('/test/static/img/i80-1.jpg', '/test/static/img/i80-2.jpg', '/test/static/img/i80-3.jpg')));
$product = Product::create($info);
test(1, 1, array('name' => 'Admin post Product, db'));
begin_test();
$address = $customer->defaultAddress();
$address->edit(array('name' => '小池', 'phone' => '14722320989', 'detail' => '深圳罗湖区田贝'));
test(1, 1, array('name' => 'edit Address'));
begin_test();
$cart = $customer->cart();
test(+$cart->count(), 2, array('name' => 'Cart count()'));
begin_test();
$cart->submit();
test(1, 1, array('name' => 'Customer submit a Cart'));
Example #2
0
<?php

!defined('IN_PTF') && exit('ILLEGAL EXECUTION');
/**
 * @author  ryan <*****@*****.**>
 */
list($name, $product_no, $order_no, $type, $time_start, $time_end, $state) = _get('name', 'product_no', 'order_no', 'type', 'time_start', 'time_end', 'state');
if (!isset($_GET['state'])) {
    $state = $target;
}
if ($state === 'all') {
    $state = '';
}
$conds = compact('name', 'product_no', 'order_no', 'time_start', 'time_end', 'type', 'state');
$types = Product::types();
$state_map = $config['order_states'];
$next_action_map = $config['order_next_action'];
$next_button_map = $config['next_button_map'];
switch ($user_type) {
    case 'Customer':
        if ($by_ajax && is_numeric($target)) {
            $order_id = $target;
            $order = new Order($order_id);
            switch ($action) {
                case 'change_remark':
                    $remark = _post('remark');
                    if ($remark) {
                        $customer->changeOrderRemark($order, $remark);
                    }
                    echo $order->customer_remark;
                    exit;
Example #3
0
?>
<form name="search">
    <div class="search">
        <div class="type">
            <input name="type" type="hidden" value="<?php 
echo $type;
?>
" />
            <div class="small-wrap"> 
                <a class="customize-btn" href="<?php 
echo ROOT;
?>
customize">我要定制</a>
                <ul class="types">
                    <?php 
foreach (Product::types() as $t) {
    ?>
                        <li class="<?php 
    echo $type === $t ? 'on' : '';
    ?>
"><?php 
    echo $t;
    ?>
</li>
                    <?php 
}
?>
                    <li class="brand"><span>名品</span></li>
                </ul>
            </div>
        </div>