Location: PHPKode > projects > Simple PHP Shopping cart - asaancart > asaancart v-0.9/templates/manage_variants.tpl
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$title}</title>
<link href="css/global.css" rel="stylesheet" type="text/css" />

<link href="../menu/css/dropdown/dropdown.css" media="all" rel="stylesheet" type="text/css" />
<link href="../menu/css/dropdown/themes/default/default.advanced.css" media="all" rel="stylesheet" type="text/css" />

<!--[if lt IE 7]>
<script type="text/javascript" src="../menu/js/jquery/jquery.js"></script>
<script type="text/javascript" src="../menu/js/jquery/jquery.dropdown.js"></script>
<![endif]-->


<!-- Initialize Dojo -->
        {literal}
        <script src='../dojo/dojo/dojo.js' type='text/javascript'></script>
        
        <script type='text/javascript'>
        //<!--

        // The following function submits the data from the 'post-form' form
        // to a PHP script located at
        // 'http://www.dojoforum.com/demo-0.9/xhr/parse_form.php'
        // The PHP script simply outputs a string in the format of
        // 'Hello $name!', which is then put in the <div> w/ the id
        // of 'response'.
        //
        // NOTE: As with xhrGet, you can also use handleAs to accept
        // JSON objects in your load() function.
		//dojo.require("dojo.style");
		function saveGroupInfo(group_id){
		variant_group_name = document.getElementById('variant_group_name_'+group_id).value;
			dojo.xhrPost ({
							// The page that parses the POST request
							url: 'update_variant_group.php?mode=update&variant_group_name='+variant_group_name+'&group_id='+group_id,
				   
							// Name of the Form we want to submit
							//form: 'login',
					
							// Loads this function if everything went ok
							load: function (data) {
									// Put the data into the appropriate <div>
									//document.getElementById('loader2').style.display="";
									dojo.byId('update_all_variant_box').innerHTML = data;
									
									//document.getElementById('loader2').style.display="none";
									
									
							},
							// Call this function if an error happened
							error: function (error) {
									console.error ('Error: ', error);
							}
				});
		}
		
		function saveSubVariantInfo(variant_id){
		edit_variant_name = document.getElementById('edit_variant_name_'+variant_id).value;
		edit_variant_surcharge = document.getElementById('edit_variant_surcharge_'+variant_id).value;
			dojo.xhrPost ({
							// The page that parses the POST request
							url: 'update_variant.php?mode=update&variant_id='+variant_id+'&edit_variant_name='+edit_variant_name+'&edit_variant_surcharge='+edit_variant_surcharge,
				   
							// Name of the Form we want to submit
							//form: 'login',
					
							// Loads this function if everything went ok
							load: function (data) {
									// Put the data into the appropriate <div>
									//document.getElementById('loader2').style.display="";
									dojo.byId('update_all_variant_box').innerHTML = data;
									
									//document.getElementById('loader2').style.display="none";
									
									
							},
							// Call this function if an error happened
							error: function (error) {
									console.error ('Error: ', error);
							}
				});
		}
		
		
		
		function saveVariantInfo(group_id){
		variant_surcharge = document.getElementById('variant_surcharge_'+group_id).value;
		variant_name = document.getElementById('variant_name_'+group_id).value;
			dojo.xhrPost ({
							// The page that parses the POST request
							url: 'add_variant.php?mode=add&variant_name='+variant_name+'&variant_surcharge='+variant_surcharge+'&group_id='+group_id,
				   
							// Name of the Form we want to submit
							//form: 'login',
					
							// Loads this function if everything went ok
							load: function (data) {
									// Put the data into the appropriate <div>
									//document.getElementById('loader2').style.display="";
									dojo.byId('update_all_variant_box').innerHTML = data;
									
									//document.getElementById('loader2').style.display="none";
									
									
							},
							// Call this function if an error happened
							error: function (error) {
									console.error ('Error: ', error);
							}
				});
		}
		
		
		
		function UpdateGroupStatus(group_id, action){
		
		
			//document.getElementById('group_variant_name_'+group_id).value;
			dojo.xhrPost ({
							// The page that parses the POST request
							url: 'update_variant_group.php?mode='+action+'&group_id='+group_id,
				   
							// Name of the Form we want to submit
							//form: 'login',
					
							// Loads this function if everything went ok
							load: function (data) {
									// Put the data into the appropriate <div>
									//document.getElementById('loader2').style.display="";
									dojo.byId('update_all_variant_box').innerHTML = data;
									//document.getElementById('loader2').style.display="none";
									
									
							},
							// Call this function if an error happened
							error: function (error) {
									console.error ('Error: ', error);
							}
				});
			
		}
		function deleteGroupInfo(group_id){
		if(confirm("Are you sure that you want to delete this variant group? Deleting this will delete all variants under this group")){
		
			//document.getElementById('group_variant_name_'+group_id).value;
			dojo.xhrPost ({
							// The page that parses the POST request
							url: 'delete_variant_group.php?mode=delete&group_id='+group_id,
				   
							// Name of the Form we want to submit
							//form: 'login',
					
							// Loads this function if everything went ok
							load: function (data) {
									// Put the data into the appropriate <div>
									//document.getElementById('loader2').style.display="";
									dojo.byId('update_all_variant_box').innerHTML = data;
									//document.getElementById('loader2').style.display="none";
									
									
							},
							// Call this function if an error happened
							error: function (error) {
									console.error ('Error: ', error);
							}
				});
			}//end confirm
		}
		
		function deleteSubVariantInfo(variant_id){
		if(confirm("Are you sure that you want to delete this variant?")){
		
			//document.getElementById('group_variant_name_'+group_id).value;
			dojo.xhrPost ({
							// The page that parses the POST request
							url: 'delete_variant.php?mode=delete&variant_id='+variant_id,
				   
							// Name of the Form we want to submit
							//form: 'login',
					
							// Loads this function if everything went ok
							load: function (data) {
									// Put the data into the appropriate <div>
									//document.getElementById('loader2').style.display="";
									dojo.byId('update_all_variant_box').innerHTML = data;
									//document.getElementById('loader2').style.display="none";
									
									
							},
							// Call this function if an error happened
							error: function (error) {
									console.error ('Error: ', error);
							}
				});
			}//end confirm
		}

        </script>
        {/literal}
</head>
<body>


<div id="page_container">
	<div id="admin_header">{include file='admin_header.tpl'}</div>
	<div id="admin_nav">{include file='admin_navigation.tpl'}</div>
    <div id="contents">
    	<!-- Manage category controls -->
        <div id="manage_cat_box">
        {include file='mini_catalog_nav.tpl'}
        <h3>Manage Products Variants</h3>
        {include file='create_variant_form.tpl'}
        <br />
        <br />
        
        <div id="update_all_variant_box">
        {include file='manage_variant_list.tpl'}
        </div>
		</div>
        <!-- end manage categories -->
        <!-- <div id="section_info_box">
        <h4>Why to select image</h4>
        </div>-->
        
    <div style="clear:both;"></div>   
    </div>
    
    <div id="admin_footer">{include file='admin_footer.tpl'}</div>
</div>

</body>
</html>
Return current item: Simple PHP Shopping cart - asaancart