Giter VIP home page Giter VIP logo

suluproductbundle's Introduction

SuluProductBundle Build Status StyleCI

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 course
  • translator

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

suluproductbundle's People

Contributors

alexander-schranz avatar apoorva-shah avatar chirimoya avatar christianbader avatar danrot avatar dantleech avatar mob8607 avatar notsure avatar raphaelhofer avatar sabinebaer avatar stemod avatar trickreich avatar turbo-ele avatar wachterjohannes avatar wynny avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.