September 30, 2015

Magento - static block display on col right sidebar.


- If you want to display static block in any page then you can add below code in page.xml file OR you can create your own local.xml file and put this code in that file.

<layout version="0.1.0">
  <default>
    <reference name="right">
      <block type="your/type" template="path/to/your/template.phtml" />
    </reference>
  </default>
</layout>


If you have any questions please comment me, I help you.

Enjoy!

September 25, 2015

jQuery how can remove comma from end of string.



Please see my below example for remove comma from end of string in jQuery.

var edited = test.replace(/^,|,$/g,'');

Enjoy!

How to download script from jsfiddle site?



Yes its possible to view source code of jsfiddle siet.

http://stackoverflow.com/questions/9851878/is-there-a-download-function-in-jsfiddle

Enjoy!

September 11, 2015

How to change page title in Magento?



If you want to change page title from admin side then please follow below steps:


* Login in admin and open CMS > Static pages, then edit page which you want to change "Page Title".

* In frontend and any module, you can use xml file to set new title for your page. The syntax is:

<reference name=“header”>
    <action method=“setTitle” translate=“title”><title>Your Title Here!</title></action>
</reference>

Enjoy!

PHP send email and when click on any link of that email than how to track.



Following is example for track email viewed OR not?

<?php
$user_id = $_GET['user_id'];

If ( $user_id )
{
    $FileName = $id.".txt";
    $ourFileHandle = fopen($FileName, 'w') or die("can't open file");
    fclose($ourFileHandle);
}
else
{
    $to = "jhon@gmail.com"; //to address

    $subject ="Read Receipt Email";

    $message = "Testing whether the read receipt script works or not";
    $message = "<img src=\"http://www.example.com/email.php?user_id=".$to." width=\"0\" height=\"0\" >";
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: kelly@ymail.com' . "\r\n";

    if (mail($to, $subject, $message, $headers) )
    {
        echo "Mail sent successfully";
    }
    else
    {
        echo "failed to send mail";
    }
}

?>

Enjoy!

September 1, 2015

NEWSLETTER SUBSCRIBE CODE MOVE AT FOOTER IN MAGENTO



First you can create a block on the fly and position it precisely in your template files with one line of code:

Add this code: 

<?php echo $this->getLayout()->createBlock('newsletter/subscribe')->setTemplate('newsletter/subscribe.phtml')->toHtml(); ?>


Enjoy!

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...