function insertSeedData(data){
	  		var defered = $q.defer();
	  		//insert data into database
	  		var products = data.products.map(function(r){
	  			return dbService.productTable.createRow(r);
	  		});

	  		var product_variants = data.product_variants.map(function(r){
	  			return dbService.productVariantTable.createRow(r);
	  		});

	  		/*adding products*/
	  		var p1 = dbService.db_.insert().into(dbService.productTable).values(products).exec();
	  		p1.then(function(){
	  			//console.log('products have been added');
	  			var p2 =dbService.db_.insert().into(dbService.productVariantTable).values(product_variants).exec();
	  			p2.then(function(){
	  				//console.log('product variants have been added');
	  				defered.resolve();
	  			})
	  		})
	  		return defered.promise;
	  	}
/*
	  	* inserts product and products variants into local database
	  	*/
inserts product and products variants into local database
inserts product and products variants into local database
function insertSeedData(data){
	  		var defered = $q.defer();
	  		var products = data.products.map(function(r){
	  			return dbService.productTable.createRow(r);
	  		});
	  		var product_variants = data.product_variants.map(function(r){
	  			return dbService.productVariantTable.createRow(r);
	  		});
	  		var p1 = dbService.db_.insert().into(dbService.productTable).values(products).exec();
	  		p1.then(function(){
	  			var p2 =dbService.db_.insert().into(dbService.productVariantTable).values(product_variants).exec();
	  			p2.then(function(){
	  				defered.resolve();
	  			})
	  		})
	  		return defered.promise;
	  	}
function insertSeedData ( data ) { var defered = $q . defer ( ) ; var products = data . products . map ( function ( r ) { return dbService . productTable . createRow ( r ) ; } ) ; var product_variants = data . product_variants . map ( function ( r ) { return dbService . productVariantTable . createRow ( r ) ; } ) ; var p1 = dbService . db_ . insert ( ) . into ( dbService . productTable ) . values ( products ) . exec ( ) ; p1 . then ( function ( ) { var p2 = dbService . db_ . insert ( ) . into ( dbService . productVariantTable ) . values ( product_variants ) . exec ( ) ; p2 . then ( function ( ) { defered . resolve ( ) ; } ) } ) return defered . promise ; }
inserts product and products variants into local database
inserts product and products variants into local database
//insert data into database /*adding products*/ //console.log('products have been added'); //console.log('product variants have been added');