Coder Social home page Coder Social logo

sap-samples / cloud-commerce-sample-setup Goto Github PK

View Code? Open in Web Editor NEW
85.0 15.0 175.0 10.53 MB

Find the sample manifest.json and configuration files that you can use to build out your commerce repository in SAP Commerce Cloud.

Java 34.79% Smarty 0.65% TypeScript 61.94% HTML 1.07% SCSS 1.54%
sample sample-code sap-commerce-cloud

cloud-commerce-sample-setup's Introduction

SAP Commerce Cloud Sample Repository

REUSE status

This sample repository contains the files and folders that are required to set up SAP Commerce Cloud.

This branch covers a Commerce Cloud 2211 sample scenario that is based on the CX recipe with Spartacus 6.x.

Note

There are different branches covering the various versions and configurations of an SAP Commerce Cloud solution, so make sure to choose the right one. You can clone/download this repository, checkout the branch of interest and then follow the instructions in the README to update the example files with your specific details.

Caution

Do not use the deprecated yacceleratorstorefront template extension and the related addons for any new development. The deprecated yacceleratorstorefront and a few addons are included in this repo purely for showcase purposes.

Details: Deprecation of Accelerator UIs and Older OCC template Extensions

Requirements

  • You have a public-facing code repository.
  • You have an active SAP Commerce Cloud subscription.
  • You have a license for a supported SAP Commerce release
  • You have not set up SAP Commerce Cloud yet.

Supported Versions

You can find the supported SAP Commerce versions listed in the Compatibility help topic.

Download and Installation

Not applicable.

Configuration

These instructions walk you through the process of cloning the repository and then updating the sample files with your specific requirements.

The following folders and files are included in the sample repository.

Root level

  • core-customize folder: The folder that contains all of the folders and files that support Commerce Cloud.
  • js-storefront folder: A project Spartacus JS Storefront configured with Server Side Rendering (SSR). For more on project Spartacus see project Spartacus documentation

core-customize folder

  • manifest.json: The Commerce Cloud manifest.json file, which defines how your code will be built and deployed in the Public Cloud environments. The manifest is set up to leverage configuration reuse to better allow for consistency between local and cloud builds.
  • hybris folder: contains a sample custom folder for storing any custom extensions as well as the config folder for storing local and cloud properties, localextensions.xml and any local solr/tomcat configurations
  • other sample manifests: A collection of tested and verified manifest files that you can use as starting points for your Commerce Cloud environments.

Clone Repository

Clone the sample repository (instructions can be found here). The files are copied to your local machine.

Update the Custom Extensions

  1. If you don’t have custom extensions, you can delete the kiwi & tiger sample folders. If you wish to use these extensions you'll have to uncomment them in your core-customize/hybris/config/localextensions.xml folder
  2. List any extensions you're using (custom and any from Commerce runtime) in the core-customize/hybris/config/localextensions.xml file
  3. If you have custom extensions with dependencies, configure the dependencies in extesioninfo.xml accordingly. Extensions are built in the order in which they appear in your localextension.xml and manifest.json files

Update the Commerce Cloud manifest.json

  1. Open the manifest.json file inside the core-customize folder.
  2. Update the version with the version of SAP Commerce that you plan to use. Refer to the Supported Versions section of this readme for more information.
  3. Save the changes.

Prepare to Push the Sample Repository

In the sample repository, verify that you have the following files in the core-customize folder.

  • manifest.json: This is the manifest.json for Commerce Cloud.

In the sample repository, verify that you have the following files in the js-storefront folder.

  • manifest.json: This is the file that tells Cloud Automation the name and path of the JavaScript storefronts you want to build and deploy

Push the Commerce Cloud Configuration to Code Repository

Push all the contents from your local machine to the root level of your Commerce Cloud repository.

Access the Cloud Portal

Log in to the Cloud Portal and verify that your code repository is connected.

  1. From a supported browser, log in to https://portal.commerce.ondemand.com. For more information, see Accessing the Cloud Portal.
  2. Select Repository and verify that you are connected to the correct code repository.
  3. Find the environments that were provisioned for your subscription.
  4. Create a new build.
  5. Deploy the build to the environment using the Initialze Database option.

You may also wish to see this video which provides a walkthrough of how to connect your repository, as well as this video which outlines how to build and deploy.

Final Steps - Validating an example Spartacus Electronics Storefront

Use the Cloud Portal to create a build and then deploy the build to an environment.

See Build and Deploy your First SAP Commerce Cloud Project for all the steps to build and deploy.

After the build is deployed, you can find the 'JS Storefront' endpoint in the Environments page of the Cloud Portal listed under Public Endpoints.

  1. Click on the JS Storefront hyperlink to access the details page for endpoint.
  2. Either add an IP Filter Set for your IP address OR change the Base Rule from 'Deny All' to 'Allow All' in order to receive traffic to this example storefront.
  3. Save the changes.
  4. Click on the URL listed next to the JS Storefront public endpoint.
  5. Verify that you see a basic electronics storefront.

Limitations

The repository must be a public-facing repository. You cannot use a private repository to host SAP Commerce Cloud configurations.

Known Issues

There are no known issues at this time.

How to Obtain Support

This repository is provided "as-is"; no support is available.

Find more information about SAP Commerce Cloud Setup on our help site.

License

Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

cloud-commerce-sample-setup's People

Contributors

andrchan avatar bgambocjaviniar avatar btbernard avatar connerhelton avatar hackergil avatar mpern avatar radheps avatar tiffbman avatar tylermac-sap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-commerce-sample-setup's Issues

Missing extensions in localextensions.xml in 2005-spartacus branch

<extension name='permissionswebservices' />

<extension name='acceleratorbackoffice' />
<extension name='acceleratorcms' />
<extension name='acceleratorfacades' />
<extension name='acceleratorocc' />
<extension name='acceleratorservices' />
<extension name='acceleratorstorefrontcommons' />

Example is not working

After installing all dependencies with yarn install I've tried to run yarn start and got this error:

yarn build
yarn run v1.22.10
$ yarn run build:ssr
$ ng build && ng run spartacusstore:server
An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
Require stack:
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host
.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\index.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\models\architect-command.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\commands\build-impl.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\utilities\json-schema.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\models\command-runner.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\lib\init.js
- C:\Users\*\AppData\Roaming\nvm\v14.17.0\node_modules\@angular\cli\bin\ng
See "C:\Users\*\AppData\Local\Temp\ng-OXl6AO\angular-errors.log" for further details.
error Command failed with exit code 127.

Please fix your example.

No matching version found for @spartacus/asm@~6.0.0.

Describe the bug
When I call npm install I receive the following error:

npm ERR! code ETARGET npm ERR! notarget No matching version found for @spartacus/asm@~6.0.0.

Tell us the version of Spartacus

  • branch check: 2211-4-spartacus-6-0-0

To Reproduce
Steps to reproduce the behavior:

  1. clone the project (branch 2211-4-spartacus-6-0-0).
  2. CD project.
  3. Run npm install or npm update.
  4. See error

Expected behavior
The dependencies should be installed and node_modules folder should appear.

Create a JSON Schema to Validate "manifest.json"

In addition to utilizing SAP Help portal for documentation of the manifest.json file used for deployments, create a publicly-accessible JSON Schema to reduce errors in the creation of builds for SAP Commerce.

What a manifest.json JSON Schema support in SAP Commerce/Cloud Portal Looks Like

  1. Freely accessible
  2. Abides by JSON Schema
  3. Support in the manifest.json to reference the schema
    {
     "$schema": "http://example.com/sap-commerce-cloud-schema",
     "commerceSuiteVersion": "1905",
     "extensions": [
         "modeltacceleratorservices"
     ],

Why a JSON Schema for manifest.json?

  1. Reduces build errors from incorrectly formatted manifest.json
  2. Understand value "defaults"
  3. Autocomplete/Correction available where JSON Schema is supported (VSCode)

ATP Sample data should be reviewed to explicitly attach BaseStore

This ATP doesn't work for B2B powertools and SAP Commerce 2211.10

# Updates the OMS ATP default formula for stock calculation to avoid products with placed orders to go out of stock
INSERT_UPDATE AtpFormula;code[unique=true];availability;allocation;cancellation;increase;reserved;shrinkage;wastage;returned
;Default_Formula;true;false;false;true;false;true;true;true

jalo classes in src should not be ignored

The .gitignore file should not ignore jalo classes in src as historically these classes were used to implement custom before Service Layer was introduced.

Besides this can break the compilation when switching to branches that don't have the item type due to the top level Jalo classes missing the generated Jalo super classes

install and Configure tua-spa

How install spartacus tua 3.x for SAP Commerce 2105 + telco and utilities 2111 using cloud-commerce-sample-setup?

I command execute ng add @spartacus/[email protected]
Change /js-storefront/spartacusstore/src/app/spartacus/spartacus.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ConfigModule } from '@spartacus/core';
import { translationChunksConfig, translations } from '@spartacus/assets';
import { TmaB2cStorefrontModule, tmaTranslations } from '@spartacus/tua-spa';
import { environment } from 'src/environments/environment';


@NgModule({
  declarations: [],
  imports: [
        TmaB2cStorefrontModule.withConfig({
      backend: {
        tmf: {
          baseUrl: environment.baseUrl,
          prefix: '/b2ctelcotmfwebservices',
          version: '/v2',
          endpoints: {
            getProduct: {
            baseUrl: environment.baseUrl,
            prefix: '/b2ctelcotmfwebservices',
            version: '/v3',
            endpoint: '/product/${id}'
            },
            getProductOffering: {
            baseUrl: environment.baseUrl,
            prefix: '/b2ctelcotmfwebservices',
            version: '/v3',
            endpoint: '/productOffering/${id}'
            }
          }
        },
        occ: {
          baseUrl: environment.baseUrl,
          prefix: '/occ/v2/',
        },
        tmf_appointment: {
          baseUrl: environment.baseUrl,
          prefix: '/tmf-api',
        },
        tmf_resource_pool_management: {
          baseUrl: environment.baseUrl,
          prefix: '/tmf-api',
        },
        premiseLookup: {
          baseUrl: environment.baseUrl,
          prefix: '/premise/v1/',
        }
      },
      context: {
        urlParameters: ['baseSite', 'language', 'currency'],
        baseSite: ['telcospa']
      },
      i18n: {
        resources: translations,
        chunks: translationChunksConfig,
        fallbackLang: 'en',
      },
      features: {
        level: '3.0'
      },
      journeyChecklist: {
        journeyChecklistSteps: ['APPOINTMENT', 'MSISDN', 'INSTALLATION_ADDRESS'],
        msisdn_reservation: {
          msisdn_qty: 1,
          msisdn_capacity_amount_demand: 1,
          msisdn_applied_capacity_amount: 5,
          applied_capacity_amount_for_msisdn_reservation: 1,
        },
        appointment: {
          requested_number_of_timeslots: 5,
          end_date_of_timeslots: 3,
        }
      },
      deliveryMode: {
        default_delivery_mode: 'not-applicable'
      }
    })
  ],
  exports: [TmaB2cStorefrontModule]
})
export class SpartacusModule { }

add package.json

"chart.js": "^2.9.3",
"ng2-charts": "^2.3.2",
"ngx-spinner": "^9.0.1"
Compiling ng2-charts : es2015 as esm2015
/cloud-commerce-sample-setup-2105-spartacus/js-storefront/spartacusstore/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.js:40
                throw new Error("The target entry-point \"" + invalidTarget.entryPoint.name + "\" has missing dependencies:\n" +
                ^

Error: The target entry-point "@spartacus/tua-spa" has missing dependencies:
 - @spartacus/storefront/feature-toggles

    at TargetedEntryPointFinder.findEntryPoints (/cloud-commerce-sample-setup-2105-spartacus/js-storefront/spartacusstore/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.js:40:23)
    at /cloud-commerce-sample-setup-2105-spartacus/js-storefront/spartacusstore/node_modules/@angular/compiler-cli/ngcc/src/execution/analyze_entry_points.js:29:41
    at SingleProcessExecutorSync.SingleProcessorExecutorBase.doExecute (/cloud-commerce-sample-setup-2105-spartacus/js-storefront/spartacusstore/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:28:29)
    at /cloud-commerce-sample-setup-2105-spartacus/js-storefront/spartacusstore/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:57:59
    at SyncLocker.lock (/cloud-commerce-sample-setup-2105-spartacus/js-storefront/spartacusstore/node_modules/@angular/compiler-cli/ngcc/src/locking/sync_locker.js:34:24)
    at SingleProcessExecutorSync.execute (/cloud-commerce-sample-setup-2105-spartacus/js-storefront/spartacusstore/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:57:27)
    at Object.mainNgcc (/cloud-commerce-sample-setup-2105-spartacus/js-storefront/spartacusstore/node_modules/@angular/compiler-cli/ngcc/src/main.js:74:25)

Cloud Build is failed with missing promotionenginesamplesaddon/project.properties.template

In SAP Commerce Cloud, simply trigger a new build on branch 2105-spartacus.

The build is failed with this error:
` [echo] Generate project.properties file from template /opt/workspace/build/commerce-suite/hybris/bin/modules/promotion-engine/promotionenginesamplesaddon/project.properties.template

BUILD FAILED
/opt/workspace/build/commerce-suite/hybris/bin/modules/core-accelerator/addonsupport/resources/addonsupport/ant/acc-ant-addons.xml:730: The following error occurred while executing this line:
/opt/workspace/build/commerce-suite/hybris/bin/modules/core-accelerator/addonsupport/resources/addonsupport/ant/acc-ant-addons.xml:644: The following error occurred while executing this line:
/opt/workspace/build/commerce-suite/hybris/bin/modules/core-accelerator/addonsupport/resources/addonsupport/ant/acc-ant-addons.xml:648: The following error occurred while executing this line:
/opt/workspace/build/commerce-suite/hybris/bin/modules/core-accelerator/addonsupport/resources/addonsupport/ant/acc-ant-addons.xml:321: project.properties.template file doesn't exist : /opt/workspace/build/commerce-suite/hybris/bin/modules/promotion-engine/promotionenginesamplesaddon/project.properties.template

Total time: 3 seconds
Overall progress: 35
2021-09-20T02:32:44.216Z Task task ':buildCoreCommerce' finished

Task :buildCoreCommerce FAILED
:buildCoreCommerce (Thread[Daemon worker,5,main]) completed. Took 9.58 secs.

FAILURE: Build failed with an exception.
`

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.