Giter Site home page Giter Site logo

cfcastaneda98 / commercetools-sunrise-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from commercetools/commercetools-sunrise-java

0.0 0.0 0.0 59.82 MB

The next generation shop framework by commercetools

Home Page: https://demo.commercetools.com

License: Apache License 2.0

Java 97.44% Scala 0.82% CSS 0.04% JavaScript 0.11% Shell 1.27% Handlebars 0.31%

commercetools-sunrise-java's Introduction

Sunrise Java Shop Framework ๐ŸŒ…

Build Status Maven Central stability-frozen Heroku

โš ๏ธ Sunrise Java is now deprecated and will be decommissioned in 2020. Instead please use our new demo shop Sunrise SPA. If you would nevertheless like to use Sunrise Java for your own developments you should fork this repository under the given license and continue developing your version, but please be aware that there will be no more updates and no support provided to this framework.

The next generation shop framework.

Installation

Sunrise Starter Project

The recommended way to start using Sunrise is to clone the Sunrise Starter Project and use it as a template project. It already contains all dependencies (i.e. Sunrise Framework and Theme) and configurations needed to run your Sunrise-based project.

Starting from scratch

Alternatively you can start your own Play Framework project and configure it yourself, using Sunrise as dependency:

val sunriseFrameworkVersion = "1.0.0-M9" // or desired version
libraryDependencies ++= Seq(
  // add Sunrise Framework dependencies as needed, e.g.:
  "com.commercetools.sunrise" %% "product-catalog" % sunriseFrameworkVersion,
  "com.commercetools.sunrise" %% "shopping-cart" % sunriseFrameworkVersion,
  "com.commercetools.sunrise" %% "my-account" % sunriseFrameworkVersion,
  "com.commercetools.sunrise" %% "wishlist" % sunriseFrameworkVersion,
  // add the desired Sunrise Theme as dependency, e.g.:
  "com.commercetools.sunrise" % "commercetools-sunrise-theme" % "0.61.1"
)

These dependencies provide default Controllers which can be enabled by extending them into your own Controller and registering a route for it.

For example, if we wanted to enable an endpoint to see the contents of the cart, we would simply extend the SunriseCartDetailController:

// here you can register controller components
@RegisteredComponents(CartOperationsControllerComponentSupplier.class)
public final class CartDetailController extends SunriseCartDetailController {

    @Inject
    public CartDetailController(final ContentRenderer contentRenderer,
                                final CartFinder cartFinder,
                                final CartDetailPageContentFactory pageContentFactory) {
        // parameters that you can change via injection
        super(contentRenderer, cartFinder, pageContentFactory);
    }

    @Nullable
    @Override
    public String getTemplateName() {
        // here goes the name of your template
        return "cart";
    }
    
    // here you can override methods to change behaviour
}

Then we only need to associate our CartDetailController to a route with the desired pattern in conf/routes:

# Shows the details of the cart belonging to the current session
GET  /:languageTag/cart       @controllers.CartDetailController.show(languageTag: String)

Accessing http://localhost:9000/en/cart should now allow us to see the contents of our cart.

Check Sunrise Starter Project to adjust any other required configuration.

Integration tests against commercetools platform

  • Setup your environment variables (use a test project), so you need not to put your shop credentials under version control:
export SUNRISE_IT_CTP_PROJECT_KEY="your-CTP-project-key"
export SUNRISE_IT_CTP_CLIENT_SECRET="your-CTP-client-secret"
export SUNRISE_IT_CTP_CLIENT_ID="your-CTP-client-id"
  • sbt it:test

Related projects

Sunrise Starter Project

The starting point to build your own online shop project

https://github.com/commercetools/commercetools-sunrise-java-starter

Sunrise Theme

Handlebars templates + i18n messages + web assets

https://github.com/commercetools/commercetools-sunrise-theme

Sunrise Data

Example data used on our demo

https://github.com/commercetools/commercetools-sunrise-data

commercetools JVM SDK

SDK for JVM languages to communicate with comercetools projects

https://github.com/commercetools/commercetools-jvm-sdk

commercetools-sunrise-java's People

Contributors

lauraluiz avatar schleichardt avatar svenmueller avatar katmatt avatar ct-szilvia avatar acbeni avatar peter-gerhard avatar ccsalazarr-commercetools avatar mmoelli avatar hajoeichler avatar cfcastaneda98 avatar piobra avatar zonorti avatar skyriakou avatar trangng 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.