DivanteLtd / coreshop-vsbridge

CoreShop Vue Storefront integration - first Progressive Web App (PWA) framework for Pimcore
https://vuestorefront.io
MIT License
74 stars 25 forks source link

feature: allow repositories to be store aware #50

Closed ghost closed 3 years ago

ghost commented 3 years ago

This PR will allow repositories to be store aware and only add objects to the elastic index if they are available in the provided store.

This feature gets enabled by setting the store_aware configuration to true, which is false by default. The name of the coreshop store has to be the same as the store key in the yml configuration to be able to find the store with the StoreRepository.

core_shop2_vue_storefront:
  elasticsearch:
    hosts:
      - elasticsearch
    index: vue_{store}_{language}
  store_aware: true
  stores:
    at:
      languages:
        - de
        - en

Repositories have to implement the StoreAwareRepositoryInterface and the corresponding addStoreCondition function, which the added ProductRepository and CategoryRepository do by default.