function generateVariants(){
		//console.log($scope.product.attr1_values);
		$scope.product.variants = [];
		if($scope.product.attr1_values.length == 0 )
			return;
		_sku = init_sku;

		// if(init_sku != $scope.product.sku){
		// 	_sku = $scope.product.sku;
		// }

		$scope.counter = $scope.currentSequenceNumber;
		$scope.counter++;
		$scope.name_counter = $scope.product.product_variants.length;
		$scope.custom_sku = $scope.product.product_variants[$scope.product.product_variants.length - 1].sku;

		for(var i = 0; i < $scope.product.attr1_values.length; i++ ){
			var variant_1_value = $scope.product.attr1_values[i];
			if($scope.product.attr2_values.length == 0){
				$scope.product.variants.push(makeVariant(variant_1_value))
				continue;
			}

			for(var j = 0; j < $scope.product.attr2_values.length; j++ ){
				var variant_2_value = $scope.product.attr2_values[j];
				if($scope.product.attr3_values.length == 0){
					$scope.product.variants.push(makeVariant(variant_1_value, variant_2_value));
					continue;
				}

				for(var k = 0; k < $scope.product.attr3_values.length; k++ ){
					var variant_3_value = $scope.product.attr3_values[k];
					$scope.product.variants.push(makeVariant(variant_1_value, variant_2_value, variant_3_value));
				}
			}
		}

		$scope.setValue();
		//console.log($scope.product.variants);
	}
/*
	* This function Generates Vairants 
	* by mapping all attributes 
	* possible values
	*/
This function Generates Vairants
by mapping all attributes
possible values
This function Generates Vairants by mapping all attributes possible values
function generateVariants(){
		$scope.product.variants = [];
		if($scope.product.attr1_values.length == 0 )
			return;
		_sku = init_sku;
		$scope.counter = $scope.currentSequenceNumber;
		$scope.counter++;
		$scope.name_counter = $scope.product.product_variants.length;
		$scope.custom_sku = $scope.product.product_variants[$scope.product.product_variants.length - 1].sku;
		for(var i = 0; i < $scope.product.attr1_values.length; i++ ){
			var variant_1_value = $scope.product.attr1_values[i];
			if($scope.product.attr2_values.length == 0){
				$scope.product.variants.push(makeVariant(variant_1_value))
				continue;
			}
			for(var j = 0; j < $scope.product.attr2_values.length; j++ ){
				var variant_2_value = $scope.product.attr2_values[j];
				if($scope.product.attr3_values.length == 0){
					$scope.product.variants.push(makeVariant(variant_1_value, variant_2_value));
					continue;
				}
				for(var k = 0; k < $scope.product.attr3_values.length; k++ ){
					var variant_3_value = $scope.product.attr3_values[k];
					$scope.product.variants.push(makeVariant(variant_1_value, variant_2_value, variant_3_value));
				}
			}
		}
		$scope.setValue();
	}
function generateVariants ( ) { $scope . product . variants = [ ] ; if ( $scope . product . attr1_values . length == 0 ) return ; _sku = init_sku ; $scope . counter = $scope . currentSequenceNumber ; $scope . counter ++ ; $scope . name_counter = $scope . product . product_variants . length ; $scope . custom_sku = $scope . product . product_variants [ $scope . product . product_variants . length - 1 ] . sku ; for ( var i = 0 ; i < $scope . product . attr1_values . length ; i ++ ) { var variant_1_value = $scope . product . attr1_values [ i ] ; if ( $scope . product . attr2_values . length == 0 ) { $scope . product . variants . push ( makeVariant ( variant_1_value ) ) continue ; } for ( var j = 0 ; j < $scope . product . attr2_values . length ; j ++ ) { var variant_2_value = $scope . product . attr2_values [ j ] ; if ( $scope . product . attr3_values . length == 0 ) { $scope . product . variants . push ( makeVariant ( variant_1_value , variant_2_value ) ) ; continue ; } for ( var k = 0 ; k < $scope . product . attr3_values . length ; k ++ ) { var variant_3_value = $scope . product . attr3_values [ k ] ; $scope . product . variants . push ( makeVariant ( variant_1_value , variant_2_value , variant_3_value ) ) ; } } } $scope . setValue ( ) ; }
This function Generates Vairants
 by mapping all attributes
 possible values
This function Generates Vairants by mapping all attributes possible values
//console.log($scope.product.attr1_values); // if(init_sku != $scope.product.sku){ // 	_sku = $scope.product.sku; // } //console.log($scope.product.variants);