當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ShoppingCart::add_item_link方法代碼示例

本文整理匯總了PHP中ShoppingCart::add_item_link方法的典型用法代碼示例。如果您正苦於以下問題:PHP ShoppingCart::add_item_link方法的具體用法?PHP ShoppingCart::add_item_link怎麽用?PHP ShoppingCart::add_item_link使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ShoppingCart的用法示例。


在下文中一共展示了ShoppingCart::add_item_link方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCalculations

 function testCalculations()
 {
     $mp3player = $this->objFromFixture('Product', 'mp3player');
     $this->get(ShoppingCart::add_item_link($mp3player->ID));
     $cart = ShoppingCart::current_order();
     $this->assertEquals($cart->Total(), 215);
 }
開發者ID:riddler7,項目名稱:silverstripe-ecommerce,代碼行數:7,代碼來源:FlatTaxModifierTest.php

示例2: testProductVersionDoesntChangeInOrder

 function testProductVersionDoesntChangeInOrder()
 {
     $productSocks = $this->objFromFixture('Product', 'socks');
     //add item to cart
     $this->get(ShoppingCart::add_item_link($productSocks->ID));
     $currentorder = ShoppingCart::current_order();
     $itembefore = DataObject::get_one("Product_OrderItem", "\"OrderID\" = " . $currentorder->ID);
     $this->assertEquals($itembefore->Total(), 8);
     //update product details
     $productSocks->Price = 9;
     $productSocks->write();
     $this->assertEquals($itembefore->Total(), 9);
     //total is updated whilst item is still in cart
     //check cart product details are not updated
     //place order
     //update product details
     //check order details are not updated
 }
開發者ID:riddler7,項目名稱:silverstripe-ecommerce,代碼行數:18,代碼來源:ProductOrderItemTest.php

示例3: testRemoveFromCart

 function testRemoveFromCart()
 {
     /* Retrieve the product to compare from fixture */
     $product = $this->objFromFixture('Product', 'mp3player');
     $anotherproduct = $this->objFromFixture('Product', 'tshirt');
     /* add items via url */
     $this->get(ShoppingCart::set_quantity_item_link($product->ID, $product->class) . "?quantity=5");
     $this->get(ShoppingCart::add_item_link($anotherproduct->ID, $product->class));
     /* remove items via url */
     $this->get(ShoppingCart::remove_item_link($product->ID, $product->class));
     $this->get(ShoppingCart::remove_item_link($anotherproduct->ID, $product->class));
     $items = ShoppingCart::get_items();
     $this->assertEquals($items->Count(), 1, 'There is 1 item in the cart');
     $this->assertEquals($items->First()->Quantity, 4, 'We have 4 mp3 players in the cart.');
     ShoppingCart::clear();
     //test clearing cart
     $this->assertEquals(ShoppingCart::get_items(), null, 'Cart is clear');
     //items is a databoject set, and will therefore be null when cart is empty.
     //TODO: remove item not in cart - insanity check
 }
開發者ID:nieku,項目名稱:silverstripe-ecommerce,代碼行數:20,代碼來源:ShoppingCartTest.php

示例4: IncrementLink

 function IncrementLink()
 {
     $varid = $this->item instanceof ProductVariation_OrderItem ? $this->item->ProductVariationID : null;
     return Convert::raw2att(ShoppingCart::add_item_link($this->item->getProductIDForSerialization(), $varid, $this->parameters));
 }
開發者ID:riddler7,項目名稱:silverstripe-ecommerce,代碼行數:5,代碼來源:EcomQuantityField.php

示例5: addLink

 function addLink()
 {
     return ShoppingCart::add_item_link($this->_productID, $this->_productVariationID);
 }
開發者ID:riddler7,項目名稱:silverstripe-ecommerce,代碼行數:4,代碼來源:ProductVariation.php

示例6: addLink

 function addLink()
 {
     return ShoppingCart::add_item_link($this->_productID, null, $this->linkParameters());
 }
開發者ID:riddler7,項目名稱:silverstripe-ecommerce,代碼行數:4,代碼來源:Product.php

示例7: testNoMemberOrder

 function testNoMemberOrder()
 {
     //TODO: test configuration that deines non-member orders
     //adjust configuration to allow non member orders
     OrderForm::set_user_membership_optional(true);
     OrderForm::set_force_membership(false);
     $socks = $this->objFromFixture('Product', 'socks');
     $this->get(ShoppingCart::add_item_link($socks->ID));
     //add a different product
     $cart = ShoppingCart::current_order();
     $this->placeOrder('Donald', 'Duck', 'donald@pondcorp.edu.za', '4 The Strand', null, 'Melbourne', null, 'AU');
     $order = DataObject::get_by_id('Order', $cart->ID);
     $this->assertNotNull($order, 'Order exists');
     if ($order) {
         $this->assertEquals($order->Status, 'Unpaid', 'status is now "unpaid"');
         $this->assertEquals($order->MemberID, 0, 'No associated member');
         $this->assertEquals($order->Total(), 8, 'grand total');
         $this->assertEquals($order->TotalOutstanding(), 8, 'total outstanding');
         $this->assertEquals($order->TotalPaid(), 0, 'total outstanding');
         $this->assertEquals($order->FirstName, 'Donald', 'order first name');
         $this->assertEquals($order->Surname, 'Duck', 'order surname');
         $this->assertEquals($order->Email, 'donald@pondcorp.edu.za', 'order email');
         $this->assertEquals($order->Address, '4 The Strand');
         $this->assertNull($order->AddressLine2, 'order address2');
         $this->assertEquals($order->City, 'Melbourne', 'order city');
         $this->assertNull($order->PostalCode, 'order postcode');
         $this->assertEquals($order->Country, 'AU', 'order country');
     }
     ShoppingCart::clear();
     //cleanup
 }
開發者ID:riddler7,項目名稱:silverstripe-ecommerce,代碼行數:31,代碼來源:OrderTest.php


注:本文中的ShoppingCart::add_item_link方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。