Tuesday 9 June 2015

Email Already Exit Using Jquery And Php

Hello All,

I am Simple Learn How to check email already exit. I am create code and check if

email already exit then you cannot submit  and also also validation of email.

I am give the code for that you can check it and use it.

you have to create to file

1)email.php
2)check.php

in your email.php wriite this code

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
 
   $("#myform").submit(function(){
 
       if(!emailok)
       {
        alert('check your email');
        return false;
       }
   
    });
$('#email').blur(function(){
   alert($('#email').val());
    $.ajax({
        type:"post",
        data:"email="+$('#email').val(),
        url:"check.php",
        beforeSend:function(){
            $("#email_info").html("checking email...");
        },
        success:function(data){
         
            if(data == "invalid"){
                $("#email_info").html("check your Email");
           
       
            emailok = false;
            }else if(data !="0"){
                  $("#email_info").html("email already exit");
             
            }else{
            emailok = true;
            $("#email_info").html("email ok");
            }
         
         
        }
     
     
     
    });
 
    });
});
</script>
<form id="myform" method="post">
<input type="text" id="email" name="email"/>
<input type="submit" />
</form>
<div id="email_info"></div>


second file is check.php

add this code

<?php
 $dbhost = 'localhost';
   $dbuser = 'root';
   $dbpass = '';
   $conn = mysql_connect($dbhost, $dbuser, $dbpass);
   if(! $conn )
   {
     die('Could not connect: ' . mysql_error());
   }

 
   mysql_select_db('blog',$conn);
 
   $email = $_POST['email'];
 
   if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
 
   $sql =  mysql_query('select email from email where email="'.$email.'"' );
 
   $result = mysql_fetch_array($sql);
 
 
 
    echo $num = mysql_num_rows($sql);
 }else{
 
    echo "invalid";
 }
 
 
 
 
 
 
   mysql_close($conn);
?>

table code

--
-- Table structure for table `email`
--

CREATE TABLE IF NOT EXISTS `email` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email` varchar(200) NOT NULL,
  `password` varchar(200) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `email`
--

INSERT INTO `email` (`id`, `email`, `password`) VALUES
(1, 'test@gmail.com', 'test'),
(2, 'teset@gmail.com', 'test');

Friday 5 June 2015

Convert String To Title Case With Jquery And Title Case Microsoft Office

Hello All,


This My learn how to change title case using jquery. I am also Learn that how to
change title case in MsOffice.

When I have Text  TO HAVE A CLEAR AND FOCUSSED CONTENT  in MsOfiice
I am want to change it into To Have A Clear And Focussed Content. I have no Idea 
about that. I am also don't what to say in MsOffice that's I want to make code in jquery.

I have change manually but  I thought if I have many of text that I do code. I also Find instruction

in Msoffice.

It That


  1. Select the text you want to alter.
  2. Press Shift+F3. Word changes the case of the selected text.
  3. Continue pressing Shift+F3 until the case is the way you want it.

When First i select text TO HAVE A CLEAR AND FOCUSSED CONTENT and press shift+f3
it make it Small. after again press Shift+f3. Then Get this text To Have A Clear And Focussed Content.

So I think When Get code Also using Jquery then  I Will Put here and try some one
who can khow developing.



<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    
    var text = $('.capitalize').text();
    
    var ti = toTitleCase(text);

      $('.capitalize').empty();
      $('.capitalize').append(ti);
    function toTitleCase(str)
{
    return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}

});
</script>
<div class='capitalize'>
    TO HAVE A CLEAR AND FOCUSSED CONTENT
</div>

in div you can put your text and check in your browser you can get output.



Tuesday 2 June 2015

Create Child Theme Of Wordpress Theme And Create Template In Wordpress

Hello All,

Here Simple Create Child theme in wordpss and how to create template in Wordpress.
Here I see the example of make child theme twentythirteen. same step use you can
create any of theme child theme.

Use Of child theme.

Child theme very usefull. because some time theme have update. we can update it theme
then you can change stucture is removed. but you can make child theme can be usefull.

Simple Follow Step you can create child theme in wordpress Easily.

Step:1 
First Goto Wordpress Theme Folder.=>/wp-content/themes/
Then Create child Theme Like I am Create thirteenchild Folder.

Step:2
Here Simple create style.css and add the below code.

/*
Theme Name:     twentythirteenchild
Theme URI:      http://myphpinformation.blogspot.in
Author:         coder
Author URI:     http://myphpinformation.blogspot.in
Template:       twentythirteen
Version:        0.1
*/


@import url("../twentythirteen/style.css");

Step:3
After login your dashboard (wordpress Admin) 
Go To :=> Appearance > Themes
and active your theme child theme. here theme name is twentythirteenchild.

Second How to create template in wordpress.

Step1:-
you want to create template. you just copy page.php file or create new page 

if you want to create page template it's better to copy page.php file. 

Step2 : 

page.php ot new page add below code in header.

<?php /* Template Name: My Custom Page */ ?>

check it wp-admin page=>edit or new page you can see On the right hand side under attributes you’ll see template.



Friday 29 May 2015

magento on hover change product image in catalog.

Hello

I am One Issue. I am change image in product listing page. when i am hover the image it can be change image after mouse out then default image can be see.

I am Writing code for that you can check that can help you.

 <?php $defaultSelectedImage = basename($this->helper('catalog/image')->init($_product, 'small_image')->resize(215));?>
         
            <?php  $defaultSelectedImage_url = $this->helper('catalog/image')->init($_product, 'small_image')->resize(215);  ?>
                   <?php $_galleryImages = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages();
               
                        foreach($_galleryImages as $_gimages){
                            $gallerySelectedImage = basename($this->helper('catalog/image')->init($_product, 'small_image',$_gimages->getFile())->resize(215));
                       
                           if($defaultSelectedImage != $gallerySelectedImage){
                       
                     
                       
                       
                             $_hover_image = $this->helper('catalog/image')->init($_product, 'small_image',$_gimages->getFile())->resize(215);
                           
                             break;
                       
                     
                       
                         
                        }
                       
                        }
                    ?>  
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
             

 <img onmouseover="this.src = '<?php echo $_hover_image; ?>';"  src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(215); ?>"
                onmouseout="this.src = '<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(215) ?>';"
                 alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
            </a>

check this code it can be Look Good.




Thursday 28 May 2015

Remove Default Magneto Block Like News letter,Paypal Logo,Popular Tag

Hello
I here Remove this Magneto default block

Remove Poll,
Remove Popular Tags,
Remove Paypal logo Sample Data,
Remove Layered navigation on search result page,
Remove Reorder Sidebar When User Logged, in Dashboard,
Remove Customer Navigation,
Remove Cart Sidebar,
Remove Related products sidebar,
Remove Wishlist Sidebar,
Remove Compare Items Sidebar,
Remove Right Callout Sample Data,
Remove Left Callout Sample Data,
Remove Viewed Products,
Remove Compared Products,
Remove Layered Navigation,
Remove Sidebar Newsletter,

I can give reference of all block.

Chcek Below Code.

you can remove block using xml. here you can remove block using

remove after it 's block name.


<?xml version="1.0"?>
<layout>
    <default>
            <!--Magento's Default Sidebar Blocks-->
        <remove name="right.poll"/>                     <!--Poll-->
        <remove name="tags_popular"/>                   <!--Popular Tags-->
        <remove name="paypal.partner.right.logo"/>      <!--Paypal logo Sample Data-->
        <remove name="catalogsearch.leftnav"/>          <!--Layered navigation on search result page-->
        <remove name="sale.reorder.sidebar"/>           <!--Reorder Sidebar When User Logged, in Dashboard-->
        <remove name="customer_account_navigation"/>    <!--Customer Navigation-->
        <remove name="cart_sidebar"/>                   <!--Cart Sidebar-->
        <remove name="catalog.product.related"/>        <!--Related products sidebar-->
        <remove name="wishlist_sidebar"/>               <!--Wishlist Sidebar-->
        <remove name="catalog.compare.sidebar"/>        <!--Compare Items Sidebar-->
        <remove name="right.permanent.callout"/>        <!--Right Callout Sample Data-->
        <remove name="left.permanent.callout"/>         <!--Left Callout Sample Data-->
        <remove name="right.reports.product.viewed"/>   <!--Viewed Products-->
        <remove name="right.reports.product.compared"/> <!--Compared Products-->
        <remove name="catalog.leftnav"/>                <!--Layered Navigation-->
        <remove name="left.newsletter"/>                <!--Sidebar Newsletter-->
    </default>

</layout>

Monday 25 May 2015

Color Image Swicher in Magento

Hello Friends,

One site i see that when click on image icon in then change image color.
i am searching that any extension  in magneto but mostlly find paid.

then i am try to make simple image swicher or color swicher in magneto.

Check it my code that can help it.


GoTo Admin->manageproduct->addnewproduct(or edit product).

Check Below image we can create custom option in product. here check image for it.

Step1 :  Create custom option


color swicher


Step2: Add Image and also give the label to images

color swicher


After your current theme header.phtml file.

add this script in this your header.phtml

<script type="text/javascript">
jQuery(document).ready(function() {
   

   
    jQuery("#select_3").change(function() {
    var optionValueText = jQuery.trim(jQuery('#select_3 :selected').text());
    if(optionValueText != "-- Please Select --")
    {
        alert("#image" + optionValueText);
        var image = "image" + optionValueText;
        jQuery("."+image+".cloud-zoom-gallery").trigger('click');
        jQuery("#image" + optionValueText).show();
    }
    });

});
</script>

in this script comment alert. 

also check id of selectbox

image swicher


I am added Moo_Cloudzoom Extention for so you can added it.

Here it's Media.phtml file it path is in template\moo\catalog\product\view\

Here replace  this code.

foreach ($galleryImages as $_image) {
        $id =  $this->htmlEscape($_image->getLabel());
        $gallery .= '<a id="cloud-zoom-gallery' . $i . ' " href="' . $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()) . '" '
                . 'rel="useZoom: \'cloudZoom\', smallImage: \'' . $this->getCloudImage($this->getProduct(), $_image) . '\'" class="cloud-zoom-gallery image'.$id.'" title="' . $this->htmlEscape($_image->getLabel()) . '">'
                . '<img src="' . $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56) . '" width="56" height="56" alt="' . $this->htmlEscape($_image->getLabel()) . '"  />'
                . '</a>';
    }

In this i am added on $id. here I am getting image label. this is added in class in a tag.

i am making with back color. this code added in your media.phtml file. check it
the output.

I am adding after addind code you can change selectbox color value you can change color of image








Thursday 21 May 2015

Magento Add Breadcrumbs For CMS Page

Hello

I am issue in magento breadcrumbs.

issue is that i am create shop page in magento cms page. i am added all product in default category.
it's working fine. but it can not show Breadcrumbs in this page. i am searching on internet
i am checking in admin panel
admin -> system ->config-> web -> default pages -> Show Breadcrumbs for CMS Pages ->yes
but only shop page cms page not display breadcrumbs. other cms page display breadcrumbs.

that i am search for how to add breadcrumbs using xml in cms page i am found that we can
added breadcrumbs manully i am added this code it's working properlly

I am added this code in you cms page. edit your cmspage ->design->Layout Update XML->

I am adding this code



 breadcrumbs  
   
       <reference name="root">
<action method="setTemplate"><template>page/category.phtml</template></action>
 <action method="unsetChild"><alias>breadcrumbs</alias></action>    
    <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs">
        <action method="addCrumb">
            <crumbName>Home</crumbName>
            <crumbInfo><label>Home</label><title>Home</title><link>/</link></crumbInfo>
        </action>
        <action method="addCrumb">
            <crumbName>About us</crumbName>
            <crumbInfo><label>SHOP</label><title>SHOP</title></crumbInfo>
        </action>      
    </block>
</reference>
SHOP
       
         


this code for breadcrumbs my page name is shop add title shop and also change label shop

breadcrumbs  
    <action method="unsetChild"><alias>breadcrumbs</alias></action>    
    <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs">
        <action method="addCrumb">
            <crumbName>Home</crumbName>
            <crumbInfo><label>Home</label><title>Home</title><link>/</link></crumbInfo>
        </action>
        <action method="addCrumb">
            <crumbName>About us</crumbName>
            <crumbInfo><label>SHOP</label><title>SHOP</title></crumbInfo>
        </action>      
    </block>
         

I think you can help this code.