sulu / product-base-bundle
The Sulu Bundle for managing products
Installs: 1 351
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 27
Forks: 8
Type:sulu-bundle
Requires
- php: >=5.4
- doctrine/orm: 2.5.*
- jackalope/jackalope-doctrine-dbal: ~1.2.0
- jackalope/jackalope-jackrabbit: ~1.2.0
- oro/doctrine-extensions: 1.0.*
- sulu/sulu: ~1.3
- sulu/validation-bundle: ~0.1
- symfony-cmf/routing-bundle: 1.2.*
- willdurand/hateoas-bundle: >=0.3
Requires (Dev)
- evenement/evenement: 2.0.0 as 1.0.0
- phpunit/phpunit: ~4.0.0
- sensio/framework-extra-bundle: ~3.0
- sulu/sulu: ~1.4
- symfony-cmf/testing: ~1.2
- symfony/monolog-bundle: 2.4.*
- symfony/symfony: 2.8.*
- zendframework/zendsearch: @dev
- dev-develop
- 0.17.6
- 0.17.5
- 0.17.4
- 0.17.3
- 0.17.2
- 0.17.1
- 0.17.0
- 0.16.7
- 0.16.6
- 0.16.5
- 0.16.4
- 0.16.3
- 0.16.2
- 0.16.1
- 0.16.0
- 0.15.2
- 0.15.1
- 0.15.0
- 0.14.0
- 0.13.1
- 0.13.0
- 0.12.6
- 0.12.5
- 0.12.4
- 0.12.3
- 0.12.2
- 0.12.1
- 0.12.0
- 0.11.0
- 0.10.7
- 0.10.6
- 0.10.5
- 0.10.4
- 0.10.3
- 0.10.2
- 0.10.1
- 0.9.9
- 0.9.8
- 0.9.7
- 0.9.6
- 0.9.5
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.17
- 0.8.16
- 0.8.15
- 0.8.14
- 0.8.13
- 0.8.12
- 0.8.11
- 0.8.10
- 0.8.9
- 0.8.8
- 0.8.7
- 0.8.6
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.1
- 0.7
- 0.6.10
- 0.6.9
- 0.6.8
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.2
- 0.3.1
- 0.2.1
- 0.2.0
- 0.1.0
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-master
- dev-feature/sulu-1.6
- dev-release/0.16
- dev-release/0.15
- dev-feature/product-mapper
- dev-feature/preview
- dev-feature/seo-tab
- dev-release/0.13.1
- dev-release/0.9
- dev-hotfix/0.9.8
- dev-feature/pricing
- dev-feature/unsaved-changes-handling
- dev-feature/product-sets
This package is not auto-updated.
Last update: 2022-02-01 13:16:03 UTC
README
Dependencies
Sulu:
This version of product-bundle will only work with sulu version >= 1.3
.
If you use an older sulu version please use product-bundle version
~0.16
.
Installation
Add the following to composer.json
"sulu/product-bundle": "~0.16"
Add the following to your application kernel:
// Product bundle
new Sulu\Bundle\ProductBundle\SuluProductBundle(),
new Sulu\Bundle\ValidationBundle\SuluValidationBundle(),
Add the following to your admin/routing.yml
:
# Sulu Product Bundle
sulu_product:
resource: "@SuluProductBundle/Resources/config/routing.yml"
prefix: /admin/product
sulu_product_api:
type: rest
resource: "@SuluProductBundle/Resources/config/routing_api.yml"
prefix: /admin/api
Configuration
Sample configuration:
sulu_route:
mappings:
Sulu\Bundle\ProductBundle\Entity\ProductTranslation:
generator: schema
options:
route_schema: /products/{object.getName()}
sulu_product:
category_root_key: ~
default_currency: 'EUR'
default_formatter_locale: 'en'
display_recurring_prices: true
fallback_locale: de
fixtures:
attributes:
- src/Acme/Bundle/ProductBundle/DataFixtures/attributes.xml
locales:
- de
- en
objects:
product:
model: Acme\Bundle\ProductBundle\Entity\Product
repository: Acme\Bundle\ProductBundle\Entity\ProductRepository
template: AcmeShopBundle:views:templates/productdetail.html.twig
Note: If you use Sulu 1.3.*
routing has to be defined as follows:
sulu_route:
mappings:
Sulu\Bundle\ProductBundle\Entity\ProductTranslation:
route_schema: /products/{object.getName()}
Localization
Multiple locales for managing products can be defined in the config. If non defined, 'en' is taken as default.
If the users language matches any of the given locales, that one is
displayed in the admin area. Otherwise the fallback_locale
parameter
is used.
Custom Routing
You can define custom routes by defining the sulu_route.mappings
parameter for ProductTranslation
entity.
Then you can specify the sulu_product.template
parameter to define
which template is shown when route is called.
To update routes for existing products, simply call
var/console sulu:route:update SuluProductBundle:ProductTranslation --batch-size 1
How the routing mechanism works
When creating a new product translation a new route is created. You then can change the route's path in the content tab.
The following properties are available when defining a route:
object
(ProductTranslation)product
(Api/Product) and of coursetranslator
Recurring prices
The property recurring prices can be disabled via parameter
display_recurring_prices
. This option hides the UI elements for
recurring prices.
Custom Entity and Repository
If you'd like to overwrite the sulu product entity you simply need to
set the objects.product
parameters.
Shop templates
For shop purposes template
can be used to define the template for
displaying product details.
Attribute Fixtures
You can write multiple attribute fixture files and define the path of your xmls in your config (as seen in the example above)
Example XML
<attributes> <attribute> <key>example.key</key> <type>1</type> <names> <name locale="en">English Attribute</name> <name locale="de">German Attribute</name> </names> <values> <value> <name locale="de">German Value 1</name> <name locale="en">English Value 1</name> </value> <value> <name locale="de">German Value 2</name> <name locale="en">English Value 2</name> </value> </values> </attribute> </attributes>
Content type 'product'
<property name="product" type="product" mandatory="true"> <meta> <title lang="de">Produkt</title> <title lang="en">Product</title> </meta> </property>
API Documentation
The following api's have been documented: Product Addon Api Product Variant Api
Developer Documentation
The sulu product developer documentation can be found here: Developer Documentation