Skip to main content

Posts

Showing posts from July, 2012

smtp server (Gmail) in Magento

/app/code/core/Mage/Core/Model/Email.php /app/code/core/Mage/Core/Model/Email/Template.php  $config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => 'username@gmail.com', 'password' => 'password'); $transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config); $mail->send(); replace with: $mail->send($transport);

Rename Folder or File

mv old_folder_name new_folder_name mv  also can move several files into a destination folder, or rename a single file. Rename a file mv old_file_name new_file_name Rename a directory. mv file_name destination_directory Rename will retain the attributes and the creation date of the original file/folder.

Copying Moving and renaming Removing file

  Copying   To copy files, you use the  cp  command. The following will copy  file  to  file2 . Note that if  file2  doesn't exist, it'll be created, but if it exists, it'll be overwritten: $  cp file file2 There aren't any undo commands in the Linux CLI, so accidentally overwriting an important file would probably make you pull your head off. The risk of doing so is smaller if you use the  -i  option ("interactive") with  cp . The following does the same as the above, but if  file2  exists, you'll be prompted before overwriting: $  cp -i file file2 cp: overwrite `file2'?  n $ So it's a good idea to use the  -i  option whenever you're dealing with important files you don't want to lose! If you want to copy  file  into directory  dir1 : $  cp file dir1 The following would do the same as the above, copy  file  into  dir1 , but under a different name: $  cp file dir1/file2 You can also copy multiple files into one directory w

Finding the size of a directory

'du' - Finding the size of a directory $ du Typing the above at the prompt gives you a list of directories that exist in the current directory along with their sizes. The last line of the output gives you the total size of the current directory including its subdirectories. The size given includes the sizes of the files and the directories that exist in the current directory as well as all of its subdirectories. Note that by default the sizes given are in kilobytes. $ du /home/david The above command would give you the directory size of the directory /home/david $ du -h This command gives you a better output than the default one. The option '-h' stands for  human readable format . So the sizes of the files / directories are this time suffixed with a 'k' if its kilobytes and 'M' if its Megabytes and 'G' if its Gigabytes. $ du -ah This command would display in its output, not only the directories but also all the files that are present in the cu

How Changing the Magento ‘favicon’ ?

By Code :                 <link rel="shortcut icon" href="/favicon.ico"> By Manual :             past your icon to your skin folder                ex. skin/rk/febicon.icon By Admin Pannel :            System->  Design->HTML head->febicon

Magento VS Shoppify

While both the platforms offer class leading attributes, let’s take a look at head on comparison:  M ajor Features Magento Go (Going Places)   Shopify (Basic) Price US$25 per month US$29 per month Number of Products 500 100 Images 500MB 100MB Transaction Fee 0% 2% Inventory Management Yes Yes Order Management Yes Yes Shipping Integration Yes No Free Sub Domain of Custom URL Yes Yes Store Builder with Templates Yes Yes Customizable Design Yes Yes PCI Compliant Yes Yes SSL Certificate No Yes CSV Import No Yes Data Backup Yes Yes Authorize.net, PayPal, Google Wallet Yes Yes Customer Support Yes Yes SEO Enabled Yes Yes Google Analytics Enabled Yes Yes Amazon No Yes Facebook No Yes, but at an additional cost of US$19.99

How do I showMagento products on a non-Magento page?

we want to display an entire category of products, we need to load up the category display block and render it. This will load the products and push the data through the associated template file. //code snipped $className = Mage::getConfig() ->getBlockClassName(’catalog/product_list’); $block = new $className(); $className = Mage::getConfig() ->getBlockClassName(’core/template’); $toolbar = new $className(); $block->setChild(’toolbar’, $toolbar); $block->setCategoryId(3); $block->setTemplate(’catalog/product/list.phtml’); echo $block->renderView(); You might think that we would be using the category view block for this task, but we’re not. The product list block is the component which does the actual printing of the products. The category view block does too much work preparing the rest of the page and is too integrated intoMagento to cleanly use outside ofMagento’s code. The reason that we make a core/template type block and call it “toolbar” is

How do I find out the proper table name?

The core resource model has a method to get you any table name for any model in the system. Table names do not have to follow the name of the model, an end-user can change the table names by changing an XML setting. Also, any installation can have an arbitrary prefix for any table. Therefore, it is best to use the getTable method of the core resource $r = Mage::getResourceSingleton(’core/resource’)->getConnection(’core_read’) $tableName = $r->getTable(’catalog/product’); $tableName === ’catalog_product_entity This happens because we have the following XML configuration in the catalog module’s config file. <global> <models> <catalog> <class>Mage_Catalog_Model</class> <resourceModel>catalog_resource_eav_mysql4</resourceModel> </catalog> <catalog_resource_eav_mysql4> <entities> <product> <table>catalog_product_entity</table> </product> Table Name :  catalog_product_en

How do I show the root catalog category on the home page?

 $collection = Mage::getResourceModel('catalog/category_collection')                                                          ->addAttributeToSelect('entity_id')                                                                                                                 ->addAttributeToSelect('name')                                                         ->addAttributeToSort('position', 'desc')                                                          ->load();                                         $x=1;$ids=NULL;                     foreach ($collection as $c){                                                      if($c->getData("entity_id")>2 && $x=1)                             {                               $ids=$c->getData("entity_id"); $x=0;                             }                                               }                                                      

How do I runMagento code without building a module

Sometimes, running update scripts to quickly update the database or to export some data does not require a complete module to hold the code. For these types of operations you can build a shell script to get into Magento’s environment without executing a traditional browser based request. The file is basically the Magento index.php file with one major change, instead of Mage::run(’default’) we will simply use Mage::app(’default’). This type of file can be used to export pending orders, update product categorization, change available quantities, or any other type of automated maintenance. <?php //if you store this script outside the Web site document // root (recommended) use chdir() to move execution back to // the document root. //chdir("../magento/’); //if you are performing admin tasks, sometimes the system // checks if you are in SSL mode. Uncomment the following // line to get this behavior. //$_SERVER[’SERVER_PORT’] = 443; require_once ’app/Mage.php’;

How do I run a raw query against the database?

For Update Database: $write = Mage::getSingleton('core/resource')->getConnection('core_write');  $write->query("insert into rk_stories values (NULL,'$rks_title', '$rks_date', '$rks_description', '$rks_story', '$rks_theme', '$rks_imgURL', '$rks_img_size', '$rks_isFront')");  $message = $this->__('Your form has been submitted successfully.'); For select  Database info : $query="SELECT * FROM rk_stories where rk_stories_id='$id'";  $result= Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchAll($query);   $Stories["Data"]["ID"]=$result[0]["rk_stories_id"];   $Stories["Data"]["Title"]=$result[(0)]["rk_stories_title"];                   $Stories["Data"]["story"]=$result[0]["rk_stories_story"];     return $Stories;

How to get controller,action,module,router name?

If you are in .phtml file use this code:   $this->getRequest()->getActionName();  $this->getRequest()->getControllerName();  $this->getRequest()->getRouteName();  $this->getRequest()->getModuleName();  If you in class file use this code:  Mage::app()->getRequest()->getActionName();  Mage::app()->getRequest()->getControllerName();  Mage::app()->getRequest()->getRouteName();  Mage::app()->getRequest()->getModuleName()  For More :  echo "<pre>";   print_r(Mage::app()->getRequest());   echo "</pre>";

TOP PHP CMS

1. DynPage  2. DynPG   3. Havalite   4. Elxis  5. Kajona  6. Lemon CMS   7. LitePublisher  8. eliteCMS  9. Mac’s CMS  10. PHP-Fusion  11. phpWarmSky  12. PivotX  13. EmbryoCore  14. Pixie  15. Podcast Generator  16. Precurio  17. GuppY  18. Redaxscript  19. Primitive CMS  20. glFusion  21. ProcessWire  22. ecoCMS  23. Gekko Web Builder  24. Section CMS  25. Seagull  26. RhinOS  27. FuzzyLime  28. SilverStripe  29. SoftXMLCMS  30. Hippo CMS  31. Spitfire  32. Fundanemt   33. SyndeoCMS  34. Horizon QCMS  35. synType CMS  36. TangoCMS  37. Fruml Content Manager  38. The Pacer Edition CMS  39. Tiki Wiki CMS Groupware  40. Fork CMS  41. Hotaru CMS  42. TRIBiQ CMS  43. TrioEditor CMS  44. Exponent  45. TYPO3  46. html-edit CMS  47. Vesthelm Engine  48. Escher CMS  49. WalrusCMS  50. Icy Phoenix  51. web@all CMS  52. Enano CMS  53. Webmatic  54. ImpressCMS  55. Jumbo  56. JAKCMS  57. Joostina CMS  58. Jaws  59. Joomla  60. e107  61