本文整理汇总了PHP中Model_Order类的典型用法代码示例。如果您正苦于以下问题:PHP Model_Order类的具体用法?PHP Model_Order怎么用?PHP Model_Order使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Model_Order类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: button
/**
* generates HTML for apy buton
* @param Model_Order $order
* @return string
*/
public static function button(Model_Order $order)
{
if (Core::config('payment.bitpay_apikey') != '' and Theme::get('premium') == 1 and Auth::instance()->logged_in() and $order->loaded()) {
return View::factory('pages/bitpay/button', array('order' => $order));
}
return '';
}
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:12,代码来源:bitpay.php
示例2: sendPush
public function sendPush($sender, $sn, $message)
{
return;
//发送推送通知
include APPLICATION_PATH . 'libs/ApnsPHP/Log/Interface.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Log/Embedded.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Log/Null.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Abstract.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Exception.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Feedback.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Message.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Push.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Message/Custom.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Message/Exception.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Push/Server.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Push/Exception.php';
include APPLICATION_PATH . 'libs/ApnsPHP/Push/Server/Exception.php';
$order = new Model_Order($sn);
$passengerDeviceId = $order->get('passenger_device_id');
$ofd = new Model_OrderForDriver($sn);
$driver = new Model_Driver($ofd->get('driver_code'));
$driverDeviceId = $driver->get('device_id');
//$certSuffix = APPLICATION_ENV == 'development' ? '-dev.pem' : '.pem';
$certSuffix = '-dev.pem';
$passengerCert = APPLICATION_PATH . '/data/passenger' . $certSuffix;
$driverCert = APPLICATION_PATH . '/data/driver' . $certSuffix;
if ($sender == Model_OrderConversation::SENDER_DRIVER) {
$this->sendPushToDevice($passengerCert, $passengerDeviceId, $message, $sn);
} elseif ($sender == Model_OrderConversation::SENDER_PASSENGER) {
$this->sendPushToDevice($driverCert, $driverDeviceId, $message, $sn);
} else {
$this->sendPushToDevice($passengerCert, $passengerDeviceId, $message, $sn);
$this->sendPushToDevice($driverCert, $driverDeviceId, $message, $sn);
}
}
开发者ID:RobertCar,项目名称:RobertCarrential,代码行数:35,代码来源:ApiControllerAbstract.php
示例3: form
/**
* generates HTML form
* @param Model_Product $order
* @return string
*/
public static function form(Model_Order $order)
{
if (Core::config('payment.authorize_login') != '' and Core::config('payment.authorize_key') != '' and Auth::instance()->logged_in() and $order->loaded() and Theme::get('premium') == 1) {
return View::factory('pages/authorize/form', array('order' => $order));
}
return '';
}
开发者ID:Ryanker,项目名称:open-eshop,代码行数:12,代码来源:authorize.php
示例4: action_form
/**
* [action_form] generates the form to pay at paypal
*/
public function action_form()
{
$this->auto_render = FALSE;
$order_id = $this->request->param('id');
$order = new Model_Order();
$order->where('id_order', '=', $order_id)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
// dependant on product we have different names
if ($order->id_product == Paypal::to_featured) {
$item_name = __('Advertisement to featured');
} else {
if ($order->id_product == Paypal::to_top) {
$item_name = __('Advertisement to top');
} else {
$item_name = $order->description . __(' category');
}
}
$paypal_url = Core::config('payment.sandbox') ? Paypal::url_sandbox_gateway : Paypal::url_gateway;
$paypal_data = array('order_id' => $order_id, 'amount' => number_format($order->amount, 2, '.', ''), 'site_name' => core::config('general.site_name'), 'site_url' => URL::base(TRUE), 'paypal_url' => $paypal_url, 'paypal_account' => core::config('payment.paypal_account'), 'paypal_currency' => core::config('payment.paypal_currency'), 'item_name' => $item_name);
$this->template = View::factory('paypal', $paypal_data);
$this->response->body($this->template->render());
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->request->redirect(Route::url('default'));
}
}
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:29,代码来源:paypal.php
示例5: button
/**
* generates HTML for apy buton
* @param Model_Order $order
* @return string
*/
public static function button(Model_Order $order)
{
if (Core::config('payment.paymill_private') != '' and Core::config('payment.paymill_public') != '' and Theme::get('premium') == 1 and $order->loaded()) {
return View::factory('pages/paymill/button', array('order' => $order));
}
return '';
}
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:12,代码来源:paymill.php
示例6: action_pay
/**
* [action_form] generates the form to pay at paypal
*/
public function action_pay()
{
$this->auto_render = FALSE;
$order_id = $this->request->param('id');
$order = new Model_Order();
$order->where('id_order', '=', $order_id)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
// case when selling advert
if ($order->id_product == Model_Order::PRODUCT_AD_SELL) {
$paypal_account = $order->ad->paypal_account();
$currency = i18n::get_intl_currency_symbol();
if (isset($order->ad->cf_shipping) and Valid::numeric($order->ad->cf_shipping) and $order->ad->cf_shipping > 0) {
$order->amount = $order->amount + $order->ad->cf_shipping;
}
} else {
$paypal_account = core::config('payment.paypal_account');
$currency = core::config('payment.paypal_currency');
}
$paypal_url = Core::config('payment.sandbox') ? Paypal::url_sandbox_gateway : Paypal::url_gateway;
$paypal_data = array('order_id' => $order_id, 'amount' => number_format($order->amount, 2, '.', ''), 'site_name' => core::config('general.site_name'), 'site_url' => URL::base(TRUE), 'paypal_url' => $paypal_url, 'paypal_account' => $paypal_account, 'paypal_currency' => $currency, 'item_name' => $order->description);
$this->template = View::factory('paypal', $paypal_data);
$this->response->body($this->template->render());
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->redirect(Route::url('default'));
}
}
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:30,代码来源:paypal.php
示例7: action_checkout
/**
* pay an invoice, renders the paymenthods button, anyone with an ID of an order can pay it, we do not have control
* @return [type] [description]
*/
public function action_checkout()
{
$order = new Model_Order($this->request->param('id'));
if ($order->loaded()) {
//hack jquery paymill
Paymill::jquery();
//if paid...no way jose
if ($order->status != Model_Order::STATUS_CREATED) {
Alert::set(Alert::INFO, __('This order was already paid.'));
$this->redirect(Route::url('default'));
}
//checks coupons or amount of featured days
$order->check_pricing();
//template header
$this->template->title = __('Checkout') . ' ' . Model_Order::product_desc($order->id_product);
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Pricing'))->set_url(Route::url('pricing')));
Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title));
Controller::$full_width = TRUE;
$this->template->bind('content', $content);
$this->template->content = View::factory('pages/ad/checkout', array('order' => $order));
} else {
//throw 404
throw HTTP_Exception::factory(404, __('Page not found'));
}
}
开发者ID:johnulist,项目名称:openclassifieds2,代码行数:30,代码来源:plan.php
示例8: action_commit
public function action_commit()
{
$user_id = \Session::get(self::SESSION_KEY_USER_ID);
$user = Model_Member::find($user_id);
$address = \Session::get(self::SESSION_KEY_ADDRESS);
/*------make order----------------------------------------------------------*/
$order = new Model_Order();
$order->member_id = $user->id;
$order->postalcode = $address['postalcode'];
$order->destination = $address['address'] . $address['billname'] . $address['companyname'];
$date = time();
$order->order_date = date('Y-m-d H:i:s', $date);
$order->print_flag = 0;
$order->status = 0;
$order->save();
/*-----make orderline------------------------*/
$cart = \Session::get(self::SESSION_KEY_CART);
foreach ($cart['orders'] as $orderline) {
$item_id = $orderline['item_id'];
$item = Model_Item::find($item_id);
$num = $orderline['quantity'];
$size = $orderline['size'];
$neworderline = new Model_Orderline();
$neworderline->order_id = $order->id;
$neworderline->item_id = $item_id;
$neworderline->num = $num;
$neworderline->size = $size;
$neworderline->save();
$earning = new Model_Earning();
$earning->member_id = $user->id;
$earning->item_id = $item_id;
$earning->size = $size;
switch ($size) {
case 'S':
$unit_price = $neworderline->item->unit_price_s;
break;
case 'M':
$unit_price = $neworderline->item->unit_price_m;
break;
case 'L':
$unit_price = $neworderline->item->unit_price_m;
break;
default:
$unit_price = $neworderline->item->unit_price;
break;
}
$earning->unit_price = $unit_price;
$earning->num = $num;
$earning->date = date('Y-m-d H:i:s', $date);
$earning->category = $item->category;
$earning->item_name = $item->name;
$now = date('Ymd');
$birthday = date('Ymd', strtotime($user->birthday));
$earning->age = (int) floor(($now - $birthday) / 10000);
$earning->save();
}
\Session::delete(self::SESSION_KEY_CART);
return Response::redirect('index.php/message/commit');
}
开发者ID:OICTH1,项目名称:website,代码行数:59,代码来源:order.php
示例9: init
public function init()
{
parent::init();
$sn = strtoupper(trim($this->_getParam('sn', '')));
$order = new Model_Order($sn);
if (empty($sn) || !$order->exists()) {
$this->error('Order Not Found.');
}
$this->sn = $sn;
$this->order = $order;
}
开发者ID:RobertCar,项目名称:RobertCarrential,代码行数:11,代码来源:PrivateCarPassengerApiController.php
示例10: action_historyin
public function action_historyin($order_id)
{
if (empty(\Session::get(self::SESSION_KEY_CART))) {
\Session::set(self::SESSION_KEY_CART, array('orders' => array()));
}
$cart = \Session::get(self::SESSION_KEY_CART);
$order = Model_Order::find($order_id);
$total_money = 0;
foreach ($order->orderline as $orderline) {
$item = Model_Item::find($orderline['item_id']);
$quantity = $orderline['num'];
switch ($orderline['size']) {
case 'S':
$price = $item->unit_price_s;
break;
case 'M':
$price = $item->unit_price_m;
break;
case 'L':
$price = $item->unit_price_l;
break;
default:
$price = $item->unit_price;
break;
}
$money = $price * $quantity;
array_push($cart['orders'], array('item_id' => $item['id'], 'item_name' => $item['name'], 'size' => $orderline['size'], 'quantity' => $quantity, 'money' => $money));
}
foreach ($cart['orders'] as $order) {
$total_money += $order['money'];
}
$cart['total_money'] = $total_money;
\Session::set(self::SESSION_KEY_CART, $cart);
return Response::redirect('mtpizza/cart');
}
开发者ID:OICTH1,项目名称:mtpizza,代码行数:35,代码来源:cart.php
示例11: renew
/**
* expired featured ads
* @return void
*/
public static function renew()
{
if (Core::config('general.subscriptions') == TRUE) {
//get expired subscription that are active
$subscriptions = new Model_Subscription();
$subscriptions = $subscriptions->where('status', '=', 1)->where('expire_date', '<=', Date::unix2mysql())->order_by('created', 'desc')->find_all();
foreach ($subscriptions as $s) {
//disable the plan
$s->status = 0;
try {
$s->save();
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
$plan = $s->plan;
if ($plan->loaded() and $plan->status == 1) {
//generate a new order
$order = Model_Order::new_order(NULL, $s->user, $plan->id_plan, $plan->price, core::config('payment.paypal_currency'), __('Subscription to ') . $plan->name);
//free plan no checkout
if ($plan->price == 0) {
$order->confirm_payment('cash');
} else {
$checkout_url = $s->user->ql('default', array('controller' => 'plan', 'action' => 'checkout', 'id' => $order->id_order));
$s->user->email('plan-expired', array('[PLAN.NAME]' => $plan->name, '[URL.CHECKOUT]' => $checkout_url));
}
}
//if plan loaded
}
//end foreach
}
//if subscription active
}
开发者ID:ThomWensink,项目名称:openclassifieds2,代码行数:36,代码来源:subscription.php
示例12: action_order
public function action_order()
{
define("SECONDS_PER_DAY", 3600 * 24);
$now = time();
$cart = Session::get('cart');
$user = Model_User::find($this->sessUser->id);
$cart_info = [];
$order = Model_Order::forge();
$order->user_id = $user->id;
$order->created_at = $now;
$order->save();
if (!is_null($cart)) {
foreach ($cart as $product_id => $quantity) {
$product = Model_Product::find($product_id);
$order_product = Model_OrderProduct::forge();
$order_product->order_id = $order->id;
$order_product->product_id = $product->id;
$order_product->quantity = $quantity;
$order_product->price = $product->price;
$order_product->save();
}
}
Session::delete('cart');
return Response::redirect('/cart');
}
开发者ID:AlanMasciangelo,项目名称:FuelPHPStore,代码行数:25,代码来源:cart.php
示例13: action_create
public function action_create()
{
try {
if (!Valid::email(core::request('email'))) {
$this->_error(__('Invalid email'), 501);
} elseif (!is_numeric(core::request('id_product'))) {
$this->_error(__('Invalid product'), 501);
} else {
$product = new Model_Product(core::request('id_product'));
if ($product->loaded()) {
$user = Model_User::create_email(core::request('email'), core::request('name'));
$order = Model_Order::new_order($user, $product);
$order->confirm_payment(core::request('paymethod', 'API'), core::request('txn_id'), core::request('pay_date'), core::request('amount'), core::request('currency'), core::request('fee'));
//adding the notes
$order->notes = core::request('notes');
$order->save();
$this->rest_output(array('order' => self::get_order_array($order)));
} else {
$this->_error(__('Something went wrong'), 501);
}
}
} catch (Kohana_HTTP_Exception $khe) {
$this->_error($khe);
}
}
开发者ID:Ryanker,项目名称:open-eshop,代码行数:25,代码来源:order.php
示例14: action_pay
public function action_pay()
{
$this->auto_render = FALSE;
$order_id = $this->request->param('id');
$order = new Model_Order();
$order->where('id_order', '=', $order_id)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
$paypal_url = Core::config('payment.sandbox') ? Paypal::url_sandbox_gateway : Paypal::url_gateway;
$paypal_data = array('order_id' => $order_id, 'amount' => number_format($order->amount, 2, '.', ''), 'site_name' => core::config('general.site_name'), 'return_url' => Route::url('default', array('controller' => 'product', 'action' => 'goal', 'id' => $order->id_order)), 'paypal_url' => $paypal_url, 'paypal_account' => core::config('payment.paypal_account'), 'paypal_currency' => $order->currency, 'item_name' => $order->product->title);
$this->template = View::factory('paypal', $paypal_data);
$this->response->body($this->template->render());
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->redirect(Route::url('default'));
}
}
开发者ID:Ryanker,项目名称:open-eshop,代码行数:16,代码来源:paypal.php
示例15: action_detail
public function action_detail($order_id)
{
$order = Model_Order::find($order_id);
$data['member'] = $order->member;
$data['orders'] = $order;
$data['details'] = $order->orderline;
return View::forge("controlsystem/members/detail", $data);
}
开发者ID:OICTH1,项目名称:mtpizza,代码行数:8,代码来源:history.php
示例16: action_new
public function action_new()
{
$errors = NULL;
$user = Auth::instance()->get_user();
//create new ticket
if ($_POST) {
//if post save
$id_order = core::post('order');
//check if that order still have support...no cheating!! :D
$order = new Model_Order();
$order->where('id_order', '=', $id_order)->where('id_user', '=', $user->id_user)->where('support_date', '>', Date::unix2mysql())->where('status', '=', Model_Order::STATUS_PAID)->limit(1)->find();
$validation = Validation::factory($this->request->post())->rule('title', 'not_empty')->rule('title', 'min_length', array(':value', 2))->rule('title', 'max_length', array(':value', 145))->rule('description', 'not_empty')->rule('description', 'min_length', array(':value', 50))->rule('description', 'max_length', array(':value', 1000))->rule('order', 'not_empty')->rule('order', 'numeric');
if ($validation->check() and $order->loaded()) {
$ticket = new Model_Ticket();
$ticket->id_user = $user->id_user;
$ticket->id_order = $id_order;
$ticket->id_product = $order->product->id_product;
$ticket->title = core::post('title');
$ticket->description = core::post('description');
$ticket->ip_address = ip2long(Request::$client_ip);
$ticket->save();
//send email to notify_url @todo we should add a config on general to select who gets the emails by default.
if (core::config('email.new_sale_notify')) {
Email::send(core::config('email.notify_email'), '', 'New Ticket: ' . $ticket->title, Route::url('oc-panel', array('controller' => 'support', 'action' => 'ticket', 'id' => $ticket->id_ticket)) . '\\n\\n' . $ticket->description, core::config('email.notify_email'), '');
}
$user->email('new-ticket', array('[TITLE]' => $ticket->title, '[URL.QL]' => $user->ql('oc-panel', array('controller' => 'support', 'action' => 'ticket', 'id' => $ticket->id_ticket))));
Alert::set(Alert::SUCCESS, __('Ticket created.'));
$this->redirect(Route::url('oc-panel', array('controller' => 'support', 'action' => 'index')));
} else {
$errors = $validation->errors('ad');
}
}
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('New Ticket')));
$this->template->title = __('New Ticket');
//get orders with support
$orders = new Model_Order();
$orders = $orders->where('id_user', '=', $user->id_user)->where('support_date', '>', Date::unix2mysql())->where('status', '=', Model_Order::STATUS_PAID)->find_all();
if ($orders->count() == 0) {
Alert::set(Alert::ALERT, __('You do not have any purchase with support active.'));
$this->redirect(Route::url('oc-panel', array('controller' => 'support', 'action' => 'index')));
}
$this->template->bind('content', $content);
$this->template->content = View::factory('oc-panel/pages/support/new', array('orders' => $orders));
$content->errors = $errors;
}
开发者ID:alirezadamash,项目名称:open-eshop,代码行数:45,代码来源:support.php
示例17: action_pay
/**
*
* view affiliates and payments
*/
public function action_pay()
{
//create an order and mark it as paid to the user_id
if (is_numeric($this->request->param('id'))) {
//get the user
$user = new Model_User($this->request->param('id'));
if ($user->loaded()) {
//commissions due to pay
$query = DB::select(DB::expr('SUM(amount) total'))->from('affiliates')->where('id_user', '=', $user->id_user)->where('date_to_pay', '<', Date::unix2mysql())->where('status', '=', Model_Affiliate::STATUS_CREATED)->group_by('id_user')->execute();
$due_to_pay = $query->as_array();
$due_to_pay = isset($due_to_pay[0]['total']) ? $due_to_pay[0]['total'] : 0;
if ($due_to_pay > 0) {
//create the order
$order = new Model_Order();
$order->id_user = $user->id_user;
$order->amount = $due_to_pay * -1;
//we add the order as a negative, since we pay, we don't get paid.
$order->currency = 'USD';
$order->paymethod = 'paypal';
$order->pay_date = Date::unix2mysql();
$order->notes = 'Affiliate Commissions';
$order->status = Model_Order::STATUS_PAID;
try {
$order->save();
//update the commissions
DB::update('affiliates')->set(array('date_paid' => Date::unix2mysql(), 'status' => Model_Affiliate::STATUS_PAID, 'id_order_payment' => $order->id_order))->where('id_user', '=', $user->id_user)->where('date_to_pay', '<', Date::unix2mysql())->where('status', '=', Model_Affiliate::STATUS_CREATED)->execute();
Alert::set(Alert::SUCCESS, __('Commission Paid'));
} catch (Exception $e) {
}
}
}
}
$this->template->title = __('Affiliates Payments');
$query = DB::select(DB::expr('SUM(amount) total'))->select('id_user')->from('affiliates')->where('date_to_pay', '<', Date::unix2mysql())->where('status', '=', Model_Affiliate::STATUS_CREATED)->group_by('id_user')->having('total', '>=', core::config('affiliate.payment_min'))->execute();
$users_to_pay = $query->as_array('id_user');
$total_to_pay = 0;
foreach ($users_to_pay as $key => $value) {
$total_to_pay += $value['total'];
}
$users = new Model_User();
if (count($users_to_pay)) {
$users = $users->where('id_user', 'in', array_keys($users_to_pay))->where('status', '=', Model_User::STATUS_ACTIVE)->find_all();
}
$this->render('oc-panel/pages/affiliate/pay', array('users' => $users, 'total_to_pay' => $total_to_pay, 'users_to_pay' => $users_to_pay));
}
开发者ID:Ryanker,项目名称:open-eshop,代码行数:49,代码来源:affiliate.php
示例18: action_cashback_records
public function action_cashback_records()
{
$params = ['title' => '提现记录'];
$store = \Session::get('store');
$items = \Model_Order::query()->where(['store_id' => $store->id, 'cashback_status' => 0])->where('order_status', 'IN', ['FINISH', 'SELLER_SHIPPED', 'SECTION_FINISH'])->get();
$params['items'] = $items;
\View::set_global($params);
$this->template->content = \View::forge("{$this->theme}/finance/cashback_records");
}
开发者ID:wxl2012,项目名称:wx,代码行数:9,代码来源:finance.php
示例19: form_setup
/**
*
* formmanager definitions
*
*/
public function form_setup($form)
{
$form->fields['id_product']['display_as'] = 'select';
$form->fields['id_product']['options'] = array_keys(Model_Order::products());
$form->fields['valid_date']['attributes']['placeholder'] = 'yyyy-mm-dd';
$form->fields['valid_date']['attributes']['data-toggle'] = 'datepicker';
$form->fields['valid_date']['attributes']['data-date'] = '';
$form->fields['valid_date']['attributes']['data-date-format'] = 'yyyy-mm-dd';
}
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:14,代码来源:coupon.php
示例20: getDeliveryList
public function getDeliveryList()
{
$deliveryid_list = Session::get(self::DELIVERYID_LIST);
$deliverylist = array();
foreach ((array) $deliveryid_list as $idx => $deliveryid) {
$order = Model_Order::find($deliveryid);
$deliverylist[] = array('index' => $idx, 'orderid' => $deliveryid, 'address' => $order->destination);
}
return $deliverylist;
}
开发者ID:OICTH1,项目名称:DeliverySupport,代码行数:10,代码来源:staff.php
注:本文中的Model_Order类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论