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.







Wednesday 20 May 2015

how can add span in breadcrumbs in magneto?

Hello

I have Issue in My magento. i have add span beetween description.

Here Only I want to change in magento result page (search page).

THis In My Question


Here My breadcrumbs html

  • Home

i want span at 


between search and ring 

i like this 


result.php my breadcrumbs code 

$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
        if ($breadcrumbs) {
            $title = $this->__("Search > %s",$this->helper('catalogsearch')->getQueryText());

            $breadcrumbs->addCrumb('home', array(
                'label' => $this->__('Home'),
                'title' => $this->__('Go to Home Page'),
                'link'  => Mage::getBaseUrl()
            ))->addCrumb('search', array(
                'label' => $title,
                'title' => $title

            ));
        }

I Found Solution From magento.stackexchange site.


The text you put in the breadcrumbs is escaped before printing so you won't be a victim of XSS. So any tag you put in the breadcrumbs label will be shown as a tag in the frontend and won't be interpreted.
But you can achieve what you need like this
You need to add after this line:

$title = $this->__("Search > %s",$this->helper('catalogsearch')->getQueryText());

this
$label = $this->__('Search <span></span>');//span add here
$label .= Mage::helper('core')->escapeHtml($this->helper('catalogsearch')->getQueryText());

This will make your query string escaped before sending it to the breadcrumbs template.

You will also have 2 variables instead of one. $title will still have the original text so you can use it as title for the span element (this will be escaped) and $label that you can use as the span innerHTML.
Now you need to tell the template not to escape the $label again.

So replace this

 ->addCrumb('search', array(
     'label' => $title,
     'title' => $title
 ))

with 

->addCrumb('search', array(
     'label' => $label,
     'title' => $title,
     'no_escape' => true
 ))

Now you need to edit the breadcrumbs template an remove the htmlEscape when the no_escape element is true.



Replace this section

if($_crumbInfo['link']): 
    echo $this->htmlEscape($_crumbInfo['label']) 
elseif($_crumbInfo['last']): 
    echo $this->htmlEscape($_crumbInfo['label']) 
else: 
    echo $this->htmlEscape($_crumbInfo['label']) 
endif; 
with this


if (isset($_crumbInfo['no_escape']) && $_crumbInfo['no_escape']) : 
    $label = $_crumbInfo['label'];
else : 
    $label = $this->htmlEscape($_crumbInfo['label']) ;
endif;
if($_crumbInfo['link']): 
    echo $label 
elseif($_crumbInfo['last']): 
    echo $label 
else: 
    echo $label 
endif; 
    

    

Monday 18 May 2015

Magento Search Catalog Not Working : Fixed

Hello

I am search in magento but it's not give me poper result.

I am Seaching on net many of solution i get but not working.

after i can found one wordpress blog there is set this type of line

i can follow that instruction it's working properlly.

First i am do some instruction.

If your magento search is not working by Your search returns no results.  the solution is right bellow.

go to System->Configuration->Catalog and check that in Catalog Search the Search Type field is like. it change to Combine (Like and Fulltext) select and save it.


after Go to System->Index Management and reindex Catalog Search Index and all indexes that require indexing.

Also,
System->Cache Management and clear your cache, or disable it.

you can do this step also if it can be give the result.
Go to Catalog->Manage Products and select visible products.
Choose the Update Attributes action form the right panel and click Submit button.
Click on the Websites tab from the left and check the Main Website.

below step is search page not give any result that follow upper step.


IF Your Magento search not give proper result then follow step here.

goto -> app/code/core/mage/catalogsearch/block/Result.php
set in your local file
/app/code/local/Mage/CatalogSearch/Block/Result.php

in set your Result.php change some code in your file

step 1 ) Uncomment lines 149 and 150

$this->getListBlock()
->setCollection($this->_getProductCollection());

step 2 ) Modify this  the line 172

change this line
$this->_productCollection = $this->getListBlock()->getLoadedProductCollection();

to

$this->_productCollection = Mage::getSingleton(‘catalogsearch/layer’)->getProductCollection();


goto the admin  panel (System -> Index Management) and select all the

Indexes > Pick action is “Reindex data” > and the press “submit” button.

And also one thing in admin panel is catalog search setting

Goto the System -> Config -> Catalog -> “Catalog Search”

Here, you can change your search type like, fulltext or both as you need.

i work this code you can check i hope it's working you give proper result.




Sunday 17 May 2015

Remove Image Title In Wordpress

Hello All,

Some Time you have requirement to remove image title in wordpress site.
but you added lots of image and also if you can change manully then it so
long work.

when yon remove image title  content. you can use this code and check it.

it's only change when you added image in wordpress editor. but when you can
create plugin on use any plugin in when added image title that can not remove that.
there you can use simple Jquery

Use  AnD Remove Image Title In Content Filter check below code.

This code added in you current theme functions.php also you can create plguin for it

add_filter('the_content', 'remove_images_titles');
function remove_images_titles($text) {

    // Get all title="..." tags from the html.
    $result = array();
    preg_match_all('|title="[^"]*"|U', $text, $result);

    // Replace all occurances with an empty string.
    foreach($result[0] as $img_tag) {
        $text = str_replace($img_tag, '', $text);
    }

    return $text;
}


But you can remove image title in all wordpress site follow simple jquery and 
check result

jQuery(document).ready(function($) {
$("img").removeAttr("title");
}

this code added in your header.php after added all script in wrdpress.

refresh your site check it using firebug it can be remove image title.

please tell me this can be helpfull or not? comment Please?


Monday 11 May 2015

Change xampp or Wamp apache port number

Hello All,

Chnage xampp or wamp apache port number 


I am Just here Tell you How to change xampp or wamp apache port number.
Chnage xampp or wamp apache port number


In Wamp and xampp apache port in 80. 80 is it's defualt port in wamp and xampp.

so some time issue with in skyppe,sql server because then also use port 80.

if we want to use xamp and wamp port 80 then we can stop service sql sql.

and in skypee you can stop to use 80 port then follow below step

1) first goto skypee 
2) tools -> options
3)in options -> advance tab -> connection
4) Then un check the check box of use port 80 and 443 for addtions incoming connections

Change Wamp apache port number 

Step1 ) Open file "httpd.conf" with notepad++ or any editor you can use like (dream viewer,PHP designer) in  D:\wamp\bin\apache\Apache2.4.4\conf\original

Here I am Install in D Drive then my path is that. when you install wamp 
check there. "youWamp Install Drive"\wamp\bin\apache\Apache2.4.4\conf\original

Step2) After Fine use ctrl+f and find "80", the are 2 places which you need to change.

step 3) Change port 80 to be ther number, such as 88(as you wish)

step 4) After changes, restart the wamp

now listen 80 to listen 88

and servername localhost 80 to localhost:88

but make sure that new port change in httpd.conf can not use any another program.


Change Xampp apache port number 

Step1 ) Open file "httpd.conf" with notepad++ or any editor you can use like (dream viewer,PHP designer) in  E:\xampp\apache\conf

Here I am Install in E Drive then my path is that. when you install wamp 
check there. "your Xampp Install Drive"\xampp\apache\conf

Step2) After Fine use ctrl+f and find "80", the are 2 places which you need to change.

step 3) Change port 80 to be ther number, such as 88(as you wish)

step 4) After changes, restart the xampp

now listen 80 to listen 88

and servername localhost 80 to localhost:88

but make sure that new port change in httpd.conf can not use any another program.

Change xampp or Wamp apache port number

In localhost access this type locahost:88/blogger 

Give Me Comment is blog usefull or not 

Thanks






Thursday 7 May 2015

Contact form in Wordpress



Contact form in Wordpress


Hello  All,

Mostly Use Contact Form In Web site.

I am Create simple code  for add contact form in wordpress.

It's Only Example No Plugin required. You can also Custimise;

I am create Name,Email,Message Fild in wordpress;

CREATE TABLE IF NOT EXISTS `wp_myphpinformation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `message` varchar(225) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

I am create this table in my php admin.

Create templete In Wordpress


/*
Template Name: My Custom Page
*/

Copy the page.php of your current theme and change name like contactform.php

After adding a comment and check with your admin this template.


I am here add full Ecample Code Check IT. I hope you like;

it's contactform.php

<?php

/*
Template Name: My Custom Page
*/
?>
<?php get_header(); ?>
<?php
        if (!empty($_POST)) {
        global $wpdb;
            $table = wp_myphpinformation;
            $data = array(
                'name' => $_POST['yourname'],
                'email'    => $_POST['email'],
                'message' =>  $_POST['message']
            );
            $format = array(
                '%s',
                '%s',
                '%s'
            );
            $success=$wpdb->insert( $table, $data, $format );
            
            
            if($success){
            echo 'data has been save' ; 
}
}
else   {
?>
        <form method="post">
       

Contact Me

        <input type="text" name="yourname"/><br />
        <input type="text" name="email"/><br />
        <textarea name="message"></textarea><br />//textarea code
        <input type="submit"/>
        </form>

       <?php }  ?>
       <div class="contact">
       <table>
        <tr>
        <td>Name</td>
        <td>Email</td>
        <td>Message</td>
        </tr>
       <?php 
       
       $results = $wpdb->get_results( 'SELECT * FROM wp_myphpinformation', OBJECT );
       
       foreach($results as $result){?>
        
        <tr>
        <td>php echo $result->name; ?></td>
        <td>php echo $result->email; ?></td>
        <td>php echo $result->message; ?></td>
        </tr>
        
        
        
      <?php }
       
       ?>
       </table>
       </div>

<?php get_footer(); ?>

Monday 4 May 2015

Errors file upload in PHP

Hello

Here Very small errors are found in file upload.

You can find the code for file uploading from the internet  but you can make some mistake.

I Will oberserve you. mostlly mistake in file upload.

1) in form html enctype="multipart/form-data"


<form action="" method="post" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="fileToUpload" id="fileToUpload"/>
    <input type="submit" value="Upload Image" name="submit"/>
</form>

when you use input type file then you must write enctype="multipart/form-data"
it's recuired otherwise it can not upload file or get issue or error in file upload code.

2) just check file_uploads = On in your php.ini file.

Friday 1 May 2015

Parallax Scroll and Back to Top Using Jquery

Parallax Scroll and Back to Top Using Jquery


Hello
Here you can create parallax scroll and back to top using jquery.

just you can add jquery in your html 


i am write script here give smaple code then check it your html

here sample code


please check it 

here i  add simple jquery scripy

<script type="text/javascript"&
gt;

jQu
ery( document ).ready(function() {
    
    jQuery('.tryitbtn a').click(function() { 
     if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
      if (target.length) {
        $('html,body').animate({
          scrollTop: target.offset().top
        }, 1000);
        return false;
      }
    }
  });
    
    jQuery('a.back_t').click(function () {
        //alert('hi');
jQuery('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
  
})
;

</
script>