Sunday, June 23, 2013
Tuesday, June 4, 2013
Href click submit jQuery, Simple JQuery validation, Form submit and reset jQuery. Self refresh jQuery
How to submit form with anchor tag/ href/a click in jquery?
Reload and Reset form jquery?
Simple validation in Jquery
// bind "click" event for links with title="submit"
$("a#submitcontact").click( function(){
// it submits the form it is contained within
$(this).parents("#register-form").submit();
});
$("#register-form").submit(function() {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
//$("#inline").empty().append('abc');
var address = $("input[name=Email]").val();
var emailError = true;
if($("input[name=Nama]").val() == ''){
$("#inline").empty().append('Please enter your Name.');
$('#Nama').focus();
return false;
}
else if($("textarea[name=Alamat]").val() == ''){
$("#inline").empty().append(' Please enter your Alamat');
$('#Alamat').focus();
return false;
}
else if($("input[name=Email]").val() == ''){
$("#inline").empty().append(' Please enter your E-mail address');
$('#Email').focus();
return false;
}
else if(!reg.test(address)) {
//emailError = true;
$("#inline").empty().append('Please enter your valid E-mail address.');
$('#Email').focus();
return false;
}
else if($("input[name=NoTelp]").val() == ''){
$("#inline").empty().append('Please enter your NoTelp.');
$('#NoTelp').focus();
return false;
}
else if($("textarea[name=Pesan]").val() == ''){
$("#inline").empty().append(' Please enter your Pesan');
$('#Pesan').focus();
return false;
}
else{
return true;
}
});
$("a#reseter").click( function(){
// it submits the form it is contained within
//opener.location.reload(true);
window.location.href = "contact.html";
// $(this).closest('form').find("input[type=text], textarea").val("");
// $(this).parents("#register-form").reset();
});
});
Wednesday, May 29, 2013
Location based Auto currency Updater in PHP, Currency and Update with two different sites..
$exectime = microtime();
$exectime = explode(" ",$exectime);
$exectime = $exectime[1] + $exectime[0];
$starttime = $exectime;
function get_geo_ip_code_wtanka($ipaddr)
{
set_time_limit(3); /// time in second 3 sec if it will take more then means next function will be load..
$userip = file_get_contents("http://geoip.wtanaka.com/cc/".$_SERVER['REMOTE_ADDR']);
$userip = strtolower($userip);
return $userip;
}
//echo $userip;
function get_geo_ip_code_sourceforge($ipaddr)
{
$userip = file_get_contents("http://ip2country.sourceforge.net/ip2c.php?format=JSON&ip=$ipaddr");
$userip = str_replace('"','',$userip);
$userip = '"'.$userip.'"'; /* it will returns u the JSON formate however u want u can change*/
$otup = json_decode($userip);
$otup = str_replace('{','',$otup);
$otup = str_replace('}','',$otup);
$otup = explode(',',$otup);
$len = count($otup);
$new = array();
for($i=1;$i<$len;$i++)
{
$rite = explode(':',$otup[$i]);
$new[] = array($rite[0]=>$rite[1]);
}
$value = strtolower($new[1]['country_code']);
$value = $value;
return $value;
}
$userip = get_geo_ip_code_wtanka($_SERVER['REMOTE_ADDR']) ;
$exectime = microtime();
$exectime = explode(" ",$exectime);
$exectime = $exectime[1] + $exectime[0];
$endtime = $exectime;
$totaltime = ($endtime - $starttime);
$ipaddr =$_SERVER['REMOTE_ADDR'];
if($totaltime>=3 || !file_exists("http://geoip.wtanaka.com/cc/$ipaddr") )
$userip = get_geo_ip_code_sourceforge($_SERVER['REMOTE_ADDR']);
Tuesday, January 8, 2013
Php - RSS feed into website
<?php
$feed = file_get_contents('http://samplesite.com/index.rss');
$rss = new SimpleXmlElement($feed);
foreach($rss->channel->item as $values) {
//var_dump($value);
//print_r($value);
//echo "<a href='$value->link' title='$value->title' target='_blank' >" . $value->title . "</a>";
}
?>
TIPS :
un-cmd var dump and view source .... u will getta good idea to split how u want....
un-cmd the print_r u will geta correct key values of the feed.....
Hope it will be useful this
Wednesday, October 10, 2012
Opencart issue . user multiple address not able to delete - bug fixed
Opencart version 1.5.3 and above...
we need to edit the code in catalog/controlles/account/address
find this line " $this->model_account_address->getTotalAddresses()"
existing code :
if ($this->model_account_address->getTotalAddresses()) {
$this->error['warning'] = $this->language->get('error_delete');
}
New Code :
(replace the above "existing code" to "New code" )
if ($this->model_account_address->getTotalAddresses() < 1) {
$this->error['warning'] = $this->language->get('error_delete');
}
Thanks to :
http://code.google.com/p/opencart/issues/detail?can=2&start=0&num=100&q=&colspec=ID Type Status Priority Milestone Owner Summary Reporter&groupby=&sort=&id=995
Magento CMS ADMIN Panel
In Admin-> CMS Module we have four Sub modules
- Pages { Its used to create the new pages. }
- Static blocks { Its used to create the new static block (like advertisement blocks etc) we can use this block where we wanted. }
- Widgets { Its used to improve the appearance of the store and communicate to other applications (like social network sites) }
- Polls { Its used to know the consumer or online users satisfaction ,and used to find and avoid the lack of Business. }
Pages
How to create the page?
Admin- > CMS -> Pages -> Add new page(Button)
- Page information *
we can set page which store we wanted .
- Content
- Design
we have four type of layout styles . 1 column ,2 columns with left bar ,2 columns with right bar ,3 columns.
our design will set the page style.
- Mata data
Content and Key words used to increase the traffic of our page and site.
After these we have to save the page.
If you want add the page link means you can use
<a href="{{store direct_url="new_home"}}">New Home</a>
call the above anchor tag in where you want. here " new_home" is the URL Key and "New Home" which is the Page title.
Static blocks
How to create the Static blocks?
Admin- > CMS -> Static blocks-> Add new Block(Button)
Block Title *
Identifier *
Store View *
Status *
Content *
we have to fill the above all .
If u wanted to add the block to ur page means you can use following code
{{block type="cms/block" block_id="ehp" }}
here ehp is a Identifier what you gave.
call above code to your page or which page you wanted.
Widgets
Admin- > CMS -> Pages -> Widgets ->Add New Widget Instance(Button) .
- Settings we can use the existing Widgets.
How to create Widgets by coding level through the MVC approach ?
Reference Url
http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-a-magento-widget-part-1 .
if you want to call the widget in your block or page go content -> WYSIWYG editor -> Insert widget option (2nd one from left top on editor)
Polls
Admin- > CMS -> Pages -> Polls ->Add New Poll (Button) .
Poll information and poll question and answer is needed . we have to fill above all.
and we have to "open" the polling option if we want.
Note : If we open(Active) two or three polling options means . that will show the front end one by one.
Multiple Pop in same page-Jquery .
u can use the following code you can easly add the same type of popups in samp page with diff "div"
<head runat="server">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script> <style type="text/css">
.web_dialog_overlayback
{
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 100%;
width: 100%;
margin: 0;
padding: 0;
background: #000000;
opacity: .15;
filter: alpha(opacity=15);
-moz-opacity: .15;
z-index: 101;
display: none;
}
.web_dialog
{
display: none;
position: fixed;
width: 380px;
height: 200px;
top: 50%;
left: 50%;
margin-left: -190px;
margin-top: -100px;
background-color: #ffffff;
border: 2px solid #336699;
padding: 0px;
z-index: 102;
font-family: Verdana;
font-size: 10pt;
}
.web_dialog_title
{
border-bottom: solid 2px #336699;
background-color: #336699;
padding: 4px;
color: White;
font-weight:bold;
}
.web_dialog_title a
{
color: White;
text-decoration: none;
}
.align_right
{
text-align: right;
}
</style>
<script type="text/javascript">
$(function (){
$("#btnShowSimple").click(function ()
{$("#overlay").show(); $("#dialog").fadeIn(300);
if (modal){$("#overlay").unbind("click"); }
else {$("#overlay").click(function (){$("#overlay").hide();$("#dialog").fadeOut(300);});}});
$("#btnClose").click(function (){$("#overlay").hide();$("#dialog").fadeOut(300);});});
$(function (){ $("#Simple").click(function ()
{$("#overlay1").show(); $("#dialog1").fadeIn(300);
if (modal){$("#overlay1").unbind("click"); }
else{$("#overlay1").click(function (){$("#overlay1").hide();$("#dialog1").fadeOut(300);});}});
$("#btnClose1").click(function (){$("#overlay1").hide();$("#dialog1").fadeOut(300);});});
</script>
</head>
<body>
<h3>JQuery Multiple Popup Dialogs in same page </h3>
<a id="btnShowSimple" value="Simple Dialog" /> cickhere</a>
<br />
<br />
<div id="overlay" class="web_dialog_overlayback"></div>
<div id="dialog" class="web_dialog">
<a href="#" id="btnClose">Close</a>
content one <!--you can add anything inside of this div-->
</div>
<br />
<br />
<a id="Simple" value="Simple Dialog" /> donglee</a>
<div id="overlay1" class="web_dialog_overlay"></div>
<div id="dialog1" class="web_dialog">
<a href="#" id="btnClose1">X</a>
content two <!--you can add anything inside of this div-->
</div>
</body>
</html>
Subscribe to:
Posts (Atom)