The Poetics Of Coding

It is really difficult to transfer a site from one host to other, reason can be you are not satisfied with current host or whatever.

Let discuss the steps.

1. You hv to zip the current file

if you are on linex cpanel it is very easy, just select all files by clicking on “select all” and than click on “compress” and give it a proper name like “”, this process will not take more than few seconds if your site is less than 100MB

how to zip whole site on cpanel

how to zip whole site on cpanel

If you are not on cpanel than it will be little difficult, but let me make easy for you

Please click here

Now you should be able to access this zip file like thisĀ  “” in browser, if browser start download this zip file everything is OK, just cancel it

2. Goto destination host now

now to open cpanel or ftp of destination host, where you want to upload your current site. But first make a file with name “copysite.php” with this script

$errors= error_get_last();
echo "COPY ERROR: ".$errors['type'];
echo "<br />\n".$errors['message'];
} else {
echo "File copied from remote!";

run this script file in your browser like this “; and script will generate a zip file and will start coping you old site data. After getting message “File copied from remote!” extract this file from your cpanel.
Enjoy, no thanks as i am great while helping others.

Just copy your path of php.exe
I hv wamp on my system and path is

Right click ‘My Computer’ and open ‘Advance system settings’ edit your PATH variable and paste copied path after ‘;’
save and must restart your system

open command line, write cmd in run

navigate to your yii framework folder by doing “cd c:wamp/www/yii/framework”

now write “c:\wamp\www\yii\framework>yiic webapp c:wamp\www\myapp

system will ask for confirmation enter ‘yes’ and enjoy

As i know this is not a good way, but really a fast hack if you want to attach a file with contact us form.

1. Edit your form.phtml under ‘/app/design/frontend/[your-interface]/[your-theme]/template/contacts/form.phtm ‘ and add ‘enctype=”multipart/form-data”‘

 <form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" enctype="multipart/form-data"> 

add file upload field

 <input name="attachment" id="attachment" class="input-text" type="file" />

Now edit your contacts controller ‘\app\code\core\Mage\Contacts\controllers\IndexController.php’
first find near line 91-93

 if ($error) {
        throw new Exception();

Add this after this

 $fileName = '';
                if (isset($_FILES['attachment']['name']) && $_FILES['attachment']['name'] != '') {
                    try {
                        $fileName       = $_FILES['attachment']['name'];
                        $fileExt        = strtolower(substr(strrchr($fileName, ".") ,1));
                        $fileNamewoe    = rtrim($fileName, $fileExt);
                        $fileName       = preg_replace('/\s+', '', $fileNamewoe) . time() . '.' . $fileExt;
                        $uploader       = new Varien_File_Uploader('attachment');
                        $uploader->setAllowedExtensions(array('zip', 'jpg','pdf', 'rar', 'png', 'eps', 'ai'));
                        $path = Mage::getBaseDir('media') . DS . 'contacts';
                            mkdir($path, 0777, true);
                        $uploader->save($path . DS, $fileName );
                    } catch (Exception $e) {
                        $error = true;

And after

 $mailTemplate = Mage::getModel('core/email_template'); 

Add this

 $attachmentFilePath = Mage::getBaseDir('media'). DS . 'contacts' . DS . $fileName;
                    $fileContents = file_get_contents($attachmentFilePath);
                    $attachment   = $mailTemplate->getMail()->createAttachment($fileContents);
                    $attachment->filename = $fileName;

That’s it, enjoy email attachement

I hv come cross with a problem of magento admin user password change, each article which i find was copy, paste of other.

Everyone just say add salt to your password, no one was explaining where i can find this salt, how to use this salt.

first try to look into user database and try to copy your salt. which can be find in your ‘admin_user(mysql table) -> password (table field)’ after ‘:’

1. click on ‘Edit’ and paste you copied salt and enter your desire password like ‘saltadmin123′ where ‘salt’ can be ’10′, ‘g1′…..etc, select ‘MD5′ from formula dropdown save it

2. again click on edit and in paste you salt again after entering ‘:’ after your password.

3. so complete formula is MD5(saltpassword):salt

[Note]: You must clear your magento cache after doing all this, no matterĀ  your cache is disable or enable.

I spend more than 2 days while searching solution for this issue.
Task was to calculate total cost of the picture frame, user will enter ‘height, width, frame material, finishes and fram’.

magento height, width custom formula price while adding to cart

magento height, width custom formula price while adding to cart

Formula was
$meter = ($heightVal*$widthVal)/10000;
$new_price = $metrialVal*$meter*$quantity;
Read the rest of this entry »

Just open this url

replace VIDEO_ID with the id which can be get from video url, like

where v = VIDEO_ID.

Run the URL and you will get the thumbnail image url.

If you want to check on a page there is already a mysql connection exists, and if not connect to database.
You must have to pass connection string. Otherwise “mysql_ping” return wrong value.

$mysqlcon =  mysql_ping($connection_string) ? 'true' : 'false';


No thanks, as i am great while helping others.


Get every new post delivered to your Inbox.

%d bloggers like this: