Live demo
Here you can find live demo of the Camera store sample application. This is the application we are going to build here.
Prerequisites
To follow along with this tutorial, you have to have:
- Active account in Tradenity
- Create the sample “Camera store”, and load the sample data (This option is available on the create store page).
- Have a working PHP development environment (PHP > 5.3 required)
- Basic familiarity with the Symfony framework.
Setup your credentials
First of all, you have to get API keys for your store, you can find it in your store Edit
page.
To get there navigate to the stores list page, click on the Edit
button next to your store name, scroll down till you find the API Keys
section.
Initialize the library
With the API key in hand, you can initialize the Tradenity client. Tradenity client needs the API key and an instance of AuthTokenHolder which is an object that makes Tradenity session integrates with the web framework’s session mechanism. The SDK provide implementation for Flask and Django and it’s easy to implement youe own
Make sure to replace the api keys with the ones for your store, otherwise you will get authentication error
Introducing CameraStore sample application
CameraStore application is a typical e-store web application, a web store for a camera shop.
The application code is placed into camerastore
package, which is divided into these modules
ShopController.php
: navigating the and browsing the store, the corresponding templates are in theapp/Resources/views/store
directory.CartController.php
: Shopping cart manipulation code. the corresponding templateapp/Resources/views/store
.AccountsController.php
,SessionsController.php
: login management and registering new customers. the corresponding templates are in theapp/Resources/views/accounts
directory.OrdersController.php
: placing new order, viewing list and details of customer’s past orders. the corresponding templates are in theapp/Resources/views/orders
directory.