Archive for the ‘Magento 1.x’ Category

Magento explaining model naming

This: $model = Mage::getModel(’shop/people’); comes from: app/local/VendorName/PluginName/etc/config.xml <models> <shop> <class>VisionDirect_StoreLocator_Model</class> <resourceModel>storelocator_mysql4</resourceModel> </shop> <shop_mysql4> <class>VisionDirect_StoreLocator_Model_Mysql4</class> <entities> <people> <table>storelocator_people</table> </people> </entities> </shop_mysql4> </models>

Reset admin password in Db

In case you forgot admin password it is possible to reset it directly in db: SELECT * FROM admin_user WHERE username=’admin’;   UPDATE admin_user SET password=MD5(’admin123’) WHERE username=’admin’;

Disable cache

1. Go to Magento Admin Panel > System > Cache Management > Select all cache from left side checkboxes > Select Action: disable from right top dropdown > Click Submit

Magento Zend Framework Mappings

CE – Community Edition PE – Professional Edition EE – Enterprise Edition CE 1.9 – ZF 1.12.3 CE 1.5 – CE 1.8 – ZF 1.11.1 CE 1.4.2.0 – ZF 1.10.8 CE 1.4.0.1 – ZF 1.9.6 CE 1.3.2.1 – ZF 1.7.2 CE 1.2.0.1 – ZF 1.7.2 CE 1.1.6 – ZF 1.5.1 CE 1.0.19870.4 – ZF 1.5.1 […]

Magento 1.9 RAM Table

products = RAM up to 1000 = 8 GB up to 50,000 = 16 GB up to 100,000 = 32 GB up to 250,000 = 48 GB up to 500,000 = 64 GB up to 750,000 = 96 GB up to 999,999 = 128 GB

Magento template folders

1. /app/design/frontend/default/YOUR_TEMPLATE_NAME/layout Contains the .xml files that define which modules should be called by the template files and loaded in defined areas on the site. 2. /app/design/frontend/default/YOUR_TEMPLATE_NAME/template Contains files and subfolders that structure the final output for the users using the functions located in the layout/ folder 3. /skin/frontend/default/YOUR_TEMPLATE_NAME Contains the CSS, images, JavaScript and […]

Magento 1.5+ folder structure

404 (directory) – The folder stores the default 404 template and skin for Magento; app (directory) – This folder contains the modules, themes, configuration and translation files. Also there are the template files for the default administrationtheme and the installation; cron.php – a Cron Job should be set for this file. Executing of the file […]

Select simple products of configurable product

<?php   $product = Mage::getModel(’catalog/product’)->load(127); $confProduct = Mage::getModel(’catalog/product_type_configurable’)->setProduct($product); $simpleProductsCollection = $confProduct->getUsedProductCollection() ->addAttributeToSelect(’*’) ->addFilterByRequiredOptions(); foreach($simpleProductsCollection as $simpleProduct) { var_dump($simpleProduct->getId()); }

Magento Db Configuration File

File: $MAGENTO_DIR/app/etc/local.xml The code you see should look very similar to the following. Simply modify the settings and save. Change the values within the CDATA brackets. <connection> <host><![CDATA[localhost]]></host> <username><![CDATA[database_username]]></username> <password><![CDATA[database_password]]></password> <dbname><![CDATA[database_name]]></dbname> <active>1</active> </connection>

Export Product List Script

<?php   /** * $storeCode is Store View Code */ public function getCsvProducts($storeCode=’default’) {   $csvProducts = array(); if ($storeCode!==’default’) { $myStoreId = Mage::app()->getStore($storeCode)->getId(); if (isset($myStoreId) && $myStoreId>0) { Mage::app()->setCurrentStore($myStoreId); } }   $products = Mage::getModel(’catalog/product’)->getCollection(); foreach($products as $product) { $csvProducts[] = array($product->getName(),$product->getDescription()); } }