JCart : ShoppingCart Category Page

In our Home Page we displayed all the Categories along with few products per each category. When customer clicks on any Category Name we should display Category Page which shows all the products in that Category. We already have HomeController.category() method to handle the URL /categories/{name}. So let us create category.html thymeleaf template as follows: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" layout:decorator="layout/mainLayout"> <head> <title>Category</title> </head> <body> <div layout:fragment="content"> <div class="single-product-area"> <div class="zigzag-bottom"></div> <div class="container"> <div class="row"> <div class="woocommerce-info"> <a href="" th:href="@{/}">Home</a> / <a href="" th:href="@{/categories/{name}(name=${category.

Continue reading »

JCart : ShoppingCart Home Page

In our Home page we will show all the categories along with few of the products in each Category. Let us update HomeController with two methods to show all the categories and the selected category products. @Controller public class HomeController extends JCartSiteBaseController { @Autowired protected CatalogService catalogService; @RequestMapping("/home") public String home(Model model) { List<Category> previewCategories = new ArrayList<>(); List<Category> categories = catalogService.getAllCategories(); for (Category category : categories) { Set<Product> products = category.

Continue reading »

JCart : ShoppingCart UI Layout Setup

In this post we will setup the layout for our ShoppingCart UI using Thymeleaf templates. Download the ustore theme zip file from https://www.freshdesignweb.com/ustora/ and copy the following directories/files into jcart-site/src/main/resources/static/assets folder. css fonts img js style.css Create Site layout thymeleaf template jcart-site/src/main/resources/templates/layout/mainLayout.html as follows: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"> <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE">QuilCart</title> <!-- Google Fonts --> <link href='https://fonts.

Continue reading »

JCart : Initial code setup for ShoppingCart

First we will start with setting up the initial code using SpringBoot. We have already discussed in JCart: Initial Code SetUp article about creating a maven module jcart-site which will be our ShoppingCart application. In that article we have shown what springboot dependencies to add as well. Just to recap we will be using SpringBoot, SpringMVC, Thymeleaf, JPA for our ShoppingCart application. jcart-site/pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.

Continue reading »

JCart Iteration-3 : Manage Categories and Products

In this iteration we will start working on the key requirement of our JCart administration application, ie managing categories and products. We will create various categories like Birds, Flowers, Vehicles etc. While creating products we will assign it to one of the category. Managing Categories and Products also looks similar to Manage Roles and Users. But there are few new things we will learn like FileUploading etc. Create Spring Data JPA Repositories for Category and Product public interface CategoryRepository extends JpaRepository<Category, Integer> { Category getByName(String name); } public interface ProductRepository extends JpaRepository<Product, Integer> { Product findByName(String name); Product findBySku(String sku); @Query("select p from Product p where p.

Continue reading »

JCart: Manage Users

In our previous post JCart: Manage Roles we have seen how to list all roles, create new roles and update them. Implementation of Manage Users also follows the same approach and very similar to the Implementation of Manage Roles. So I am not posting details of the implementation here again. Instead you can simply refer the code on JCart github repository https://github.com/sivaprasadreddy/jcart. If you have any questions regarding the implementation of Manage Users please post a comment.

Continue reading »

JCart: Manage Roles

In our previous post Manage Privileges – List all privileges we have implemented the functionality to show list of permissions. In this post we will implement Role management such as listing all Roles, creating new Role, editing Role permissions etc. Basically a Role is nothing a but group of Permissions assigned so that giving access to a set of action to user will become easy by assigning Roles. In this post we are going to see lot of code snippets, so I would suggest to clone the repo https://github.

Continue reading »

JCart: Manage Privileges

This is the simplest usecase of entire JCart admin application :-). We need to show list of permissions configured in our system. In our system each permission is more like access to a particular screen. For example, If a user has MANAGE_CATEGORIES permission then only he can access “Categories” screen. So these set of permission are something like implemented features set, hence we don’t need any provision to add/update/delete permissions dynamically.

Continue reading »

JCart : Iteration-2

Now we have completed Iteration-1 tasks. Iteration-1 includes so many tasks to establish the foundation like configuring Spring Security, Thymeleaf settings, UI layout setup etc. I hope from now on we can put more focus on actual tasks implementation rather than infrastructure setup. Though majority of the infrastructure setup is in place now, we will implement Role Based Access Control (RBAC) security using User-Role-Permission model before jumping on to Category/Product management.

Continue reading »