本文整理汇总了PHP中get_price函数的典型用法代码示例。如果您正苦于以下问题:PHP get_price函数的具体用法?PHP get_price怎么用?PHP get_price使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_price函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create_recurrent_invoices
function create_recurrent_invoices($customer_id, $branch_id, $order_no, $tmpl_no, $date, $from, $to)
{
global $Refs;
$doc = new Cart(ST_SALESORDER, array($order_no));
get_customer_details_to_order($doc, $customer_id, $branch_id);
$doc->trans_type = ST_SALESORDER;
$doc->trans_no = 0;
$doc->document_date = $date;
$doc->due_date = get_invoice_duedate($doc->payment, $doc->document_date);
$doc->reference = $Refs->get_next($doc->trans_type);
if ($doc->Comments != "") {
$doc->Comments .= "\n";
}
$doc->Comments .= sprintf(_("Recurrent Invoice covers period %s - %s."), $from, add_days($to, -1));
foreach ($doc->line_items as $line_no => $item) {
$line =& $doc->line_items[$line_no];
$line->price = get_price($line->stock_id, $doc->customer_currency, $doc->sales_type, $doc->price_factor, $doc->document_date);
}
$cart = $doc;
$cart->trans_type = ST_SALESINVOICE;
$cart->reference = $Refs->get_next($cart->trans_type);
$invno = $cart->write(1);
if ($invno == -1) {
display_error(_("The entered reference is already in use."));
display_footer_exit();
}
update_last_sent_recurrent_invoice($tmpl_no, $to);
return $invno;
}
开发者ID:knjy24,项目名称:FrontAccounting,代码行数:29,代码来源:create_recurrent_invoices.php
示例2: getHTML
function getHTML($url, &$arr)
{
$m_url = $url;
$m_html = file_get_html($m_url);
$property = "";
$no_bed = get_no_bed($m_html);
$no_bath = get_no_bath($m_html);
$no_car = get_no_car($m_html);
$address = get_address($m_html);
$agency = get_agency($m_html);
$agency_localDir = get_agency_localDir($m_html);
$first_agent_name = get_first_agent_name($m_html);
$first_agent_contact = get_first_agent_contact($m_html);
$listing_type = "";
$price = get_price($m_html);
$inspect_time = get_inspect_time($m_html);
// $inspect_date = get_inspect_date ($m_html);
// $inspect_hour = get_inspect_hour ($m_html);
$auction_time = get_auction_time($m_html);
$auction_date = get_auction_date($m_html);
$auction_day = get_day($auction_date);
$auction_hour = get_auction_hour($m_html);
$auction_inspect_hour = get_auction_inspect_hour($m_html);
$auction_string = get_auction_string($auction_date, $auction_hour, $auction_inspect_hour);
$justlisted_string = get_justlisted_string($inspect_time);
$arr = array('url' => $m_url, 'no_bed' => $no_bed, 'no_bath' => $no_bath, 'no_car' => $no_car, 'address' => $address, 'agency' => $agency, 'agency_localDir' => $agency_localDir, 'first_agent_name' => $first_agent_name, 'first_agent_contact' => $first_agent_contact, 'listing_type' => $listing_type, 'price' => $price, 'inspect_time' => $inspect_time, 'auction_time' => $auction_time, 'auction_date' => $auction_date, 'auction_day' => $auction_day, 'auction_hour' => $auction_hour, 'auction_inspect_hour' => $auction_inspect_hour, 'auction_string' => $auction_string, 'justlisted_string' => $justlisted_string);
//print_r ($arr);
}
开发者ID:troycaeser,项目名称:WheresMyWallet,代码行数:28,代码来源:getHTMLContents.php
示例3: get_order_total
function get_order_total(){
$max=count($_SESSION['cart']);
$sum=0;
for($i=0;$i<$max;$i++){
$prodid=$_SESSION['cart'][$i]['Prodid'];
$q=$_SESSION['cart'][$i]['Quantity'];
$price=get_price($prodid);
$sum+=$price*$q;
}
return $sum;
}
开发者ID:rohitchawla22,项目名称:Website-Ecommerce,代码行数:11,代码来源:functions.php
示例4: get_order_total
function get_order_total()
{
$max = count($_SESSION['cart']);
$sum = 0;
for ($i = 0; $i < $max; $i++) {
$isbn = $_SESSION['cart'][$i]['productid'];
$q = $_SESSION['cart'][$i]['qty'];
$price = get_price($isbn);
$sum += $price * $q;
}
return $sum;
}
开发者ID:gepeng05,项目名称:new-olshop,代码行数:12,代码来源:functions.php
示例5: create
public function create($product, $product_count, $ticket_count)
{
$product = $this->db->get_where('product', array('id' => $product))->row_array();
if ($product_count > $product['count_max'] || $product_count < $product['count_min']) {
echo json_encode(array('success' => 0, 'max' => $product['count_max'], 'min' => $product['count_min']));
return;
}
$tickets = array();
for ($i = 0; $i < $ticket_count; $i++) {
$number = new_ticket_number($product['id']);
$price = get_price($product['id'], $this->user['level']);
$this->db->insert('ticket', array("number" => $number, "create_time" => time(), "credit" => $price * $product_count, "product_id" => $product['id'], "count" => $product_count, "state" => 0, "fulfill_time" => 0, "agent" => $this->user['id']));
$tickets[] = $number;
}
echo json_encode(array('success' => 1, 'tickets' => $tickets));
}
开发者ID:sdgdsffdsfff,项目名称:raptor,代码行数:16,代码来源:make.php
示例6: print_cart
function print_cart()
{
global $in_cart;
if (array_key_exists('игрушка детская велосипед', $in_cart)) {
if (get_available($in_cart['игрушка детская велосипед']['количество заказано'], $in_cart['игрушка детская велосипед']['осталось на складе']) >= 3) {
echo '<p>Поздравляем вас с участием в акции, вы купили товар "игрушка детская велосипед" в количестве более 3 штук, и получаете скидку в 30%</p>';
$in_cart['игрушка детская велосипед']['diskont'] = 'diskont3';
} else {
echo 'Купив товар "игрушка детская велосипед" количеством более 3 штук вы получите скидку 30%!';
}
$action_profit = get_profit($in_cart['игрушка детская велосипед']['количество заказано'], $in_cart['игрушка детская велосипед']['осталось на складе'], $in_cart['игрушка детская велосипед']['цена']);
}
$cart = '<table border="1"><tr>';
$cart .= '<td>№</td>' . '<td><b>Наименование</b></td>' . '<td><b>Цена</b></td>' . '<td><b>Скидка</b></td>';
$cart .= '<td><b>В заказе</b></td>' . '<td><b>На складе</b></td>' . '<td><b>Итого со скидкой</b></td></tr>';
static $total_goods = 0;
static $total_cost = 0;
static $count = 0;
static $total_profit = 0;
foreach ($in_cart as $key => $val) {
$item_price = $val['цена'];
$in_order = $val['количество заказано'];
$in_stock = $val['осталось на складе'];
$diskont = get_int($val['diskont']);
$show_diskont = $diskont > 0 ? $diskont . '0%' : '0%';
//красивое число скидки в таблице
$price = get_price($item_price, $diskont, $in_order, $key, $in_stock);
$cart .= '<tr><td>' . ++$count . '</td>';
$cart .= '<td>' . $key . '</td>';
$cart .= '<td>' . $item_price . '</td>';
$cart .= '<td>' . $show_diskont . '</td>';
$cart .= '<td>' . $in_order . '</td>';
$cart .= '<td>' . $in_stock . '</td>';
$cart .= '<td>' . $price[0] . '</td>';
$cart .= '</tr>';
$total_goods += get_available($in_order, $in_stock);
$total_cost += $price[0];
$total_profit += $price[1] - $price[0];
}
$cart .= '</table>';
$cart .= $action_profit;
$cart .= '<table style="border:1px solid gray;background:lightgray"><tr><td>ИТОГО в заказе:</td><td> - ' . $count . ' наименования,<br/>';
$cart .= '- ' . $total_goods . ' товаров,<br/> - ' . $total_cost . ' сумма к оплате,<br/> - ' . $total_profit . ' сэкономлено на скидках</td></tr></table>';
return $cart;
}
开发者ID:LEXXiY,项目名称:devschool,代码行数:45,代码来源:dz4.php
示例7: create_job
function create_job($ticket, $values)
{
$CI =& get_instance();
$product = $ticket['product'];
$to = $values['to'];
$agent = get_user_by_id($ticket['agent']);
$price = get_price($product['id'], $agent['level']);
if (!change_credit($agent['id'], -$price, $ticket['number'])) {
return 'INSUFFICIENT_BALANCE_FROM_AGENT';
}
if ($product['cate'] == 4) {
$this->load->helper('user');
$user = get_user();
if (!$user) {
return 'LOGIN_REQUIRED';
}
// hack self business here
if ($product['subcate'] == 900) {
// increase balance
change_credit($user['id'], $product['norm_value'], $ticket['number']);
}
if ($product['subcate'] == 910) {
// upgrade agent
$from = $product['province'] % 10;
$to = int($product['province'] / 10);
if ($user['level'] != $from) {
return 'INVALID_CURRENT_LEVEL';
}
if ($user['parent'] && $user['parent'] != $ticket['agent']) {
return 'PARENT_CONFLICTED';
}
$this->db->update('agent', array('level' => $to, 'parent' => $ticket['agent']), array('name' => $username));
}
} else {
$this->db->insert('job', array('create_time' => time(), 'commit_time' => 0, 'ticket_number' => $ticket['number'], 'to' => $values['to'], 'area' => $values['area'], 'product_id' => $product['id'], 'locking_on' => NULL, 'retried' => 0, 'result' => 0, 'reason' => NULL));
}
return 'SUCCESS';
}
开发者ID:sdgdsffdsfff,项目名称:raptor,代码行数:38,代码来源:product_helper.php
示例8: array
//process filtering if set as part of the get request, this modifies the
//auction_set
if (isset($_POST['bottom']) && isset($_POST['top']) && isset($_POST['rating']) && isset($_POST['category']) && isset($_POST['auctionSet']) && isset($_POST['tokenChanged'])) {
//initialize to empty array
$auction_set = array();
if ($_POST['tokenChanged']) {
//process search form
$search_token = trim($_POST['token']);
//process_search_form();//uses GET from inside the body
//if processed search token is not empty
if ($search_token) {
//query database and modify result set with further queries
$auction_set = query_select_auction_search($search_token);
for ($i = 0; $i < sizeof($auction_set); $i++) {
//enrich with price
$current_price = get_price($auction_set[$i]['auctionId'], $auction_set[$i]['startingPrice']);
$auction_set[$i]['currentPrice'] = $current_price;
//once the current price is known, there is no further need for a
//startingPrice field on the retrieved associative array
unset($auction_set[$i]['startingPrice']);
//enrich with rating
$feedback_array = query_select_user_rating($auction_set[$i]['seller']);
$auction_set[$i]['stars'] = $feedback_array['stars'];
$auction_set[$i]['no_of_ratings'] = $feedback_array['occurrences'];
}
}
} else {
$auction_set = $_POST['auctionSet'];
}
$auction_set = process_filter_form($auction_set, $_POST['bottom'], $_POST['top'], $_POST['rating'], $_POST['category']);
//begin constructing auction set display table, id value used by
开发者ID:marcogreselin,项目名称:auctionbay,代码行数:31,代码来源:generate_auction_list_display.php
示例9: intval
$t['a1'] = 1;
$t['p1'] = $t['price'];
$t['a2'] = $t['a3'] = 0;
$t['p2'] = $t['p3'] = 0.0;
}
$number = intval($v['number']);
if ($number < $t['a1']) {
$number = $t['a1'];
}
if ($number > $t['amount']) {
$number = $t['amount'];
}
if ($number < 1) {
$number = 1;
}
$price = get_price($number, $t['price'], $t['step']);
$amount = $number * $price;
$_note = convert(input_trim($v['note']), 'UTF-8', DT_CHARSET);
$note = '';
$t['P1'] = get_nv($t['n1'], $t['v1']);
$t['P2'] = get_nv($t['n2'], $t['v2']);
$t['P3'] = get_nv($t['n3'], $t['v3']);
$t['s1'] = $s1;
$t['s2'] = $s2;
$t['s3'] = $s3;
$t['m1'] = isset($t['P1'][$t['s1']]) ? $t['P1'][$t['s1']] : '';
$t['m2'] = isset($t['P2'][$t['s2']]) ? $t['P2'][$t['s2']] : '';
$t['m3'] = isset($t['P3'][$t['s3']]) ? $t['P3'][$t['s3']] : '';
$t['m1'] = isset($t['P1'][$t['s1']]) ? $t['P1'][$t['s1']] : '';
$t['m2'] = isset($t['P2'][$t['s2']]) ? $t['P2'][$t['s2']] : '';
$t['m3'] = isset($t['P3'][$t['s3']]) ? $t['P3'][$t['s3']] : '';
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:cart.php
示例10: details
public function details($member_id)
{
$billing_data = $accounts_list = $paymentslist = array();
$prev_ob = $months_delayed = $amount = $i = $count_months = 0;
$payment_status = '';
$member_data = $this->member_model->get_member($member_id);
$data['member'] = $member_data;
$accounts = $this->account_model->get_reading($member_id, Null, 'ASC');
$data['privileges'] = getPrivileges();
$initial_ob = get_object_vars(array_pop($member_data));
$initialize_object = new stdClass();
$initialize_object->previous_reading = 0;
$initialize_object->current_reading = 0;
$initialize_object->date = 0;
$initialize_object->meter_reading_id = 0;
$initialize_object->added = '';
$initialize_object->member_id = $member_id;
$accounts_list[] = array(0 => $initialize_object);
foreach ($accounts as $key => $account_read) {
$accounts_list[$account_read->date][$account_read->meter_reading_id] = $account_read;
}
$data['payments'] = $this->payment_model->get_payments($member_id);
$outsanding_balance = $initial_ob['initial_ob'];
$listpayments = create_payment_matrix($data['payments']);
$paymentslist = $listpayments['list'];
$total_bal_diff = $listpayments['grand_total'] - $outsanding_balance;
$paymentslist_ids = array_keys($paymentslist);
if (!empty($accounts_list)) {
ksort($accounts_list);
$accounts_list_ids = array_keys($accounts_list);
foreach ($accounts_list_ids as $count => $bill_period_timestamp) {
$account = $accounts_list[$bill_period_timestamp];
$current_reading = $previous_reading = 0;
$wmm = WMM;
$paymentD = [];
foreach ($account as $account_loop) {
$current_reading = $current_reading + $account_loop->current_reading;
$previous_reading = $previous_reading + $account_loop->previous_reading;
}
$consumed_cubic = $current_reading - $previous_reading;
$amount = get_price($consumed_cubic);
if ($bill_period_timestamp == 0 && $consumed_cubic == 0) {
$wmm = $amount = 0;
}
$total_discount = $total_basicpayment = $total_regular_discount = 0;
$total_adjustment = $total_penalty = $total_wmm = $total_payment = $total_charges = 0;
$total_current = $amount + $wmm + $outsanding_balance;
$prev_ob = $outsanding_balance;
$outsanding_balance = $prev_ob + $amount + $wmm;
$ob_display = number_format($prev_ob, 2, '.', ',');
if ($prev_ob < 0) {
$ob_display = 'Excess of ' . $prev_ob * -1;
}
$due_time = strtotime(date('Y-m-t', $bill_period_timestamp) . ' + 15 days');
$nextMonth = strtotime(date('Y-m-t', $bill_period_timestamp) . ' + 1 month');
$billinPeriod = date('M d', $bill_period_timestamp) . ' - ' . date('t', $bill_period_timestamp);
$billPeriod = $billinPeriod . ', ' . date('Y', $bill_period_timestamp);
$curr_amount = $amount + $wmm;
$due_date = date('M j Y', $due_time);
if ($bill_period_timestamp == 0) {
$billinPeriod = "Line Connection";
$due_date = '--';
}
$isPaymentData = false;
$date_of_payment = '';
$billing_data[] = fillBillingData($billinPeriod, $bill_period_timestamp, $member_id, $due_date, $current_reading, $previous_reading, $consumed_cubic, $amount, $wmm, $total_current, $date_of_payment, $isPaymentData, $total_payment, $total_regular_discount, $total_discount, $total_basicpayment, $total_penalty, $total_charges, $total_adjustment, $ob_display, $outsanding_balance);
$total_bal_diff = $total_bal_diff - $curr_amount;
$aging_calc = $bill_period_timestamp == 0 ? $outsanding_balance : $outsanding_balance - $prev_ob;
$current = $bill_period_timestamp;
$next = $accounts_list_ids[$count + 1];
if ($bill_period_timestamp == 0) {
$valid_payments = array_filter($paymentslist_ids, function ($value) use($current, $next) {
return $value < $next;
});
} else {
if (!isset($next)) {
$valid_payments = array_filter($paymentslist_ids, function ($value) use($current, $next) {
return $value >= $current;
});
} else {
$valid_payments = array_filter($paymentslist_ids, function ($value) use($current, $next) {
return $value >= $current && $value < $next;
});
}
}
if (empty($valid_payments)) {
continue;
}
foreach ($valid_payments as $valid_payments_id) {
$paymentD[$valid_payments_id] = $paymentslist[$valid_payments_id];
}
foreach ($paymentD as $datepaid => $paymentdata) {
krsort($paymentdata);
foreach ($paymentdata as $key => $paymententry) {
$total_discount = !empty($paymententry['discount']) ? $paymententry['discount'] : 0;
$total_basicpayment = !empty($paymententry['basic_charge']) ? $paymententry['basic_charge'] : 0;
$total_regular_discount = !empty($paymententry['regular_discount']) ? $paymententry['regular_discount'] : 0;
$total_adjustment = !empty($paymententry['adjustment']) ? $paymententry['adjustment'] : 0;
$total_penalty = !empty($paymententry['penalty']) ? $paymententry['penalty'] : 0;
$total_charges = !empty($paymententry['total_charges']) ? $paymententry['total_charges'] : 0;
//.........这里部分代码省略.........
开发者ID:sedfreyatay,项目名称:calamba_water_a,代码行数:101,代码来源:transaction.php
示例11: foreach
if ($tags) {
foreach ($data as $k => $v) {
if (isset($tags[$v['itemid']])) {
$r = $tags[$v['itemid']];
$r['key'] = $k;
$r['s1'] = $v['s1'];
$r['s2'] = $v['s2'];
$r['s3'] = $v['s3'];
$r['a'] = $v['a'];
if ($r['a'] > $r['amount']) {
$r['a'] = $r['amount'];
}
if ($r['a'] < $r['a1']) {
$r['a'] = $r['a1'];
}
$r['price'] = get_price($r['a'], $r['price'], $r['step']);
$r['m1'] = isset($r['P1'][$r['s1']]) ? $r['P1'][$r['s1']] : '';
$r['m2'] = isset($r['P2'][$r['s2']]) ? $r['P2'][$r['s2']] : '';
$r['m3'] = isset($r['P3'][$r['s3']]) ? $r['P3'][$r['s3']] : '';
$lists[] = $r;
}
}
}
}
if ($lists) {
$address = array();
$result = $db->query("SELECT * FROM {$DT_PRE}address WHERE username='{$_username}' ORDER BY listorder ASC,itemid ASC LIMIT 30");
while ($r = $db->fetch_array($result)) {
if ($r['areaid']) {
$r['address'] = area_pos($r['areaid'], '') . $r['address'];
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:buy.inc.php
示例12: stripslashes
if ($this->view_it_name) {
echo stripslashes($row['it_name']) . "\n";
}
if ($this->href) {
echo "</a></div>\n";
}
if ($this->view_it_basic && $row['it_basic']) {
echo "<div class=\"sct_basic\">" . stripslashes($row['it_basic']) . "</div>\n";
}
if ($this->view_it_cust_price || $this->view_it_price) {
echo "<div class=\"sct_cost\">\n";
if ($this->view_it_cust_price && $row['it_cust_price']) {
echo "<strike>" . display_price($row['it_cust_price']) . "</strike>\n";
}
if ($this->view_it_price) {
echo display_price(get_price($row), $row['it_tel_inq']) . "\n";
}
echo "</div>\n";
}
if ($this->view_sns) {
$sns_top = $this->img_height + 10;
$sns_url = G5_SHOP_URL . '/item.php?it_id=' . $row['it_id'];
$sns_title = get_text($row['it_name']) . ' | ' . get_text($config['cf_title']);
echo "<div class=\"sct_sns\" style=\"top:{$sns_top}px\">";
echo get_sns_share_link('facebook', $sns_url, $sns_title, G5_SHOP_SKIN_URL . '/img/sns_fb_s.png');
echo get_sns_share_link('twitter', $sns_url, $sns_title, G5_SHOP_SKIN_URL . '/img/sns_twt_s.png');
echo get_sns_share_link('googleplus', $sns_url, $sns_title, G5_SHOP_SKIN_URL . '/img/sns_goo_s.png');
echo "</div>\n";
}
echo "</li>\n";
}
开发者ID:davis00,项目名称:youngcart,代码行数:31,代码来源:main.50.skin.php
示例13: get_list_trendy
function get_list_trendy($where, $order, $esLayout)
{
global $es_settings, $wpdb, $wp_query;
$paged = isset($_GET['page_no']) ? $_GET['page_no'] : 0;
if (empty($order)) {
$order = get_order();
}
$sql = "SELECT * FROM {$wpdb->prefix}estatik_properties {$where} {$order} LIMIT {$paged}, {$es_settings->no_of_listing}";
$es_my_listing = $wpdb->get_results($sql);
if (!empty($es_my_listing)) {
?>
<h1><?php
echo $wp_query->post->post_title;
?>
</h1>
<div class="es_my_listing">
<div class="es_listing_change">
<?php
if ($es_settings->view_first_on_off == 1) {
include 'es_view_first.php';
}
?>
</div>
<ul class="clearfix <?php
echo es_get_layout($esLayout);
?>
">
<?php
foreach ($es_my_listing as $list) {
$photo_info = get_images($list->prop_id);
$image_url = $photo_info[0];
// $uploaded_images_count = $photo_info[1];
?>
<li class="es_listing_item prop_id-<?php
echo $list->prop_id;
?>
">
<a href="<?php
echo get_permalink($list->prop_id);
?>
"
class="es_my_list_in"
style="background-image: url(<?php
echo $image_url;
?>
)">
</a>
<div class="es_my_list_title">
<h3>
<a href="<?php
echo get_permalink($list->prop_id);
?>
">
<?php
echo es_excerpt($list->prop_address, 90);
?>
</a>
</h3>
<h2><?php
echo get_price($list->prop_price);
?>
</h2>
<div class="description"><?php
echo es_excerpt($list->prop_description, 150);
?>
</div>
<?php
show_specs($list, $photo_info[1], 'black');
?>
<div class="clearfix"></div>
<?php
show_props($list);
?>
</div>
<div class="hover">
<div class="overlay">
<div class="es_my_list_more clearfix">
<a href="<?php
if ($list->prop_latitude != "" && $list->prop_longitude != "") {
echo "{$list->prop_latitude}, {$list->prop_longitude}";
}
?>
" class="es_button es_map_view">
<?php
_e("View on map", 'es-plugin');
?>
</a>
<a href="<?php
//.........这里部分代码省略.........
开发者ID:ksan5835,项目名称:rankproperties,代码行数:101,代码来源:es_listing_functions.php
示例14: header
<?php
header("Content-Type:application/json");
include "functions.php";
if (!empty($_GET['name'])) {
$name = $_GET['name'];
$price = get_price($name);
if (empty($price)) {
deliver_response(200, "book not found", NULL);
} else {
deliver_response(200, "book found", $name);
}
} else {
//throw invalid request
deliver_response(400, 'Invalid request', null);
}
function deliver_response($status, $status_message, $data)
{
header("HTTP/1.1 {$status}.{$status_message}");
$response['status'] = $status;
$response['status_message'] = $status_message;
$response['data'] = $data;
$json_response = json_encode($response);
echo $json_response;
}
开发者ID:shubhamstrength,项目名称:web-services,代码行数:25,代码来源:index.php
示例15: add_to_cart
public function add_to_cart($id)
{
print_r($_POST);
if (isset($_POST['qty']) && !empty($_POST['qty'])) {
$qty = $this->input->post('qty');
} else {
$qty = 1;
}
$produs = $this->mysql->get_row('products', array('id' => $id));
$pret = get_price(unserialize($produs['prices']), 10);
$insert = array('id' => $id, 'qty' => $qty, 'price' => $pret, 'name' => $produs['name_' . $this->lng], 'image' => $produs['photo'], 'parent' => $produs['parent']);
$this->cart->insert($insert);
$cart = $this->cart->contents();
//echo '<pre>'; print_r($insert); print_r($cart);
if ($_SERVER['HTTP_REFERER']) {
$url = $_SERVER['HTTP_REFERER'];
} else {
$url = "/" . $this->lng . "/product" . $produs[id];
}
if ($_POST['to_cart']) {
$url = "/" . $this->lng . "/cart";
}
redirect($url);
}
开发者ID:radumargina,项目名称:corden,代码行数:24,代码来源:main.php
示例16: get_collectibles_tot
private function get_collectibles_tot()
{
$totalOb = 0;
$members = $this->member_model->get_memberlist();
foreach ($members as $member) {
$member_id = $member->member_id;
$outsanding_balance = 0;
$initial_balance = empty($member->initial_ob) ? 0 : $member->initial_ob;
$consumed_cubic = $amount = $wmmPaid = $amtPaid = $discPaid = $penPaid = $adjPaid = $otherchargesPaid = $regdiscPaid = $total_reading_price = 0;
$wmm = WMM;
$accounts_list = array();
$accounts = $this->account_model->get_reading($member_id, Null, 'ASC');
foreach ($accounts as $key => $account_read) {
$accounts_list[$account_read->date][$account_read->meter_reading_id] = $account_read;
}
foreach (array_keys($accounts_list) as $billing_period) {
$current_reading = 0;
$previous_reading = 0;
foreach ($accounts_list[$billing_period] as $reading) {
$current_reading = $current_reading + $reading->current_reading;
$previous_reading = $previous_reading + $reading->previous_reading;
}
$consumed_cubic = $current_reading - $previous_reading;
$total_reading_price = $total_reading_price + (get_price($consumed_cubic) + $wmm);
}
$payments = $this->payment_model->get_payments($member_id);
foreach ($payments as $payment) {
$wmmPaid = $wmmPaid + (empty($payment->wmm) ? 0 : $payment->wmm);
$amtPaid = $amtPaid + (empty($payment->amount) ? 0 : $payment->amount);
$discPaid = $discPaid + (empty($payment->discount) ? 0 : $payment->discount);
$penPaid = $penPaid + (empty($payment->penalty) ? 0 : $payment->penalty);
$adjPaid = $adjPaid + (empty($payment->adjustment) ? 0 : $payment->adjustment);
$otherchargesPaid = $otherchargesPaid + (empty($payment->other_charges) ? 0 : $payment->other_charges);
$regdiscPaid = $regdiscPaid + (empty($payment->regular_discount) ? 0 : $payment->regular_discount);
}
$outsanding_balance = $initial_balance + $total_reading_price - ($amtPaid + $discPaid + $adjPaid + $regdiscPaid + $wmmPaid);
$members_data[$member_id] = array('first_name' => $member->first_name, 'last_name' => $member->last_name, 'account_number' => $member->account_number, 'serial_number' => $member->serial_number, 'zone' => $member->zone, 'purok' => $member->purok, 'address' => $member->address, 'nature' => $member->nature, 'status' => $member->status, 'total_ob' => $outsanding_balance);
$totalOb = $totalOb + $outsanding_balance;
}
$members_data['total_ob'] = array('', '', '', '', '', '', '', '', 'Total', $totalOb);
return $members_data;
}
开发者ID:sedfreyatay,项目名称:calamba_water_a,代码行数:42,代码来源:reports.php
示例17: woo_insert_update_data
function woo_insert_update_data($post)
{
global $wpdb, $woocommerce;
$_POST = $post;
// Fix: PHP 5.4
$editable_fields = array('_billing_first_name', '_billing_last_name', '_billing_email', '_billing_address_1', '_billing_address_2', '_billing_city', '_billing_state', '_billing_country', '_billing_postcode', '_billing_phone', '_shipping_first_name', '_shipping_last_name', '_shipping_address_1', '_shipping_address_2', '_shipping_city', '_shipping_state', '_shipping_country', '_shipping_postcode', 'order_status');
$new_product = json_decode($_POST['edited']);
$result = array('productId' => array());
// To get distinct meta_key for Simple Products. => Executed only once
$post_meta_info = $wpdb->get_col("SELECT distinct postmeta.meta_key FROM {$wpdb->prefix}postmeta AS postmeta INNER JOIN {$wpdb->prefix}posts AS posts on posts.ID = postmeta.post_id WHERE posts.post_type='product' AND posts.post_status IN ('publish','draft')");
// To get distinct meta_key for Child Products i.e. Variations. => Executed only once
$post_meta_info_variations = $wpdb->get_col("SELECT distinct postmeta.meta_key FROM {$wpdb->prefix}postmeta AS postmeta INNER JOIN {$wpdb->prefix}posts AS posts on posts.ID = postmeta.post_id WHERE posts.post_type='product_variation' AND posts.post_status IN ('publish','draft') AND posts.post_parent > 0");
// meta_key required for new products, that are entered through Smart Manager
if (count($post_meta_info) <= 0 || count($post_meta_info) < 23) {
$post_meta_info = array('_edit_last', '_edit_lock', '_regular_price', '_sale_price', '_weight', '_length', '_width', '_height', '_tax_status', '_tax_class', '_stock_status', '_visibility', '_featured', '_sku', '_product_attributes', '_downloadable', '_virtual', '_sale_price_dates_from', '_sale_price_dates_to', '_price', '_stock', '_manage_stock', '_backorders');
}
if (is_foreachable($new_product)) {
foreach ($new_product as $obj) {
if ($_POST['active_module'] == 'Products') {
$price = get_price($obj->_regular_price, $obj->_sale_price, $obj->_sale_price_dates_from, $obj->_sale_price_dates_to);
if (isset($obj->id) && $obj->id != '') {
$product_custom_fields = get_post_custom($obj->id);
// woocommerce uses this method to load product's details before creating WooCommerce Product Object
$post = get_post($obj->id);
// woocommerce load posts from cache
$terms = wp_get_object_terms($obj->id, 'product_type', array('fields' => 'names'));
// woocommerce gets product_type using this method
$product_type = isset($terms[0]) ? sanitize_title($terms[0]) : 'simple';
if ($product_type == 'variable') {
// To unset price fields for Parent Products having variations
$obj->_regular_price = '';
$obj->_sale_price = '';
$obj->_price = $price = $product_custom_fields['_min_variation_sale_price'][0] === '' || $product_custom_fields['_min_variation_regular_price'][0] < $product_custom_fields['_min_variation_sale_price'][0] ? $product_custom_fields['_min_variation_regular_price'][0] : $product_custom_fields['_min_variation_sale_price'][0];
}
} else {
//to not include current date for sales price for new product
$obj->_sale_price_dates_from = '';
$obj->_sale_price_dates_to = '';
$price = get_price($obj->_regular_price, $obj->_sale_price, $obj->_sale_price_dates_from, $obj->_sale_price_dates_to);
}
if (!(empty($obj->post_parent) || $obj->post_parent == '')) {
$id = $obj->post_parent;
$product_type_parent = wp_get_object_terms($id, 'product_type', array('fields' => 'slugs'));
}
if ($_POST['SM_IS_WOO16'] == "true") {
if ($obj->post_parent > 0 && $product_type_parent[0] != "grouped") {
$price = $obj->_regular_price;
}
}
// create an array to be used for updating product's details. add modified value from Smart Manager & rest same as in original post
$postarr = array('ID' => isset($obj->id) ? $obj->id : '', 'post_author' => isset($post->post_author) ? $post->post_author : '', 'post_content' => isset($obj->post_content) ? $obj->post_content : '', 'post_title' => isset($obj->post_title) ? $obj->post_title : '', 'post_excerpt' => isset($obj->post_excerpt) ? $obj->post_excerpt : '', 'post_date' => isset($post->post_date) ? $post->post_date : '', 'post_date_gmt' => isset($post->post_date_gmt) ? $post->post_date_gmt : '', 'post_status' => isset($obj->post_status) ? $obj->post_status : '', 'comment_status' => isset($post->comment_status) ? $post->comment_status : 'open', 'ping_status' => isset($post->ping_status) ? $post->ping_status : 'open', 'post_parent' => isset($obj->post_parent) ? $obj->post_parent : $post->post_parent, 'guid' => isset($post->guid) ? $post->guid : site_url() . '/?post_type=product&p=' . $post->ID, 'menu_order' => isset($post->menu_order) ? $post->menu_order : 0, 'post_type' => isset($post->post_type) ? $post->post_type : 'product', 'comment_count' => isset($post->comment_count) ? $post->comment_count : 0, 'ancestors' => isset($post->ancestors) ? $post->ancestors : array(), 'filter' => isset($post->filter) ? $post->filter : 'raw', '_product_attributes' => isset($product_custom_fields['_product_attributes'][0]) ? $product_custom_fields['_product_attributes'][0] : serialize(array()), 'user_ID' => 1, 'action' => 'editpost', 'originalaction' => 'editpost', 'original_post_status' => 'auto-draft', 'auto_draft' => 1, 'post_ID' => $obj->id, 'hidden_post_status' => 'draft', 'hidden_post_visibility' => 'public', '_visibility' => isset($obj->_visibility) ? $obj->_visibility : 'visible', 'original_publish' => 'Publish', 'publish' => 'Publish', 'newproduct_cat' => 'New Product Category Name', 'newproduct_cat_parent' => -1, 'content' => isset($obj->post_content) ? $obj->post_content : $post->post_content, 'product-type' => isset($product_type) ? $product_type : 'simple', '_virtual' => isset($product_custom_fields['_virtual'][0]) ? $product_custom_fields['_virtual'][0] : 'no', '_downloadable' => isset($product_custom_fields['_downloadable'][0]) ? $product_custom_fields['_downloadable'][0] : 'no', '_featured' => isset($product_custom_fields['_featured'][0]) ? $product_custom_fields['_featured'][0] : 'no', '_sku' => isset($obj->_sku) ? $obj->_sku : '', '_price' => $price, '_regular_price' => isset($obj->_regular_price) ? $obj->_regular_price : '', '_sale_price' => isset($obj->_sale_price) ? $obj->_sale_price : '', '_sale_price_dates_from' => isset($obj->_sale_price_dates_from) ? strtotime($obj->_sale_price_dates_from) : '', '_sale_price_dates_to' => isset($obj->_sale_price_dates_to) ? strtotime($obj->_sale_price_dates_to) : '', '_weight' => isset($obj->_weight) ? $obj->_weight : '', '_length' => isset($obj->_length) ? $obj->_length : '', '_width' => isset($obj->_width) ? $obj->_width : '', '_height' => isset($obj->_height) ? $obj->_height : '', '_tax_status' => isset($obj->_tax_status) ? $obj->_tax_status : 'taxable', '_tax_class' => isset($product_custom_fields['_tax_class'][0]) ? $product_custom_fields['_tax_class'][0] : '', '_manage_stock' => isset($product_custom_fields['_manage_stock'][0]) ? $product_custom_fields['_manage_stock'][0] : '', '_stock_status' => isset($product_custom_fields['_stock_status'][0]) ? $product_custom_fields['_stock_status'][0] : '', '_stock' => isset($obj->_stock) ? $obj->_stock : '', '_backorders' => isset($product_custom_fields['_backorders'][0]) ? $product_custom_fields['_backorders'][0] : 'no', 'excerpt' => isset($obj->post_excerpt) ? $obj->post_excerpt : $post->post_excerpt, 'advanced_view' => 1);
if ($obj->post_parent == 0 && $obj->product_type != 'variable' || $product_type_parent[0] == "grouped") {
$post_id = wp_insert_post($postarr);
$post_meta_key = $post_meta_info;
} else {
$parent_id = $postarr['post_parent'];
$post_id = $postarr['ID'];
$post_meta_key = $post_meta_info_variations;
}
array_push($result['productId'], $post_id);
foreach ($post_meta_key as $object) {
// ================================================================================================
// Code for enabling negative values for inline editing
// ================================================================================================
// if ( $object == '_sale_price' || $object == '_price' || $object == '_regular_price' ) {
// update_post_meta($wpdb->_real_escape($post_id), $wpdb->_real_escape($object), $wpdb->_real_escape($postarr[$object]) );
// continue;
// }
// ================================================================================================
if (isset($postarr[$object]) && $postarr[$object] > -1) {
// to skip query for blank value
//Code to handle the condition for the attribute visibility on product page issue while save action
if ($object == '_product_attributes' && isset($product_custom_fields['_product_attributes'][0])) {
continue;
}
if (empty($obj->id) || $obj->id == '') {
$query = "INSERT INTO {$wpdb->prefix}postmeta(post_id,meta_key,meta_value) values(" . $wpdb->_real_escape($post_id) . ", '" . $wpdb->_real_escape($object) . "', '" . $wpdb->_real_escape($postarr[$object]) . "')";
$var = $wpdb->query($query);
|
请发表评论