11# Quick-start
22
3+ * [ Pre-requisites] ( #pre-requisites )
4+ * [ Create a basic page] ( #create-a-basic-page )
5+ * [ Install ExampleBundle] ( #examplebundle )
6+ * [ Import sample data] ( #sample-data )
7+ * [ Preview in browser] ( #preview-in-browser )
8+
39### Pre-requisites
410
511* You have successfully completed the Installation step and verified that everything works fine.
@@ -74,6 +80,83 @@ class DefaultController extends AbstractController
7480{% endblock %}
7581` ` `
7682
83+ # # ExampleBundle
84+
85+ You may enable ExampleBundle to have a running instance of the Sunrise sample e-shop. It
86+ resembles an e-shop demonstrating sample data, templates and functionalities.
87+
88+ * run `composer require symfony/asset symfony/translation`
89+ * enable all commercetools bundles in `config/bundles.php`
90+ ` ` ` php
91+ return [
92+ ...
93+ Commercetools\S ymfony\C tpBundle\C tpBundle::class => ['all' => true],
94+ Commercetools\S ymfony\S hoppingListBundle\S hoppingListBundle::class => ['all' => true],
95+ Commercetools\S ymfony\C artBundle\C artBundle::class => ['all' => true],
96+ Commercetools\S ymfony\C ustomerBundle\C ustomerBundle::class => ['all' => true],
97+ Commercetools\S ymfony\R eviewBundle\R eviewBundle::class => ['all' => true],
98+ Commercetools\S ymfony\C atalogBundle\C atalogBundle::class => ['all' => true],
99+ Commercetools\S ymfony\E xampleBundle\E xampleBundle::class => ['all' => true],
100+ Commercetools\S ymfony\S etupBundle\S etupBundle::class => ['all' => true],
101+ Commercetools\S ymfony\S tateBundle\S tateBundle::class => ['all' => true],
102+ ...
103+ ];
104+ ` ` `
105+ * import the ExampleBundle routes in `config/routes.yaml`
106+ ` ` ` yaml
107+ _example:
108+ resource: "@ExampleBundle/Resources/config/routing.yml"
109+ ` ` `
110+
111+ * enable user/customer management and authentication to be managed by commercetools
112+ by editing `congig/packages/security.yaml` as :
113+ ` ` ` yaml
114+ security:
115+ providers:
116+ ctp:
117+ id: Commercetools\S ymfony\C ustomerBundle\S ecurity\User\User Provider
118+ access_control:
119+ - { path: /user/, roles: ROLE_USER }
120+ encoders:
121+ Symfony\C omponent\S ecurity\C ore\User\User : plaintext
122+ Commercetools\S ymfony\C ustomerBundle\S ecurity\User\User : plaintext
123+ firewalls:
124+ main:
125+ anonymous: ~
126+ commercetools-login:
127+ login_path: login
128+ check_path: login_check
129+ default_target_path: _ctp_example_index
130+ logout:
131+ path: logout
132+ target: _ctp_example_index
133+ dev:
134+ pattern: ^/(_(profiler|wdt)|css|images|js)/
135+ security: false
136+ default:
137+ anonymous: ~
138+ ` ` `
139+ * note: to disable errors on undefined twig variables change in `config/packages/twig.yaml`. This is
140+ because right now there are undefined variables in the Sunrise templates. This setting should and it is
141+ recommended to be back to it's original value for any real world scenario.
142+ ` ` ` yaml
143+ twig:
144+ strict_variables: false
145+ ` ` `
146+
147+ * recreate the translation messages by running:
148+ ` bin/console translation:update --dump-messages --force en ExampleBundle`
149+
150+ # # Sample Data
151+
152+ * At this point no data is inserted in the shop which will result to your sample e-shop be
153+ more or less empty and no sample products/categories/etc
154+ will be demonstrated. To import the sample Sunrise data please follow the procedure
155+ [here](https://github.com/commercetools/commercetools-sunrise-data/). You may run this importer
156+ in a repository other than the one you currently work at, since you will not need any of it
157+ after running it once on your project.
158+
159+
77160
78161# # Preview in browser
79162
@@ -86,5 +169,3 @@ created your project in commercetools, you will have to manually add some produc
86169the list will be empty. If you, manually added some products and your locale was not `en`,
87170you should change the parameter `en` used in the `DefaultController` above, to match the
88171locale that you used in your products.
89-
90-
0 commit comments