当前位置: 首页>>代码示例>>PHP>>正文


PHP Model_Order::get_featured_price方法代码示例

本文整理汇总了PHP中Model_Order::get_featured_price方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Order::get_featured_price方法的具体用法?PHP Model_Order::get_featured_price怎么用?PHP Model_Order::get_featured_price使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model_Order的用法示例。


在下文中一共展示了Model_Order::get_featured_price方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_create

 public function action_create()
 {
     try {
         if (!is_numeric(core::request('id_ad')) or !is_numeric(core::request('id_product')) or !is_numeric(core::request('id_user'))) {
             $this->_error(__('Missing parameters'), 501);
         } else {
             $user = new Model_User(core::request('id_user'));
             $ad = new Model_Ad(core::request('id_ad'));
             if ($user->loaded() and $ad->loaded()) {
                 $id_product = core::request('id_product');
                 $amount = core::request('amount');
                 //in case not set by request
                 if (!is_numeric($amount)) {
                     //get original price for the product
                     switch ($id_product) {
                         case Model_Order::PRODUCT_CATEGORY:
                             $amount = $ad->category->price;
                             break;
                         case Model_Order::PRODUCT_TO_TOP:
                             $amount = core::config('payment.pay_to_go_on_top');
                             break;
                         case Model_Order::PRODUCT_TO_FEATURED:
                             $amount = Model_Order::get_featured_price(core::request('featured_days'));
                             break;
                         case Model_Order::PRODUCT_AD_SELL:
                             $amount = $ad->price;
                             break;
                         default:
                             $plan = new Model_Plan($id_product);
                             $amount = $plan->loaded() ? $plan->price : 0;
                             break;
                     }
                 }
                 $order = Model_Order::new_order($ad, $user, $id_product, $amount, core::request('currency'), Model_Order::product_desc(core::request('id_product')), core::request('featured_days'));
                 $order->confirm_payment(core::request('paymethod', 'API'), core::request('txn_id'));
                 $order->save();
                 $this->rest_output(array('order' => self::get_order_array($order)));
             } else {
                 $this->_error(__('User or Ad not loaded'), 501);
             }
         }
     } catch (Kohana_HTTP_Exception $khe) {
         $this->_error($khe);
     }
 }
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:45,代码来源:orders.php

示例2: original_price

 /**
  * returns the original price of the order
  * @return float 
  */
 public function original_price()
 {
     //get original price for the product
     switch ($this->id_product) {
         case self::PRODUCT_CATEGORY:
             $amount = $this->ad->category->price;
             break;
         case self::PRODUCT_TO_TOP:
             $amount = core::config('payment.pay_to_go_on_top');
             break;
         case self::PRODUCT_TO_FEATURED:
             $amount = Model_Order::get_featured_price($this->featured_days);
             break;
         case self::PRODUCT_AD_SELL:
             $amount = $this->ad->price;
             break;
     }
     return $amount;
 }
开发者ID:zhangkom,项目名称:openclassifieds2,代码行数:23,代码来源:order.php

示例3: array

            <?php 
    }
    ?>
        
            <?php 
    if (core::config('payment.to_featured') != FALSE and $widget->ad->featured < Date::unix2mysql()) {
        ?>
                <a class="btn btn-danger center-block" type="button" href="<?php 
        echo Route::url('default', array('action' => 'to_featured', 'controller' => 'ad', 'id' => $widget->ad->id_ad));
        ?>
">
                    <?php 
        echo _e('Go Featured!');
        ?>
 <?php 
        echo i18n::money_format(Model_Order::get_featured_price(), core::config('payment.paypal_currency'));
        ?>
                </a>
            <?php 
    }
    ?>
        
            <div class="clearfix"></div><br>
        
            <a class="btn btn-primary" href="<?php 
    echo Route::url('oc-panel', array('controller' => 'myads', 'action' => 'update', 'id' => $widget->ad->id_ad));
    ?>
">
                <i class="glyphicon glyphicon-edit"></i> <?php 
    echo _e("Edit");
    ?>
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:31,代码来源:widget_tools.php

示例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'));
     }
 }
开发者ID:nick-catanchin-ie,项目名称:openclassifieds2,代码行数:41,代码来源:ad.php

示例5: __

                <?if(core::config('payment.pay_to_go_on_top') > 0 && core::config('payment.to_top') != FALSE):?>
                    <p class="text-info"><?php 
echo __('Your Advertisement can go on top again! For only ') . i18n::format_currency(core::config('payment.pay_to_go_on_top'), core::config('payment.paypal_currency'));
?>
</p>
                    <a class="btn btn-xs btn-primary" type="button" href="<?php 
echo Route::url('default', array('action' => 'to_top', 'controller' => 'ad', 'id' => $ad->id_ad));
?>
"><?php 
echo __('Go Top!');
?>
</a>
                <?endif?>
                <?if(core::config('payment.to_featured') != FALSE AND $ad->featured < Date::unix2mysql()):?>
                    <p class="text-info"><?php 
echo __('Your Advertisement can go to featured! For only ') . i18n::format_currency(Model_Order::get_featured_price(), core::config('payment.paypal_currency'));
?>
</p>
                    <a class="btn btn-xs btn-primary" type="button" href="<?php 
echo Route::url('default', array('action' => 'to_featured', 'controller' => 'ad', 'id' => $ad->id_ad));
?>
"><?php 
echo __('Go Featured!');
?>
</a>
                <?endif?>
            </div>
        <?endif?>
    <?endif?>
    <!-- end paypal button -->
    
开发者ID:AndresGrams,项目名称:openclassifieds2,代码行数:30,代码来源:single.php

示例6: 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()) {
         //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'));
         }
         //update order based on the price and the amount of
         $days = core::get('featured_days');
         if (is_numeric($days) and ($price = Model_Order::get_featured_price($days)) !== FALSE) {
             $order->amount = $price;
             //get price from config
             $order->featured_days = $days;
             $order->save();
         }
         //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($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:AndresGrams,项目名称:openclassifieds2,代码行数:33,代码来源:ad.php


注:本文中的Model_Order::get_featured_price方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。