Example #1
0
function display_panier()
{
    echo '<h3>TOTAL</h3>';
    foreach ($_SESSION['panier']['content'] as $item) {
        $product = product_get($item);
        echo '<div class="part_border">';
        echo '<p>Product: ' . $product["id"] . ' Price: ' . $product["price"] . '</p>';
        $total += $product['price'];
        echo '</div>';
        echo '<br>';
    }
    echo "<hr>";
    echo "Total: " . $total . " Euros";
    if (!$_SESSION['loggued_on_user']) {
        echo ' Please <a href="index.php">login</a> to validate';
    } else {
        echo '<form action="validate.php" method=post>';
        echo '<input type=submit value="validate" name="validate">';
        echo '</form>';
    }
}
<?php

require '../_init.php';
$pid = $_REQUEST['pid'];
$retailer = $_REQUEST['retailer'];
$is_popup = @$_GET['mode'] == 'popup';
$list_id = @$_REQUEST['list'];
if (!$list_id) {
    $list_id = 'def_' . current_user();
}
$product_title = @$_REQUEST['p_title'];
$product_url = @$_REQUEST['p_url'];
$product_price = @$_REQUEST['p_price'];
$product_image_url = @$_REQUEST['p_image'];
$product = product_get($retailer, $pid);
if (!$product && $product_url && $product_title && $product_image_url && $pid && $product_price) {
    $product_price = preg_replace('#[^0-9\\.]+#m', '', $product_price) * 1;
    $product = product_create($retailer, $pid, array('title' => $product_title, 'url' => $product_url, 'price' => $product_price, 'currency' => 'GBP', 'image_url' => $product_image_url));
}
if (!$product) {
    $product = array();
    $product['title'] = 'Asus C300 Chromebook, Intel Celeron, 2GB RAM, 32GB SSD, 13.3", Red';
    $product['image_url'] = 'http://johnlewis.scene7.com/is/image/JohnLewis/233845648alt3?$prod_main$';
    $product['price'] = 239.9;
    $product['url'] = 'http://www.johnlewis.com/asus-c300-chromebook-intel-celeron-2gb-ram-32gb-ssd-13-3-red/p1625271';
}
$logo = 'http://www.johnlewis.com/assets/header/john-lewis-logo.gif';
$product['logo'] = image_thumbnail_url($logo, '200x20', 'resize');
$product_image = image_thumbnail_url(@$product['image_url'], '320x250', 'resizenp');
$price_formatted = '£' . sprintf('%01.2f', $product['price']);
$lists = lists_get_for_user(false);
Example #3
0
 $res['code'] = 0;
 if ($account_info) {
     $res['code'] = 1;
 }
 $smarty->assign('account_info', $account_info);
 $type = type_get();
 //获取帐号类型
 $department = product_get();
 //获取部门
 $passwordprotect = get_passwordprotect();
 //密码保护
 $user = user_get();
 //帐号的使用者
 $admin = $_SESSION['admin_name'];
 //提交者
 $subject = product_get();
 $sql_select = 'SELECT * FROM ' . $GLOBALS['ecs']->table('account_purpose');
 $smarty->assign('purpose', $GLOBALS['db']->getAll($sql_select));
 $smarty->assign('user', $user);
 $smarty->assign('department', $department);
 $smarty->assign('type', $type);
 $smarty->assign('passwordprotect', $passwordprotect);
 $smarty->assign('subject', $subject);
 $smarty->assign('role_list', get_role());
 $smarty->assign('modify_do', 1);
 $smarty->assign('admin_id', $_SESSION['admin_id']);
 $smarty->assign('subject', $subject);
 $res['info'] = $smarty->fetch('add_account.htm');
 $res['type_id'] = $account_info['type_id'];
 $res['account_name'] = $account_info['account_name'];
 die($json->encode($res));
Example #4
0
function product_id_modif($old_id, $new_id)
{
    if (!file_exists("resources/product") or !file_exists("resources/join")) {
        return FALSE;
    }
    if (($product = product_get($old_id)) === FALSE or product_get($new_id) != FALSE) {
        return FALSE;
    }
    $table_join = unserialize_get_content("resources/join");
    foreach ($table_join as $key => $join) {
        if (preg_match("/^(.*)<:>{$old_id}\$/", $key, $match) === 1) {
            $category_list[] = $match[1];
        }
    }
    product_rem_entry($old_id);
    product_add_entry($new_id, $category_list, $product['img']);
}