PHPackages                             bestit/commercetools-customer-prices-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. bestit/commercetools-customer-prices-bundle

ActiveLib[Database &amp; ORM](/categories/database)

bestit/commercetools-customer-prices-bundle
===========================================

Provides a commercetools substitute with custom objects to get customer individual prices.

0.5.3(7y ago)16.7kMITPHPPHP ^7.0

Since Oct 5Pushed 7y ago2 watchersCompare

[ Source](https://github.com/bestit/symfony-commercetools-customer-prices-bundle)[ Packagist](https://packagist.org/packages/bestit/commercetools-customer-prices-bundle)[ RSS](/packages/bestit-commercetools-customer-prices-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (10)Versions (10)Used By (0)

bestit/commercetools-customer-prices-bundle
===========================================

[](#bestitcommercetools-customer-prices-bundle)

There is no real support for individual customer prices in the the commercetools platform at this moment. You could try to add a lot of "channel prices" for your products, but you will hit some topics like a missing fallback in the search facets for the [scopedPrice](https://dev.commercetools.com/http-api-projects-products-search.html#filter-by-scoped-price) (no fallback to the normal price, if a channel price is missing), performance losses because of huge product data sets and maybe you hit rock bottom with the maximum document size of the database itself.

So you need a substitute. This bundle will provide you with a substitute based on custom objects like

```
{
    "id": "UUID",
    "version": 1,
    "container": "YOUR-CONTAINER-NAME",
    "key": "KEY-1-2",
    "value": {
        "price": {
            "value": {
                "centAmount": 5000,
                "currencyCode": "EUR"
            },
            "tiers": [
                {
                    "minimumQuantity": 10,
                    "value": {
                        "centAmount": 4000,
                        "currencyCode": "EUR"
                    }
                },
                {
                    "minimumQuantity": 20,
                    "value": {
                        "centAmount": 3000,
                        "currencyCode": "EUR"
                    }
                },
               {
                    "minimumQuantity": 30,
                    "value": {
                        "centAmount": 2000,
                        "currencyCode": "EUR"
                    }
                }
            ]
        },
        "customer": "1",
        "article": "2",
        "currency": "EUR"
    },
    "createdAt": "2017-08-04T06:51:44.642Z",
    "lastModifiedAt": "2017-08-14T00:04:08.763Z"
}
```

You can configure the field names for the container, price value, article and customer value!

API
---

[](#api)

You can inject/use the service **best\_it\_ct\_customer\_prices.model.customer\_price\_collection** to fetch your price with **BestIt\\CtCustomerPricesBundle\\Model\\CustomerPriceCollection::getByArticle(string $articleId)**. $articleId needs to match the data out of your custom object.

The lazy loaded service **best\_it\_ct\_customer\_prices.model.customer\_price\_collection** is "created" with a factory, which takes the authed User out of the \[Security Token Storage\](.com/blog/new-in-symfony-2-6-security-component-improvements).

Installation
------------

[](#installation)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require bestit/commercetools-customer-prices-bundle
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `app/AppKernel.php` file of your project:

```
