Question? Bug? Feature request? Feedback? Please don’t hesitate to open an issue - I will get back to you asap!
This bundle is a base to build a Symfony2 ecommerce application. It focuses on solutions with a high degree of customization. It’s a toolset to implement your own business and application logic. If you’re looking for a 'out of the box' webshop you should rather choose a different solution like Sylius or Vespolina. It takes care of persistence and you can optionally use the RESTful controllers for the products and the cart. You write your own product handler (or several ones if your project requires it) which defines the product properties (as many as you want and translatable without having to update the database thanks to PHPCR), product options, cart item validation and product availability. You can hook into all different kinds of events to adapt the provided application flow to your needs.
! Work in progress - Not Ready for Production Use !
It currently doesn’t provide a default product handler so you have to write your own. I haven’t decided yet whether to provide a default one or just create a tutorial for that (just look at the ecommerce-sandbox for now). For simplicity reasons it currently contains features which are not needed by everyone (like e.g. translatable product properties, a REST controller). They will be extracted to seperate libraries or bundles in the future.
The first webshop based on this bundle is ready to launch. The shop allows users to rent different kinds of products (using a custom availability check for a product in different sizes and a different rental durations) and buy other items.
Use the tag ecommmerce.product_handler
to register your product handler.
Products (Ecommerce\Bundle\CoreBundle\Doctrine\Phpcr\Product) are stored in PHPCR but a simple ProductReference (Ecommerce\Bundle\CoreBundle\Doctrine\Orm\ProductReference) entity is stored in ORM so it can be associated with a CartItem (Ecommerce\Bundle\CoreBundle\Doctrine\Orm\CartItem). The Cart (Ecommerce\Bundle\CoreBundle\Doctrine\Orm\CartItem) entity is very basic for now but will be updated soon to include subtotals, discounts, tax information etc.
To create a form type for a product use the
Ecommerce\Bundle\CoreBundle\Product\Form\DataMapper\ProductDataMapper as the DataMapper ($builder->setDataMapper(new ProductDataMapper());
in the buildForm
method) and the ecommerce_type_translated_property
form type for product properties that should be translatable. Those properties can then be rendered using the twig function translate_property(product, property)
.
php composer.phar require ecommerce/core-bundle:dev-master
Add the following lines to app/AppKernel.php
(assuming your project already includes the bundles from Symfony Framework Standard Edition):
new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
new Ecommerce\Bundle\CoreBundle\EcommerceCoreBundle(),
Add
AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php');
before return $loader;
in app/autoload.php
.
Update the database by running (not recommended for production):
php app/console doctrine:phpcr:init:dbal
php app/console doctrine:phpcr:workspace:create default
php app/console doctrine:phpcr:repository:init
php app/console doctrine:schema:update --force
You can check out the ecommerce-sandbox to see how it should look like.
Feel free to open an issue for any feature request!
This bundle is under the MIT license. See the complete license in the bundle:
Please note that it requires other libraries to run (see Packagist) and not all of them are MIT-licensed (like Apache 2.0).