本文整理汇总了PHP中Model_Order::get_featured_plans方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Order::get_featured_plans方法的具体用法?PHP Model_Order::get_featured_plans怎么用?PHP Model_Order::get_featured_plans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Order
的用法示例。
在下文中一共展示了Model_Order::get_featured_plans方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: to_feature
/**
* features an advertisement
* @param $days days to be featured
* @return void
*/
public function to_feature($days = NULL)
{
if ($this->loaded()) {
if (!is_numeric($days)) {
$plans = Model_Order::get_featured_plans();
$days = array_keys($plans);
$days = reset($days);
}
$this->featured = Date::unix2mysql(time() + $days * 24 * 60 * 60);
try {
$this->save();
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
}
}
示例2: action_payment
/**
* Payment deatails and paypal configuration can be configured here
* @return [view] Renders view with form inputs
*/
public function action_payment()
{
//delete featured plan
if (is_numeric(Core::get('delete_plan'))) {
Model_Order::delete_featured_plan(Core::get('delete_plan'));
$this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment')));
}
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Payments')));
$this->template->title = __('Payments');
// all form config values
$paymentconf = new Model_Config();
$config = $paymentconf->where('group_name', '=', 'payment')->find_all();
// save only changed values
if ($this->request->post()) {
if (is_numeric(Core::request('featured_days')) and is_numeric(Core::request('featured_price'))) {
Model_Order::set_featured_plan(Core::request('featured_days'), Core::request('featured_price'), Core::request('featured_days_key'));
Alert::set(Alert::SUCCESS, __('Featured plan updated'));
$this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment')));
}
$validation = Validation::factory($this->request->post())->rule('pay_to_go_on_top', 'not_empty')->rule('pay_to_go_on_top', 'numeric')->rule('stripe_appfee', 'numeric')->rule('stripe_appfee', 'range', array(':value', 0, 100))->rule('to_featured', 'range', array(':value', 0, 1))->rule('to_top', 'range', array(':value', 0, 1))->rule('sandbox', 'range', array(':value', 0, 1))->rule('paypal_seller', 'range', array(':value', 0, 1))->rule('stock', 'range', array(':value', 0, 1))->rule('authorize_sandbox', 'range', array(':value', 0, 1))->rule('stripe_address', 'range', array(':value', 0, 1));
//not updatable fields
$do_nothing = array('featured_days', 'pay_to_go_on_feature', 'featured_plans');
if ($validation->check()) {
foreach ($config as $c) {
$config_res = $this->request->post($c->config_key);
if (!in_array($c->config_key, $do_nothing) and $config_res != $c->config_value) {
if ($c->config_key == 'pay_to_go_on_top') {
$config_res = str_replace(',', '.', $config_res);
}
$c->config_value = $config_res;
try {
$c->save();
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
}
}
} else {
$errors = $validation->errors('config');
foreach ($errors as $error) {
Alert::set(Alert::ALERT, $error);
}
$this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment')));
}
Alert::set(Alert::SUCCESS, __('Payments Configuration updated'));
$this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment')));
}
$pages = array('' => __('Deactivated'));
foreach (Model_Content::get_pages() as $key => $value) {
$pages[$value->seotitle] = $value->title;
}
$this->template->content = View::factory('oc-panel/pages/settings/payment', array('config' => $config, 'pages' => $pages, 'featured_plans' => Model_Order::get_featured_plans()));
}
示例3: __
if ($order->id_product == Model_Order::PRODUCT_TO_FEATURED) {
?>
<?php
echo $order->featured_days;
?>
<?php
echo __('Days');
?>
<?php
}
?>
)
</em>
<div class="dropdown" style="display:inline-block;">
<?php
if ($order->id_product == Model_Order::PRODUCT_TO_FEATURED and is_array($featured_plans = Model_Order::get_featured_plans()) and count($featured_plans) > 1) {
?>
<button class="btn btn-xs btn-info dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
<?php
echo __('Change plan');
?>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<?php
foreach ($featured_plans as $days => $price) {
?>
<?php
if ($order->featured_days != $days) {
?>
示例4: action_to_featured
/**
* [action_to_featured] [pay to go in featured]
*
*/
public function action_to_featured()
{
//check pay to featured top is enabled
if (core::config('payment.to_featured') == FALSE) {
throw HTTP_Exception::factory(404, __('Page not found'));
}
$id_product = Model_Order::PRODUCT_TO_FEATURED;
//check ad exists
$id_ad = $this->request->param('id');
//how many days
if (!is_numeric($days = Core::request('featured_days'))) {
$plans = Model_Order::get_featured_plans();
$days = array_keys($plans);
$days = reset($days);
}
//get price for the days
$amount = Model_Order::get_featured_price($days);
$ad = new Model_Ad($id_ad);
if ($ad->loaded()) {
//case when payment is set to 0,gets featured for free...
if ($amount <= 0) {
$ad->featured = Date::unix2mysql(time() + $days * 24 * 60 * 60);
try {
$ad->save();
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
$this->redirect(Route::url('list'));
}
$currency = core::config('payment.paypal_currency');
$order = Model_Order::new_order($ad, $ad->user, $id_product, $amount, $currency, NULL, $days);
// redirect to payment
$this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
} else {
throw HTTP_Exception::factory(404, __('Page not found'));
}
}
示例5: __
<em>(<?php
echo Model_Order::product_desc($order->id_product);
?>
<?if ($order->id_product == Model_Order::PRODUCT_TO_FEATURED):?>
<?php
echo $order->featured_days;
?>
<?php
echo __('Days');
?>
<?endif?>
)
</em>
<div class="dropdown" style="display:inline-block;">
<?if ($order->id_product == Model_Order::PRODUCT_TO_FEATURED AND is_array($featured_plans=Model_Order::get_featured_plans()) AND count($featured_plans) > 1):?>
<button class="btn btn-xs btn-info dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
<?php
echo __('Change plan');
?>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<?foreach ($featured_plans as $days => $price):?>
<?if ($order->featured_days != $days):?>
<li>
<a href="<?php
echo Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order));
?>
?featured_days=<?php