Overview

Design Tailor (DT), is built on most advance technology available today and offer extremely flexible way to customize any kind of product online from your browser.

if you have already have e-commerce shop or looking to start your online business in the web-to-print industry, DT offer you as great tool for your customers for product customization on the fly.

For now DT is available for as jQuery plugin for custom web-shop, developers can use or customize the plugin in the way they want, DT comes along with extensive documentation.

Table of Contents

Here are some functions / methods which we used in plugin.

Methods:

  • Constructor
    • init( )

      This is the method for initialize Design Tailor plugin.

      This method will automatically call, developer don't need to call this manually. It contain some basic settings, fabric js defaults, social sharing and theme setup methods. Can found this method in application.js

  • Product
  • Graphics
    • addShape( url )

      This is the method for add shape to product.

      This will accept only SVG format.

      Parameters:

      • url String

        The Url of the SVG shape.

    • onFileSelect( [parameters] )

      This is the method for add image to product.

      This will accept support image/* formats.

      Parameters:

      • [parameters] Object

        An object with the file parameters, you would like to upload on the design.

    • addImage( url )

      This is the method for add Image to product.

      This will accept image/* format.

      Parameters:

      • url String

        The Url of the Image, that you would like to add on design.

    • setImageFilter( filter = true, filterValue )

      This is the method for apply Filter to uploaded Image.

      We provide some filters: Grayscale, Sepia, Invert, Emboss, Sharpen.

      Parameters:

      • [filter = true || filter = false] Boolean
      • filterValue String

        The Value of the Filter, that you would like to add on design.

    • addQRCode( text )

      This is the method for add QR Code to product.

      Parameters:

      • text String

        The text, that you would like to add by Qr Code.

    • enterDrawingMode( )

      This is the method for toggle Hand Drawing Mode.

    • changeDrawingMode( mode )

      This is the method for change Hand Drawing Mode.

      We provide some hand wrting tools: Pencil, Circle, Spray, Pattern, hline, vline, square, diamond.

      Parameters:

      • mode String

        The mode, that you would like to use by Hand Drawing Tool.

    • fillDrawing( color )

      This is the method for change Hand Drawing Color.

      Parameters:

      • color String

        The color, that you would like to use by Hand Drawing Tool.

    • changeDrawingWidth ( value )

      This is the method for change Hand Drawing Width.

      Parameters:

      • value Integer

        The tool width value, that you would like to use by Hand Drawing Tool.

    • changeDrawingShadow( value )

      This is the method for change Hand Drawing Shadow.

      Parameters:

      • value Integer

        The shadow value, that you would like to use by Hand Drawing Tool.

  • Text
    • addText( )

      This is the method for add Text on canvas.

    • curveText( )

      This is the method for toggle Text into Curved and Simple mode.

    • spacing( value )

      This is the method for change Spacing in Curved Text.

      Parameters:

      • value Integer

        The spacing value, that you would like to use in Curved Text.

    • radius( value )

      This is the method for change Radius in Curved Text.

      Parameters:

      • value Integer

        The radius value, that you would like to use in Curved Text.

    • toggleReverse( value )

      This is the method for change Reverse in Curved Text.

      Parameters:

      • value Integer

        The reverse value, that you would like to use in Curved Text.

    • toggleBold( )

      This is the method for change toggleBold Text.

    • toggleItalic( )

      This is the method for change toggleItalic Text.

    • toggleUnderline( )

      This is the method for change toggleUnderline Text.

    • toggleLinethrough( )

      This is the method for change toggleLinethrough Text.

    • addWordCloud( )

      This is the method for add WordCloud Text.

  • Social Api's
  • Common Methods
    • clearAll( )

      This is the method for clear all canvas.

    • removeSelectedObject( )

      This is the method for remove selected object from canvas.

    • deactivateAll( )

      This is the method for deactivate all objects on canvas.

    • verticalAlign( )

      This is the method for Vertical Align selected object on canvas.

    • horizontalAlign( )

      This is the method for Horizontal Align selected object on canvas.

    • forwardSwap( )

      This is the method for Forward Align selected object on canvas.

    • backwordSwap( )

      This is the method for Backword Align selected object on canvas.

    • objectForwardSwap( [object] )

      This is the method for Forward Swap an object on canvas.

      Parameters:

      • [object] Object

        An object , you would like to Forward Swap.

    • objectBackwordSwap( [object] )

      This is the method for Backword Swap an object on canvas.

      Parameters:

      • [object] Object

        An object , you would like to Backword Swap.

    • layers( )

      This is the method for view layers on canvas.

    • copyItem( )

      This is the method for copy an object on canvas.

    • pasteItem( )

      This is the method for paste an object on canvas.

    • addTextByAction( )

      This is the method for add default Text on canvas.

    • lockObject( )

      This is the method for lock - unlock toggle on canvas.

    • lockLayerObject( [object] )

      This is the method for lock - unlock toggle on canvas for an object.

      Parameters:

      • [object] Object

        An object , you would like to toggle lock - unlock.

    • flipObject( )

      This is the method for flip selected object on canvas.

    • undo( )

      This is the method for undo added object on canvas.

    • redo( )

      This is the method for redo added object on canvas.

    • zoomObject( action )

      This is the method for Zoom In - Zoom Out object on canvas.

      This will accept two parameters: zoomin , zoomout.

      Parameters:

      • action String

        An action , you would like to apply on selected object.

    • isLocked ()

      This is the method for check object locked OR not.

      Will return boolean: true , false.

    • fillColor( color )

      This is the method for fill color in an object on canvas.

      Parameters:

      • color String

        An color code with #tag like: #000000.

    • fillTint ( value )

      This is the method for fill Tint in an object on canvas.

      Parameters:

      • value String

        An Tint value, which you would like to apply on canvas.

    • resetTint( )

      This is the method for reset Tint in an object on canvas.

    • toggleTint( value )

      This is the method for toggle Tint in an object on canvas.

      Parameters:

      • value String

        An Tint value, which you would like to apply on canvas.

    • deleteObject( [object] )

      This is the method for delete an object from canvas.

      Parameters:

      • object Object

        An Object, which you would like to delete from canvas.

    • changeColorScheme( )

      This is the method for change color scheme of designer.

      There will be two values, which you can define in settings.json schema.

      Accept two variable values: primaryColor , secondaryColor

    • showNotification( message, scroll )

      This is the private method, you can use this only in application.js.

      Parameters:

      • message String

        An String, which you would like to display.

      • scroll Boolean

        An Boolean: true , false. This used for scrollTop window

How to use (Angular JS OR jQuery Project)

1. General Settings


    
    1. Download the plugin then extract it to a folder on your project root.
    2. After that configure 'settings.json' schema by going '/inc/json/settings.json'.
    3. In 'settings.json' you will find all settings regarding designer layout, color scheme etc.
    4. Then After you need to setting up 'initProducts()' according to appropriate json schema.
    5. If you want to add your custom graphics you need to update 'initClipArts()' method.
    6. For the 'Fonts' you need to update 'assets/fabric/fabricConstants.js' file.
    7. For save designed product this plugin will provice 'SVG' url with 'PDF' and 'PNG' formats.
    8. You can use these url and files for 'save' and 'e-commerce' functionality.
    9. Designed files you can find in "saved_design" folder in plugin root.
    10. For email and saved file configuration you need to edit "inc/save_design.php" file according your project
    need. This will send email copy of design to configured email ID.

2. How to use in jQuery Project


    
    For use in jQuery there are some 'methods' that you can follow this 'example'.
/********* angular controller ********/ var angularApp = angular.module('ManagerApp', []); angularApp.controller('ManagerCtrl', ['$scope', function ($scope) { $scope.updateCustomRequest = function () { console.log('You Called Angular Js method'); }; }]); /********* angular controller ********/ --------------------------------------------------------------------------------------- /********* javascript function ********/ function example() { var scope = angular.element(document.getElementById("MainWrap")).scope(); scope.$apply(function () { scope.updateCustomRequest(); }); } /********* javascript function ********/

Structure of JSON Schema:

  • Init Settings

    This is the JSON Schema for init Designer Settings.

    
        {
          "status":true,
          "settings": {
                "notification_messages": {
                      "GENERAL_ERROR" : "Error. Unknown system response. Controller: ProductController",
                      "CANVAS_EMPTY": "Select product to perform this action",
                      "IMAGE_SIZE": "Image is too large (MAX SIZE: 300*300)",
                      "WORDCLOUD_EMPTY": "Please enter some words for generate wordcloud.",
                      "TYPE_NUMBER_REQUIRED": "Only numbers is allowed"
                },
                "request_url": {
                      "LOAD_PRODUCTS": "dummy_data/products/load_products.json",
                      "LOAD_PRODUCT_SUB_IMAGES": "dummy_data/products/",
                      "LOAD_GRAPHICS": "dummy_data/graphics/",
                      "LOAD_COLOR_SCHEME": "inc/theme.php"
                },
                "general_settings": {
                      "loadMore":true,
                      "graphicsPage" : 1,
                      "defaultProductId" : 1,
                      "defaultProductImage" : "dummy_data\/products\/t_shirts\/1.png",
                      "quantity" : 1,
                      "defaultPrice" : 210,
                      "defaultCurrency" : "USD",
                      "defaultProductTitle" : "Tees Nues",
                      "qrCode" : "qrcode",
                      "enter_drawing_mode" : "Enter Drawing Mode",
                      "drawing_mode_selector" : "Pencil",
                      "drawing_line_width" : 30,
                      "drawing_color" : "#000000",
                      "drawing_line_shadow" : 0,
                      "primaryColor" : "#64AE11",
                      "secondaryColor" : "#ffffff",
                      "graphicsCategory": "Flat Icons",
                      "graphicsCategories":{
                            "Flat Icons": "Flat Icons",
                            "ClipArts": "ClipArts",
                            "Flags": "Flags",
                            "Shapes": "Shapes",
                            "Quotes": "Quotes",
                            "Badges": "Badges",
                            "Zodiac": "Zodiac"
                      },
                      "productByName": "ASC",
                      "productByNames":{
                            "ASC": "ASC",
                            "DESC": "DESC"
                      },
                      "predicate": "name",
                      "reverse": true
                },
                "social_settings" : {
                    "fb_app_id" : 101994476846984
                }
          },
          "message":"Settings Loaded Successfully"
        }
    
    
  • Init Products

    This is the JSON Schema for init Products.

    
        {
           "status":true,
           "products":[
              {
                 "id":1,
                 "name":"ZT Tees",
                 "price":210,
                 "currency":"USD",
                 "image":"dummy_data/products/t_shirts/1.png",
                 "sub_images":[
                        "dummy_data/products/t_shirts/1.png",
                        "dummy_data/products/t_shirts/1-1.png",
                        "dummy_data/products/t_shirts/1-2.png",
                        "dummy_data/products/t_shirts/1-3.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":3,
                 "name":"Yix Handbag",
                 "price":70,
                 "currency":"USD",
                 "image":"dummy_data/products/bag/3.png",
                 "sub_images":[
                        "dummy_data/products/bag/3.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":4,
                 "name":"Greeting Card",
                 "price":160,
                 "currency":"USD",
                 "image":"dummy_data/products/greeting_cards/4.png",
                 "sub_images":[
                        "dummy_data/products/greeting_cards/4.png",
                        "dummy_data/products/greeting_cards/4-1.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":5,
                 "name":"Xr Back Cover",
                 "price":160,
                 "currency":"USD",
                 "image":"dummy_data/products/phone_cases/5.png",
                 "sub_images":[
                        "dummy_data/products/phone_cases/5.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":7,
                 "name":"Cent Mugs",
                 "price":20,
                 "currency":"USD",
                 "image":"dummy_data/products/mugs/7.png",
                 "sub_images":[
                        "dummy_data/products/mugs/7.png",
                        "dummy_data/products/mugs/7-1.png",
                        "dummy_data/products/mugs/7-2.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":9,
                 "name":"GU Wines",
                 "price":144,
                 "currency":"USD",
                 "image":"dummy_data/products/bottles/9.png",
                 "sub_images":[
                        "dummy_data/products/bottles/9.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":10,
                 "name":"Tx Tees",
                 "price":460,
                 "currency":"USD",
                 "image":"dummy_data/products/t_shirts/10.png",
                 "sub_images":[
                        "dummy_data/products/t_shirts/10.png",
                        "dummy_data/products/t_shirts/10-1.png",
                        "dummy_data/products/t_shirts/10-2.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":11,
                 "name":"X-press Card",
                 "price":60,
                 "currency":"USD",
                 "image":"dummy_data/products/business_card/11.png",
                 "sub_images":[
                        "dummy_data/products/business_card/11.png",
                        "dummy_data/products/business_card/11-1.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":12,
                 "name":"Hoodi",
                 "price":160,
                 "currency":"USD",
                 "image":"dummy_data/products/hood/12.png",
                 "sub_images":[
                        "dummy_data/products/hood/12.png",
                        "dummy_data/products/hood/12-1.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":13,
                 "name":"Yu Mugs",
                 "price":90,
                 "currency":"USD",
                 "image":"dummy_data/products/mugs/13.png",
                 "sub_images":[
                        "dummy_data/products/mugs/13.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":14,
                 "name":"Hats",
                 "price":140,
                 "currency":"USD",
                 "image":"dummy_data/products/hats/14.png",
                 "sub_images":[
                        "dummy_data/products/hats/14.png",
                        "dummy_data/products/hats/14-1.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              },
              {
                 "id":15,
                 "name":"Greeting Card",
                 "price":20,
                 "currency":"USD",
                 "image":"dummy_data/products/greeting_cards/15.png",
                 "sub_images":[
                        "dummy_data/products/greeting_cards/15.png",
                        "dummy_data/products/greeting_cards/15-1.png"
                 ],
                 "description":"Lorium ipsum dolor sit amet"
              }
           ],
           "message":"Products Loaded Successfully"
        }
    
    
  • Load Product Sub Images

    This is the JSON Schema for load Product's Sub Images.

    
        {
           "status":true,
           "images":[
                  "dummy_data/products/t_shirts/1.png",
                  "dummy_data/products/t_shirts/1-1.png",
                  "dummy_data/products/t_shirts/1-2.png"
           ],
           "message":"Images Loaded Successfully"
        }
    
    
  • Load Graphics

    This is the JSON Schema for load Graphics. For more graphics categories please check dummy_data folder.

    
        {
           "status":true,
           "page":1,
           "loadMore":true,
           "data_result":[
                  "dummy_data/graphics/badges/1.svg",
                  "dummy_data/graphics/badges/2.svg",
                  "dummy_data/graphics/badges/3.svg",
                  "dummy_data/graphics/badges/4.svg",
                  "dummy_data/graphics/badges/5.svg",
                  "dummy_data/graphics/badges/6.svg",
                  "dummy_data/graphics/badges/7.svg",
                  "dummy_data/graphics/badges/8.svg",
                  "dummy_data/graphics/badges/9.svg"
           ],
           "message":"Badges Loaded."
        }
    
    

Technology Used

  • Angular Js
  • UI Elements (HTML5, CSS3, Angular Material)
  • Fabric Js Libraries
  • Bootstrap, SAAS