Mark Moffat 2019-02-09 13:36:12 +10:30
commit a03f1ef6e7
2 changed files with 12 additions and 0 deletions

6
lib/common.js Normal file → Executable file
View File

@ -10,6 +10,7 @@ const async = require('async');
const nodemailer = require('nodemailer'); const nodemailer = require('nodemailer');
const sanitizeHtml = require('sanitize-html'); const sanitizeHtml = require('sanitize-html');
const escape = require('html-entities').AllHtmlEntities; const escape = require('html-entities').AllHtmlEntities;
const mkdirp = require('mkdirp');
let ObjectId = require('mongodb').ObjectID; let ObjectId = require('mongodb').ObjectID;
const restrictedRoutes = [ const restrictedRoutes = [
@ -177,7 +178,12 @@ exports.checkDirectorySync = (directory) => {
try{ try{
fs.statSync(directory); fs.statSync(directory);
}catch(e){ }catch(e){
try{
fs.mkdirSync(directory); fs.mkdirSync(directory);
}
catch(err){
mkdirp.sync(directory);//error : directory & sub directories to be newly created
}
} }
}; };

View File

@ -142,6 +142,12 @@ $(document).ready(function (){
cartUpdate(qtyElement); cartUpdate(qtyElement);
}); });
$(document).on('change', '.cart-product-quantity', function (e) {
cartUpdate(e.target);
});
$(document).on('click', '.btn-delete-from-cart', function(e){ $(document).on('click', '.btn-delete-from-cart', function(e){
deleteFromCart($(e.target)); deleteFromCart($(e.target));
}); });