Hi everyone , Can anyone please suggest me how can we create Store in Spryker b2c shop and get all s

Posts: 30 🧑🏻‍🚀 - Cadet
edited June 2023 in Spryker Development

Hi everyone ,
Can anyone please suggest me how can we create Store in Spryker b2c shop and get all store list available there

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer
    Store::getInstance()->getInactiveStores()
    
  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    This will return all store names except the current one.

  • Posts: 30 🧑🏻‍🚀 - Cadet

    the Store where it define name space for it

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    Can you please ask a complete question? I'm not able to get what you are asking for

  • Posts: 30 🧑🏻‍🚀 - Cadet

    in this Store::getInstance()->getInactiveStores() we are using Store class function so i have to include or use that class at top of my file so i have to provide path for that so what path i have to give

  • Posts: 30 🧑🏻‍🚀 - Cadet

    one more doubt is it necessary to define or create a Code Bucket for creating a store

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    Spryker\Shared\Kernel\Store

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    Have a look at \SprykerConfig\CodeBucketConfig::getCodeBuckets this automatically assumes that all your configured stores are a valid code bucket.

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    To answer your question, no it's not necessary to define a code bucket to create a store.

  • Posts: 30 🧑🏻‍🚀 - Cadet
    1. Configure installation recipes
      Add the new stores to the installation recipes in config/install/* as follows:

    HowTo: Set up multiple stores
    Last updated: December 22, 2022
    Edit on GitHub
    Multiple stores in cloud environments
    For instructions about setting up multiple stores in Spryker Cloud Commerce OS, see Add and remove databases of stores.
    With the Spryker Commerce OS, you can create multiple stores per your business requirements for different scenarios. The multi-store setup is very versatile and customizable—for example, you can do the following:
    • Build one store for multiple countries and languages or separate stores for each region.
    • Make abstract products, discounts, and other logic and code shared between stores or create a dedicated setup for each of them.
    • Define separate search preferences to create an entirely different set of rankings, rules, and settings per store—for example, a date format or a currency.
    • Set up a default store.
    Multi-store setup infrastructure options
    Multi-store setup 1: Database, search engine, and key-value storage are shared between stores.

    Due to the resources being shared, the infrastructure costs are low. This setup is most suitable for B2C projects with low traffic and a small amount of data like products and prices.
    Multi-store setup 2: Each store has a dedicated search engine and key-value storage while the database is shared.

    This setup is most suitable for B2B projects with high traffic and a large amount of data.
    Multi-store setup 3: Each store has a dedicated database, search engine, and key-value storage.

    This setup is most suitable for projects with the following requirements:
    • Completely different business requirements per store, like business logic and features.
    • Independent maintenance and development flow.
    • Separated data management for entities like products, customers, and orders.
    • On-demand setup of any type of environment per store, like test, staging, or production.
    It’s the most expensive but flexible option in terms of per-store scaling and performance.
    Set up multiple stores
    To set up multiple stores, follow the steps in the following sections:
    Configure code buckets
    Code buckets provide an easy way to execute different business logic in runtime based on different HTTP or console command requests. To configure code buckets, see Code buckets.
    Configure stores
    1. Define the desired stores in config/Shared/stores.php. In the following example, DE and AT stores are defined:
    config/Shared/stores.php

    <?php
    
    $stores = [];
    
    $stores['DE'] = [
        'contexts' => [
            '*' => [
                'timezone' => 'Europe/Berlin',
                'dateFormat' => [
                    'short' => 'd/m/Y',
                    'medium' => 'd. M Y',
                    'rfc' => 'r',
                    'datetime' => 'Y-m-d H:i:s',
                ],
            ],
            'yves' => [],
            'zed' => [
                'dateFormat' => [
                    'short' => 'Y-m-d',
                ],
            ],
        ],
        // locales configuration
        'locales' => [
             'en' => 'en_US',
             'de' => 'de_DE',
        ],
        // country and currency configuration
        'countries' => ['DE'],
        'currencyIsoCode' => 'EUR',
        // Queue pool is the mechanism which sends messages to several queues.
        'queuePools' => [
            'synchronizationPool' => [
                'AT-connection',
                'DE-connection',
            ],
        ],
        'storesWithSharedPersistence' => ['AT'],
    ];
    
    $stores['AT'] = [
        'contexts' => [
            '*' => [
                'timezone' => 'Europe/Vienna',
                'dateFormat' => [
                    'short' => 'd/m/Y',
                    'medium' => 'd. M Y',
                    'rfc' => 'r',
                    'datetime' => 'Y-m-d H:i:s',
                ],
            ],
            'yves' => [],
            'zed' => [
                'dateFormat' => [
                    'short' => 'Y-m-d',
                ],
            ],
        ],
        'locales' => [
             'en' => 'en_US',
             'de' => 'de_AT',
        ],
        'countries' => ['AT'],
        'currencyIsoCode' => 'EUR',
    ];
    
    return $stores;
    
    1. Optional: Define store-specific configuration:
    2. For one or more stores you’ve defined in config/Shared/stores.php, define a separate store-specific configuration. For example, config/Shared/config-default_docker_de.php is the configuration file for the DE store in the docker environment.
    3. To apply the defined store-specific configuration, adjust the related deploy file in the environment section.
      In the following example, the docker_de environment name points to the config/Shared/config-default_docker_de.php store-specific configuration file. For more information about this deploy file parameter, see environment:
    ....
    
    environment: docker_de
    
    image:
      tag:
    
    1. Define the default store in config/Shared/default_store.php. In the following example, we define DE as the default store.
    <?php
    
    return 'DE';
    ...
    
    1. To import data for the stores you’ve added, adjust all the import files and import configuration.
      For example, define the import source for the DE store you’ve added:
    #2. Catalog Setup data import
    ...
    - data_entity: product-price
      source: data/import/common/DE/product_price.csv
    ...   
    
    1. Configure installation recipes
      Add the new stores to the installation recipes in config/install/* as follows:
    ...
    
    stores:
        ...
        - {STORE_NAME}
    ...    
    

    For example, to add the AT and DE stores, adjust an installation recipe as follows:

    ...
    
    stores:
        ...
        - DE
        - AT
    ...    
    

    Where is that install recipe file i am not getting what should i do

  • Posts: 30 🧑🏻‍🚀 - Cadet

    i am just asking about this
    1. Configure installation recipes
    Add the new stores to the installation recipes in config/install/* as follows:

    ...
    
    stores:
        ...
        - {STORE_NAME}
    ...    
    

    For example, to add the AT and DE stores, adjust an installation recipe as follows:

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    Look into your directory config/install this contains several yml files.
    To be able to run the install commands for all your stores you need to adapt for which stores those commands should run, by adding your store to the key stores

  • Posts: 30 🧑🏻‍🚀 - Cadet

    i gone through all the process but the store is not sowing in backend

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    Is it added to spy_stores in the DB?

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    Have you set SPRYKER_ACTIVE_STORES to DE,<Your Store>

  • Posts: 30 🧑🏻‍🚀 - Cadet

    no

  • Posts: 30 🧑🏻‍🚀 - Cadet

    what it not added to DB

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    (in https://github.com/spryker-shop/b2b-demo-shop/blob/master/deploy.dev.yml#L13)

    Afterwards you need to rebuild your local containers:

    docker/sdk boot -s deploy.dev.yml
    docker/sdk up --build
    
  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    what it not added to DB

    There is no automatism to create the DB entry, you need to do this by hand, which is nowhere documented and one of the pitfalls setting up new stores.

  • Posts: 30 🧑🏻‍🚀 - Cadet

    The store is not added in DB

  • Posts: 30 🧑🏻‍🚀 - Cadet

    after build also the store is not there

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    You need to add it by hand

  • Posts: 30 🧑🏻‍🚀 - Cadet

    okk

  • Posts: 30 🧑🏻‍🚀 - Cadet

    I have done that but http://yves.demo.spryker.local/ is not working i have created a store as demo so how can iaccess that store shop

  • Posts: 30 🧑🏻‍🚀 - Cadet

    Have you set SPRYKER_ACTIVE_STORES to DE,<Your Store> where is this const or variable i have to set

  • Posts: 30 🧑🏻‍🚀 - Cadet

    i am not getting any .env file

  • Lead Spryker Solution Architect / Technical Director Posts: 690 🪐 - Explorer

    This is an environment variable that is set into the container via the docker sdk.
    In your deploy.dev.yml add SPRYKER_ACTIVE_STORES: "DE, <YOUR STORE>" under:

    image:
      ...
      environment:
        SPRYKER_ACTIVE_STORES: "DE, <YOUR STORE>"
    

    Execute

    docker/sdk boot -s deploy.dev.yml
    docker/sdk up --build
    

    And your new store should be active

Welcome!

It looks like you're new here. Sign in or register to get started.