Friday, December 30, 2011

Simple function overloading in php

<?php
class hello
{
var $id;
 var $edi;
 function hello()
 {
 $this->id="1234";
 $this->edi="abc";
 }

public function display()
{
echo $this->id;
echo $this->edi;
}

}
class hello1 extends hello
{

 function display($a,$b)
{
hello::display();
echo "</br>";
echo $this->id=$a;
echo $this->edi=$b;
}

}
$obj=new hello;
$obj1=new hello1;
$obj1->display("a","b");


?>
output
1234abc
ab

Friday, December 9, 2011

Enable Template Path Hints for Magento Admin, Enable Template Path Hints in Magento Admin

Step 1: Change the file app/code/core/Mage/Core/etc/system.xml as follows:
In the system.xml change the value of tag from 0 to 1.
Step:2
Enable the Template path hints and blocks from the admin panel.

Now you will be able to see the red lined path in the admin.

Php Code to explore every directory and files in a path

<?php

calldir("lightbox");
function calldir($path)
{
if ($handle = opendir($path)) {
    echo "Directory handle: $handle</br>";
    echo "Files:</br>";
     $i=0;
    /* This is the correct way to loop over the directory. */
    while (false !== ($file = readdir($handle))) {
        echo "$file</br>";
  $data=explode(".",$file);
  if($data[1]==''&& $file!="." && $file!="..")
  {
  if (is_string($data[0]))
   {
  //echo $file.'</br>';
  $url=$path.'/'.$file;
  calldir($url);

  }
  }
    }

  
    closedir($handle);
}
}
?>

Friday, November 25, 2011

Magento 1.5.1.0 attribute import error while using .csv file,image does not exist error (solved)

Attribute error for example :- size error:1,2,3,4.... check wheather the attribute is present in the attribute value and  attribute set.If you find all ok and still have the error you can goto Catalog->manage attribute->size then you select the manage option and file the value with error and copy the value fron the text box from their and paste it on the .csv file this should be repeated for all value that you find error.

Image does not exist
Please not that if you find this error your product will not be imported so better to create a profile of your own and map it to corresponding field.
If you have the image in import folder media/import and your csv contain the right name still have the error you can put a back slash infront of the image name(  /name.jpg  ) .

Concatenate function will help you to add (/) to your image name using excel.
=CONCATENATE("/",N:N)



Magento 1.5.1.0 -configurable product import

Magento has added the feature for importing configurable product with association .To do importing go to admin and select System->import/export->import ,this import is different from profile import.


Magento 1.5.1.0 unable to import image
The new import you will not be able to upload image for this you can use the old profile import for this goto  System->import/export->DataFlow-profiles

 Magento 1.5.1.0 update problem
During updating with magento you could see that you stock becomes out of stock for that you can insert a field is_instock with value 1

 


Thursday, August 11, 2011

How to create a product in magento from admin panel ?

Log into admin panel in localhost with this url  ( http://localhost/magento/index.php/admin ) in default
Then go to Catalog tab in admin panel and take manage products.then click on add product button.Then you are asked to select an attribute set (default) and type of product you want to create choose simple product and click continue.
Then a new page appears
General
enter product name in name textfield,description,short description,sku,enable,catalog,search
Price
enter price
select taxable goods
Image
browse image and click upload and click all the radio button



How to Create Excel csv file for product importing

First you create a product from the admin panel of magento.
Then in the admin panel go to System and select Import/Export profile
and select profiles then a window appears with options for exporting and importing.
Then click on Export All products and then select export method as CSV file from the option and click on save and continue.
Then on the left tab select RUN PROFILE and click on run profile button the you product will be exported .
you can get it from magento root folder then in the path = magento/var/export
then open the export.csv and you can see field name in the first row and in the second row product.
Just select the row and drag down to multiply and change product name ,description especially sku ,sku should be unique.then save and go to admin ->system->import/export profile->profile->import all products



Then change the xls file to csv file in the option tab in current window.
click on save and continue.
Upload file and click save and continue
Then RUN PROFILE then select your file from option and click on run profile button.
Then your product will be imported you can see the product in catalog->manage product in admin panel