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


PHP Cart::instance方法代码示例

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


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

示例1: gI

 public static function gI()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:Vladimir25,项目名称:marykay,代码行数:7,代码来源:Cart.php

示例2: getInstance

	/**
	 * Recupera a instância do carrinho.
	 * @return	Cart
	 */
	public static function getInstance() {
		if ( self::$instance == null ) {
			self::$instance = new Cart();
		}

		return self::$instance;
	}
开发者ID:netojoaobatista,项目名称:paypal-express-checkout-dg,代码行数:11,代码来源:Cart.php

示例3: before

 public function before()
 {
     if ($this->request->is_ajax()) {
         $this->auto_render = FALSE;
     }
     $this->cart = Cart::instance();
     parent::before();
 }
开发者ID:szymon7907,项目名称:kohana-shopping-cart,代码行数:8,代码来源:Cart.php

示例4: action_index

 public function action_index()
 {
     //$prd = array(array('id'=>1,'qty'=>1),array('id'=>4,'qty'=>3));
     //$v = Cart::instance()->delete()->set($prd)->get();
     //$v = Cart::instance()->delete()->set(1,2)->get();
     //var_export($v);
     $this->template->content = View::factory('cart');
     $this->template->cart = Cart::instance()->content;
 }
开发者ID:szymon7907,项目名称:kohana-shopping-cart,代码行数:9,代码来源:Cart.php

示例5: updateCart

 public function updateCart()
 {
     $_contentCart = Cart::instance('shopping')->content();
     foreach ($_contentCart as $row) {
         $_rowId = $row->rowid;
         Cart::instance('shopping')->update($_rowId, Input::get($_rowId));
     }
     return Redirect::to('qlmbasket')->with('_strTitle', 'Shopping Cart')->with('_strBannerTitle', 'Shopping Cart')->with('_strBannerDesc', 'Shopping Cart')->with('_strBannerImage', 'asserts/images/SecondPage/mainpage_label.jpg')->with('_strFaceTitle', 'Shopping Cart');
 }
开发者ID:ndmson,项目名称:Trade,代码行数:9,代码来源:ShoppingCartController.php

示例6: testGetProductIdFromCart

 /**
  * @return void
  */
 public function testGetProductIdFromCart()
 {
     $worker = \App::make('App\\Droit\\Shop\\Order\\Worker\\OrderWorkerInterface');
     \Cart::instance('newInstance');
     \Cart::add(55, 'Uno', 1, '12', array('weight' => 155));
     \Cart::add(55, 'Uno', 1, '12', array('weight' => 155));
     \Cart::add(56, 'Duo', 1, '34', array('weight' => 25));
     \Cart::add(57, 'tres', 1, '35', array('weight' => 125));
     $result = $worker->productIdFromCart();
     $this->assertEquals([55, 55, 56, 57], $result);
 }
开发者ID:abada,项目名称:webshop,代码行数:14,代码来源:OrderWorkerTest.php

示例7: createInvoice

 public function createInvoice()
 {
     try {
         $_invoice = new Invoices();
         $_invoice->firstName = Session::get('checkout.address')[0]['firstName'];
         $_invoice->lastName = Session::get('checkout.address')[0]['lastName'];
         $_invoice->companyname = Session::get('checkout.address')[0]['companyname'];
         $_invoice->email = Session::get('checkout.address')[0]['email'];
         $_invoice->country = Session::get('checkout.address')[0]['country'];
         $_invoice->state = Session::get('checkout.address')[0]['state'];
         $_invoice->street = Session::get('checkout.address')[0]['street'];
         $_invoice->zipcode = Session::get('checkout.address')[0]['zipcode'];
         $_invoice->telephone = Session::get('checkout.address')[0]['telephone'];
         $_invoice->comment = Session::get('checkout.address')[0]['comment'];
         $_invoice->invoiceCreater = Session::get('checkout.payment')[0]['payment'];
         $_invoice->invoiceCreatedDate = date("Y-m-d");
         $_itemsCount = Cart::instance('shopping')->count();
         $_contentCart = Cart::instance('shopping')->content();
         $_contentTotal = Cart::instance('shopping')->total() + Cart::instance('shopping')->total() * 10 / 100;
         $_calculateinvoice = $this->getinvoicenumber();
         $_invoice->invoice = $_calculateinvoice;
         $_invoice->save();
         foreach ($_contentCart as $row) {
             $_resultData = DB::table('qlm_printerdetails')->where('detailId', $row->id)->get();
             $_invoicedetails = new InvoiceDetails();
             $_invoicedetails->product = $row->name;
             $_invoicedetails->quantity = $row->qty;
             $_invoicedetails->unitprice = $row->price;
             $_invoicedetails->gst = $row->price * 10 / 100;
             $_invoicedetails->total = $row->price * $row->qty + $row->price * $row->qty * 10 / 100;
             $_invoicedetails->invoice = $_calculateinvoice;
             $_invoicedetails->save();
         }
     } catch (Exception $_ex) {
         Log::info("\$\$\$ --- Error: " . $_ex . " --- \$\$\$");
     }
 }
开发者ID:ndmson,项目名称:QLM,代码行数:37,代码来源:SendEmailController.php

示例8: formatMoney

function formatMoney($number, $fractional = false)
{
    $number = sprintf('%.2f', $number);
    while (true) {
        $replaced = preg_replace('/(-?\\d+)(\\d\\d\\d)/', '$1,$2', $number);
        if ($replaced != $number) {
            $number = $replaced;
        } else {
            break;
        }
    }
    return $number;
}
$_itemsCount = Cart::instance('shopping')->count();
$_contentCart = Cart::instance('shopping')->content();
$_contentTotal = Cart::instance('shopping')->total() + Cart::instance('shopping')->total() * 10 / 100;
?>

                         </td>
                     </tr>
               <tr>

</tr>

  </table>
             </td>
         </tr>
   </table>

    <table style="border-width: 1px;border-color: #f5f5f5;border-collapse: collapse;">
                                 <tr>
开发者ID:ndmson,项目名称:FINCH,代码行数:31,代码来源:cashondelivery.blade.php

示例9: getPaymentStatus

 public function getPaymentStatus()
 {
     try {
         // Get the payment ID before session clear
         $payment_id = Session::get('paypal_payment_id');
         // clear the session payment ID
         Session::forget('paypal_payment_id');
         if (empty(Input::get('PayerID')) || empty(Input::get('token'))) {
             return View::make('pages.shoppingcart')->with('error', 'Payment failed');
         }
         $payment = Payment::get($payment_id, $this->_api_context);
         // PaymentExecution object includes information necessary
         // to execute a PayPal account payment.
         // The payer_id is added to the request query parameters
         // when the user is redirected from paypal back to your site
         $execution = new PaymentExecution();
         $execution->setPayerId(Input::get('PayerID'));
         //Execute the payment
         $result = $payment->execute($execution, $this->_api_context);
         if ($result->getState() == 'approved') {
             // payment made
             Mail::send('emails.qlm.cashondelivery', ['firstName' => Session::get('checkout.address')[0]['firstName'], 'lastName' => Session::get('checkout.address')[0]['lastName'], 'companyname' => Session::get('checkout.address')[0]['companyname'], 'email' => Session::get('checkout.address')[0]['email'], 'country' => Session::get('checkout.address')[0]['country'], 'state' => Session::get('checkout.address')[0]['state'], 'street' => Session::get('checkout.address')[0]['street'], 'zipcode' => Session::get('checkout.address')[0]['zipcode'], 'telephone' => Session::get('checkout.address')[0]['telephone'], 'comment' => Session::get('checkout.address')[0]['comment']], function ($message) {
                 $message->to('marketing@qlmgroup.com')->cc(Session::get('checkout.address')[0]['email'], 'lindsay.nutley@qlmgroup.com')->bcc('lindsay.nutley@qlmgroup.com')->bcc('son.nguyen@qlmgroup.com')->subject('QLM Label Makers - Order from Shopping Cart(Paypal)');
                 // $message->attach($pathToFile);
             });
             Cart::instance('shopping')->destroy();
             Session::flush();
             return View::make('pages.shoppingcart')->with('success', 'Payment success - Please receive order confirmation via email.');
         }
         return View::make('pages.shoppingcart')->with('error', 'This transaction cannot be completed - Please check your card balance on Paypal or Contact Us');
     } catch (Exception $ex) {
         return View::make('pages.shoppingcart')->with('error', 'This transaction cannot be completed - Please check your card balance on Paypal or Contact Us');
     }
 }
开发者ID:ndmson,项目名称:QLM,代码行数:34,代码来源:PayPalController.php

示例10:

<?php

echo "order placed successfully";
Cart::instance('shopping')->destroy();
开发者ID:bhavs123,项目名称:web,代码行数:4,代码来源:response.blade.php

示例11: getInstance

 static function getInstance()
 {
     return self::$instance === null ? self::$instance = new self() : self::$instance;
 }
开发者ID:alex-zayats,项目名称:php_shop,代码行数:4,代码来源:cart.php

示例12: postPayment

 public function postPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     //==================== LIST ITEMS IN SHOPPING CART ========= //
     $_contentCart = Cart::instance('shopping')->content();
     $_itemsCount = Cart::instance('shopping')->count();
     $_arryItems = array();
     $_i = 0;
     foreach ($_contentCart as $row) {
         if ($_i < $_itemsCount) {
             $item = new Item();
             $item->setName($row->name)->setDescription($row->name)->setCurrency('USD')->setQuantity((double) $row->qty)->setTax((double) ($row->price * 10) / 100)->setPrice((double) $row->price);
             //$435.00
             $_arryItems[$_i] = $item;
             $_i++;
         }
     }
     $item_list = new ItemList();
     $item_list->setItems(array($_arryItems));
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems($_arryItems);
     //==================== LIST ITEMS IN SHOPPING CART ========= //
     $details = new Details();
     $details->setShipping("0")->setTax((string) (Cart::instance('shopping')->total() * 10) / 100)->setSubtotal((string) Cart::instance('shopping')->total());
     $amount = new Amount();
     $amount->setCurrency("USD")->setTotal((string) Cart::instance('shopping')->total() + Cart::instance('shopping')->total() * 10 / 100)->setDetails($details);
     // ### Transaction
     // A transaction defines the contract of a
     // payment - what is the payment for and who
     // is fulfilling it. Transaction is created with
     // a `Payee` and `Amount` types
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (PayPal\Exception\PayPalConnectionException $ex) {
         echo $ex->getCode();
         // Prints the Error Code
         echo $ex->getData();
         // Prints the detailed error message
         die($ex);
     } catch (Exception $ex) {
         die($ex);
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return View::make('pages.home');
 }
开发者ID:ndmson,项目名称:Trade,代码行数:64,代码来源:PayPalController.php

示例13: testCalculPriceWithFirstAndSecondCoupon

 /**
  * @return void
  */
 public function testCalculPriceWithFirstAndSecondCoupon()
 {
     $worker = \App::make('App\\Droit\\Shop\\Cart\\Worker\\CartWorkerInterface');
     $oneproduct = factory(App\Droit\Shop\Product\Entities\Product::class)->make();
     $onecoupon = factory(App\Droit\Shop\Coupon\Entities\Coupon::class, 'one')->make();
     \Cart::instance('newInstance');
     // Has to match the factory product
     \Cart::add(100, 'Dos', 1, '10.00', array('weight' => 600));
     $this->coupon->shouldReceive('findByTitle')->once()->andReturn($onecoupon);
     $this->product->shouldReceive('find')->twice()->andReturn($oneproduct);
     $worker->setCoupon($onecoupon->title)->applyCoupon();
     // Product price => 10.00
     // Coupon for product value 10%
     $this->assertEquals(9, \Cart::total());
     // Add free shipping later for example via admin
     $this->withSession(['noShipping']);
     $worker->setShipping();
     $this->assertEquals(0, $worker->orderShipping->price);
 }
开发者ID:abada,项目名称:webshop,代码行数:22,代码来源:CartWorkerTest.php

示例14: getCartSumm

 public function getCartSumm()
 {
     $locale = Limb::toolkit()->getLocale();
     return number_format(Cart::instance()->getTotalSumm(), $locale->fract_digits, $locale->decimal_symbol, $locale->thousand_separator);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:5,代码来源:CartSummComponent.class.php

示例15: testInstance

 function testInstance()
 {
     $this->assertTrue(Cart::instance(10) === Cart::instance(10));
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:4,代码来源:CartTest.class.php


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