Jump to content

aneeb

Members
  • Posts

    48
  • Joined

  • Last visited

Posts posted by aneeb

  1. Here is the complete JavaScript which i have written.

    var serviceURL = "http:/localhost/mano/services/";var employees;$('#employeeListPage').bind('pageinit', function(event) {getPromotionList();});function getPromotionList() {//var id = getUrlVars()["id"];var urlVars = getUrlVars();var urlId = '';var urlUserno = '';var urlBrand = '';if (urlVars['id'] != undefined){   urlId = urlVars['id'];  var get = '';  get = 'getpromotions.php?id='+urlId; }else if (urlVars['userno'] != undefined){   urlUserno = urlVars['userno'];  var get = '';  get = 'getpromotions.php?userno='+urlUserno; }else if (urlVars['brand'] != undefined){   urlBrand = urlVars['brand'];  var get = '';  get = 'getpromotions.php?brand='+urlBrand; }  else{  var get = '';  get = 'getpromotions.php';  } $.getJSON("http://localhost/mano/services/" + get , function(data) {   $('#employeeList li').remove();  employees = data.items;  $.each(employees, function(index, employee) {  var url = 'promotiondetails.html?id=' + employee.id;  /*alert(url);*/   $('#employeeList').append('<li><a href="promotiondetails.html?id=' + employee.id + '">' +		 '<h4>' + employee.brand + ' - ' + employee.code + ' - '+ employee.subcode + '</h4>' +	 '<p>' + employee.details + '</p>' +		 '<p>' + employee.address + '</p>' +	 '</a></li>');  });  $('#employeeList').listview('refresh');});}

  2. I have written a javascript which gets the data in JSON format and appends that data into multiple <li>Here is the code which i have written...

    $('#employeeList').append('<li><a href="promotiondetails.html?id=' + employee.id + '">' +		 '<h4>' + employee.brand + ' - ' + employee.code + ' - '+ employee.subcode + '</h4>' +	 '<p>' + employee.details + '</p>' +		 '<p>' + employee.address + '</p>' +	 '</a></li>');

  3. Hey Everyone! i am writing a code in which i am creating multiple <li> and i have given every <li> a different href. When i am running it and when i click on the href it is add the link in the current URL. Like this... <li><a href="promotiondetails.html?id=' + employee.id + '">Some Data</a></li> The current URL is like..

    http://localhost/mano/www/promotions.html

    and this happens when i click on the <li>...

    http://localhost/mano/www/promotions.html#/mano/www/promotiondetails.html?id=275

    I don't know whats going wrong. Please help me....

  4. Hey Everyone! i have write this code for sending mail but it is not working. It is echoing the Error message.

    <?phpinclude "config.php";if(!$_POST) exit;$email = $_POST['email'];if(!preg_match('/\.([^\.]*$)/',$email )){$error.="Invalid email address entered";$errors=1;}if($errors==1) echo $error;else{$values = array ('name','email','message');$required = array('name','email','message'); $your_email = "aneeb@gmail.com";$email_subject = "New Message: ".$_POST['subject'];$email_content = "new message:\n";foreach($values as $key => $value){   if(in_array($value,$required)){  if ($key != 'subject' && $key != 'company') {    if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }  }  $email_content .= $value.': '.$_POST[$value]."\n";   }} if(@mail($your_email,$email_subject,$email_content)) {  echo 'Message sent!';} else {  echo 'ERROR!';}}?>

    Please help me..

  5. Thank you sir for your reply. I have done what you mentioned but it is stays on that same page nothing happens.I am doing it like this..

    var jsondata;$.fn.serializeObject = function(){	    var o = {};	    var a = this.serializeArray();	    $.each(a, function() {			    if (o[this.name] !== undefined) {					    if (!o[this.name].push) {							    o[this.name] = [o[this.name]];					    }					    o[this.name].push(this.value || '');			    } else {					    o[this.name] = this.value || '';			    }	    });	    return o;};$(function() {	    $('form').submit(function() {			    jsonData = JSON.stringify($('form').serializeObject());jQuery.post("save.php", {json: jsonData}, function(data){ console.log(data); });  return false;});})

    And on the PHP page i put this code to get the JSON data.

    <?php$tmp = json_decode($_POST["data"]);echo $tmp['Fname'];?>

  6. Hey Everyone! i have generated JSON from HTML form data, now i want to send that JSON to a PHP page. I have written this javascript.

      var jsondata;$.fn.serializeObject = function(){	var o = {};	var a = this.serializeArray();	$.each(a, function() {		if (o[this.name] !== undefined) {			if (!o[this.name].push) {				o[this.name] = [o[this.name]];			}			o[this.name].push(this.value || '');		} else {			o[this.name] = this.value || '';		}	});	return o;};$(function() {	$('form').submit(function() {		jsondata = $('#result').text(JSON.stringify($('form').serializeObject()));  return false;});})

    Please help me i am new to this..

  7. I have been searching on internet, i found this code which converts the HTML form data to JSON. But the code is not working when i am implementing it. Can somebody tell what is wrong with it..

    <!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" /><script type="text/javascript" src="scripts/jquery-1.5.2.js"></script><title>Untitled Document</title><script>$.fn.serializeObject = function(){	var o = {};	var a = this.serializeArray();	$.each(a, function() {		if (o[this.name] !== undefined) {			if (!o[this.name].push) {				o[this.name] = [o[this.name]];			}			o[this.name].push(this.value || '');		} else {			o[this.name] = this.value || '';		}	});	return o;};$(function() {	$('form').submit(function() {		$('#result').text(JSON.stringify($('form').serializeObject()));		return false;	});});​</script><style>form {	line-height: 2em;}p {	margin: 5px 0;}h2 {	margin: 10px 0;	font-size: 1.2em;	font-weight: bold}#result {	margin: 10px;	background: #eee;	padding: 10px;	height: 40px;	overflow: auto;}​</style></head><body><h2>Form</h2><form action="" method="post">First Name:<input type="text" name="Fname" maxlength="12" size="12"/> <br/>Last Name:<input type="text" name="Lname" maxlength="36" size="12"/> <br/>Gender:<br/>Male:<input type="radio" name="gender" value="Male"/><br/>Female:<input type="radio" name="gender" value="Female"/><br/>Favorite Food:<br/>Steak:<input type="checkbox" name="food[]" value="Steak"/><br/>Pizza:<input type="checkbox" name="food[]" value="Pizza"/><br/>Chicken:<input type="checkbox" name="food[]" value="Chicken"/><br/><textarea wrap="physical" cols="20" name="quote" rows="5">Enter your favorite quote!</textarea><br/>Select a Level of Education:<br/><select name="education"><option value="Jr.High">Jr.High</option><option value="HighSchool">HighSchool</option><option value="College">College</option></select><br/>Select your favorite time of day:<br/><select size="3" name="TofD"><option value="Morning">Morning</option><option value="Day">Day</option><option value="Night">Night</option></select><p><input type="submit" /></p></form><h2>JSON</h2><pre id="result"></pre>​</body></html>

  8. Hey Everyone! i want to convert my HTML form data to JSON and send that JSON to a PHP page on server. How can i do that. My HTML form is like this..

    <!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>Untitled Document</title></head><body id="top"><p>Enter Products</p><form id="form1" name="form1" method="post" action="create_product.php">  <p>Name	<input type="text" name="name" id="name" />  </p>  <p>Description	<input type="text" name="desc" id="desc" />  </p>  <p>Short Description	<input type="text" name="short_desc" id="short_desc" />  </p>  <p>Weight	<input type="text" name="weight" id="weight" />  </p>  <p>Price	<input type="text" name="price" id="price" />  </p>  <p>SKU	<input type="text" name="sku" id="sku" />  </p>  <p>Category	  <select id="userdata" name="category">	  <option>Choose</option>	  </select>	  </p>  <p>Promotion  <select name="promotion">  <option value="1">Yes</option>  <option value="0">No</option>  </select></p>   <p>			  <br> <label for="image"><span class="style1">Enter Image</span></label><br>			<input type="file" name="uploaded" id="uploaded" /> </br></br>			</p>  <p>Submit	<input type="submit" name="button" id="button" value="Submit" />  </p></form><p>*SKU must be unique</p></body></html>

    Please help me..

  9. Hey Everyone! i am writing a javascript for a button, when the button is pressed it gets the product id from url and add that product into the cart. The button is working fine but the problem is when i am pressing the button the screen hangs and a flash screen appears which is loading continously. I have also applied css in it for button.here is the javascript which i have written..

     $('#detailsPage').live('pageshow', function(event) {var id = getUrlVars()["id"];var serviceURL = "http://localhost:8080/mano2/services/";$.getJSON(serviceURL + 'getmagento1.php?id='+id, displayPromotion);});var  prodid ;function getUrlVars() {	var vars = {};	var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {		vars[key] = value;	});	return vars;}function displayPromotion(data) {	var promodetails = data.item;console.log(promodetails);$('#promopic').attr('src', 'media/catalog/product/' + promodetails.small_image);$('#code').text(promodetails.name + ' ' + promodetails.name);$('#details').text(promodetails.price);$('#address').html('<a id="bttn" href="http://localhost:8080/magento/index.php/checkout/cart/add?product=' + promodetails.entity_id + '&qty;=1" >add to cart</a>');$('#bttn').css({"width":"130px","height":"50px","padding":"0","display":"block","text-align":"center","text-decoration":"none","line-height":"48px","font-family": "'Tienne', sans-serif","font-size":"20px","font-weight":"bold","color":"black","margin":"10px auto","-moz-border-radius":"5px","-webkit-border-radius":"5px","border-radius":"5px","border-width":"2px","border-style":"solid","border-color":"#ccc #333 #777","background-color": "black7", /* Old browsers */"background-color":"-moz-linear-gradient(top, #878787 6%, #3d3d3d 49%, #000000 50%, #000000 100%)", /* FF3.6+ */"background-color": "-webkit-gradient(linear, left top, left bottom, color-stop(6%,#878787), color-stop(49%,#3d3d3d), color-stop(50%,#000000), color-stop(100%,#000000))", /* Chrome,Safari4+ */"background":" -webkit-linear-gradient(top, #878787 6%,#3d3d3d 49%,#000000 50%,#000000 100%)", /* Chrome10+,Safari5.1+ */"background": "-o-linear-gradient(top, #878787 6%,#3d3d3d 49%,#000000 50%,#000000 100%)", /* Opera11.10+ */"background":" -ms-linear-gradient(top, #878787 6%,#3d3d3d 49%,#000000 50%,#000000 100%)", /* IE10+ */"filter": "progid:DXImageTransform.Microsoft.gradient( startColorstr='#878787', endColorstr='#000000',GradientType=0 )", /* IE6-9 */"background": "linear-gradient(top, #878787 6%,#3d3d3d 49%,#000000 50%,#000000 100%)", /* W3C */},{"hover":{"background": "#878787", /* Old browsers */"background": "-moz-linear-gradient(top, #878787 6%, #3d3d3d 19%, #000000 21%, #000000 100%)",/* FF3.6+ */"background":" -webkit-gradient(linear, left top, left bottom, color-stop(6%,#878787), color-stop(19%,#3d3d3d), color-stop(21%,#000000), color-stop(100%,#000000))", /* Chrome,Safari4+ */"background": "-webkit-linear-gradient(top, #878787 6%,#3d3d3d 19%,#000000 21%,#000000 100%)", /* Chrome10+,Safari5.1+ */"background":" -o-linear-gradient(top, #878787 6%,#3d3d3d 19%,#000000 21%,#000000 100%)", /* Opera11.10+ */"background": "-ms-linear-gradient(top, #878787 6%,#3d3d3d 19%,#000000 21%,#000000 100%)", /* IE10+ */"filter": "progid:DXImageTransform.Microsoft.gradient( startColorstr='#878787', endColorstr='#000000',GradientType=0 )", /* IE6-9 */"background": "linear-gradient(top, #878787 6%,#3d3d3d 19%,#000000 21%,#000000 100%)" /* W3C */}});console.log(promodetails.name);$('#actionList').append('<li><h3>Dates</h3>' +'<p>This promotion starts from  ' + promodetails.name + '</p><p> And will end at '+promodetails.price+'</p></li>');$('a#bttn').bind("click", function(event) {event.preventDefault();var url = $(this).attr("href");	alert("Now I want to call this page: " + url);$.ajax({  type: "GET",  url:url,  success: function() {	alert("Product added to cart");  }});});$('#actionList').listview('refresh');}function getUrlVars() {	var vars = [], hash;	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');	for(var i = 0; i < hashes.length; i++)	{		hash = hashes[i].split('=');		vars.push(hash[0]);		vars[hash[0]] = hash[1];	}	return vars;}

    Please help me i am new to this...

  10. I am using SOAP API for entering products in magento shops.here is the full code..

    $client = new SoapClient('http://localhost/magento/api/v2_soap/?wsdl');$session = $client->login('apiKey', 'apiValue');$attributeSets = $client->catalogProductAttributeSetList($session);$attributeSet = current($attributeSets);$result = $client->catalogProductCreate($session, 'simple', $attributeSet->set_id, $sku, array(    'categories' => array($category),    'websites' => array(1),'user' => array($username),    'name' => $name,    'description' => $desc,    'short_description' => $short_desc,    'weight' => $weight,    'status' => '1',    'url_key' => 'test product-url-key',    'url_path' => 'test product-url-path',    'visibility' => '4',    'price' => $price,    'tax_class_id' => 1,    'meta_title' => 'Product',    'meta_keyword' => 'Product meta keyword',    'meta_description' => 'Product meta description',  'additional_attributes' => array   (   array('key' => 'user', 'value' => 'aneeb'))));var_dump ($result);

    the other values are entering properly but the additional attribute value is not working.

  11. Hey everyone! i am trying to enter data in additional attribute through API in magento shop.I have tried this code but it is not working the data is not entering..

      'additional_attributes' => array   (   array(			'key' => 'user',			'value' => 'aneeb'))

    Please tell me what i am doing wrong or tell me how can i enter data in additional attributes through API in magento shop....

  12. Hey everyone! i am creating a dynamic drop down menu in html, but the values are not coming in the drop down, it shows an empty menu. I am calling the PHP file which is echoing JSON of the data. here is the Javascript code..

    $(function(){var serviceURL = "http://localhost/mano-2/";var get = '';  get = 'echo_cat.php';  var items="";  $.getJSON(serviceURL + get , function(data){	$.each(data,function(index,item)	{	  items = items + "<option value='"+item.entity_id+"'>"+item.name+"</option>" ;	});	$("#a1_title").html(items);  });}); 

    the JSON is like this

    {"items":[{"entity_id":"1","name":"Root Catalog"},{"entity_id":"2","name":"Default Category"}]}

    the HTML code is like this

    <select id="a1_title">  <option>Default</option></select>

    Please help me..

  13. Hey everyone! i am trying to fetch data from different file locations, every time there is a new location like this /5/3/539238_375049019231475_1212083119_n.jpg/3/0/309320_396625203733616_1897402511_n.jpg/n/i/nike.jpg I want to get data from all these locations in a single query, how do i get it? Please help me..

  14. Hey everyone! i am having some problem. In my code i am fetching data from multiple tables, but the code is having some problem it give me "mysql_fetch_array() expects parameter 1 to be resource, boolean given " error ... here is my code

    <?php$localhost="localhost";$dbuser="root";$dbpass="";$dbname="shoppro";$connect=mysql_connect($localhost,$dbuser,$dbpass);if ( !$connect ){echo "Error connecting to database.\n";}mysql_select_db("$dbname",$connect);$count = "select count(*)-1 from core_store_group";$i = '';$sql = '';for($i=0;$i<$count;$i++){$sql = "select name,price,short_description,sku,weight,promotion from catalog_product_flat_'".$i."'". "UNION ALL";}$query=$sql.substr(0,$sql.strlen($sql)-9);$result=mysql_query($query);while($row=mysql_fetch_array($result)){echo $row['name'];}?>

    please help me !!

×
×
  • Create New...