This is a demo site for the Silverstripe E-commerce, developed by Sunny Side Up. It is based on the Silverstripe e-commerce project, but includes a bunch of advanced code. It has been created to showcase what you can do with e-commerce, to test and review features, and to promote our work.
Thank you Silverstripe Community for the Silverstripe foundation. A big kia ora also to all the developers who contributed to the Silverstripe E-commerce Project, especially Jeremy.
You can log-in as follows: shop@silverstripe-ecommerce.com / test123.
This site can reset itself so please go ahead and try whatever you want. At any time you can reset the shopping cart to start a new order. Also, make sure to open the cms (see login details above). If you have some feedback then please contact us. Sunny Side Up is also available for paid support.
You can install an identical copy of this site (including test data) on your own development server by checking out this SVN repository:
http://sunny.svnrepository.com/svn/sunny-side-up-general/ecommerce_test/.
Please log in (see above) to the the Git / SVN / Download page to fork / checkout / download the source code.
This demo is based on the Sunny Side Up Branch of e-commerce, as well as a buch of complementary modules.
Please review our latest data model
As part of this demo, we automatically add an order - as follows:
$order = new Order();
$order->UseShippingAddress = true;
$order->CustomerOrderNote = "THIS IS AN AUTO-GENERATED ORDER";
$order->write();
$member = new Member();
$member->FirstName = 'Tom';
$member->Surname = 'Cruize';
$member->Email = 'tom@silverstripe-ecommerce.com';
$member->Password = 'test123';
$member->write();
$order->MemberID = $member->ID;
$billingAddress = new BillingAddress();
$billingAddress->Prefix = "Dr";
$billingAddress->FirstName = "Tom";
$billingAddress->Surname = "Cruize";
$billingAddress->Address = "Lamp Drive";
$billingAddress->Address2 = "Linux Mountain";
$billingAddress->City = "Apache Town";
$billingAddress->PostalCode = "555";
$billingAddress->Country = "NZ";
$billingAddress->Phone = "555 5555555";
$billingAddress->MobilePhone = "444 44444";
$billingAddress->Email = "tom@silverstripe-ecommerce.com";
$billingAddress->write();
$order->BillingAddressID = $billingAddress->ID;
$shippingAddress = new ShippingAddress();
$shippingAddress->ShippingPrefix = "Dr";
$shippingAddress->ShippingFirstName = "Tom";
$shippingAddress->ShippingSurname = "Cruize";
$shippingAddress->ShippingAddress = "Lamp Drive";
$shippingAddress->ShippingAddress2 = "Linux Mountain";
$shippingAddress->ShippingCity = "Apache Town";
$shippingAddress->ShippingPostalCode = "555";
$shippingAddress->ShippingCountry = "NZ";
$shippingAddress->ShippingPhone = "555 5555555";
$shippingAddress->ShippingMobilePhone = "444 44444";
$shippingAddress->write();
$order->ShippingAddressID = $shippingAddress->ID;
//get a random product
$product = DataObject::get_one("Product");
$triedArray = array($product->ID);
$extension = "";
if(Versioned::current_stage() == "Live") {
$extension = "_Live";
}
$count = 0;
while($product && !$product->canPurchase() && $count < 50) {
$product = DataObject::get_one("Product", "\"ClassName\" = 'Product' AND \"Product{$extension}\".\"ID\" NOT IN (".implode(",", $triedArray).")");
if($product) {
$triedArray[] = $product->ID;
}
$count++;
}
//adding product order item
$item = new Product_OrderItem();
$item->addBuyableToOrderItem($product, 7);
$item->OrderID = $order->ID;
$item->write();
//final save
$order->write();
$order->tryToFinaliseOrder();
E-commerce allows you to access its model using the built-in Silverstripe API. This is great for communication with third party applications. Access examples are listed below:
For more information on the restful server API, you can visit the help documents on this topic. In the help documents you can read that potentially orders could also be created through third-party gateways.