How to add a new category?


To add a new category, create a new js file in the 'js/products/categories/' path. ex: bags.js

Here is the boilerplate code for a new category:

/* jshint undef: true, unused: true */
/* global define: false */
define([], function(){
    return {
        // Category name
        name: "Bags",

        // If true, the products slider will be listed in one row
        oneRow: false,

        // Path to category products images
        imagesPath: "images/bags/",

        // If true, each product will have a folder for its images, named as its code
        addCodePath: false,
        items: [
            {
                name: "Product name",
                price: {
                    current: "68.00", // product current price
                    old: "80.00" // product old price
                },
                code: "N8101", // product code, if 'addCodePath' is set to true, the product images well be located in 'images/bags/N8101/' folder
                details: "Product details", // Product details
                thumb: "thumb.jpg", // Product thumbnail
                gallery: ["1.jpg", "2.jpg", "3.jpg"] // Product large images
            }
        ]
    };
});

Define the new category in 'defineCategories.js' from the 'js/products/' path.

/* jshint undef: true, unused: true */
/* global define: false */
define([
    // path to category file
    "products/categories/bags"
], function(){
    "use strict";

    var list = [];
    for(var i = 0; i<arguments.length; i++) {
        list.push(arguments[i]);
    }

    return list;
});

Last update:
2014-11-27 15:10
Author:
Daniel Verejan
Revision:
1.2
Average rating:0 (0 Votes)