Web performance Optimization

We optimize your website by analyzing the pattern of the website. By using improved methods of optimization we makes your web pages fly while rendering. Some of the points from our checklist are: By improving your code, optimizing JS for non-blocking while rendering. Sharing the web page load(I/O) by using a CDN and Seprate Session […]

Get list of product attribute in Magento

# Get list of colors from Magento Installation Let’s create a file called getcolors.php on Magento root folder. require_once ( “app/Mage.php” ); umask(0); Mage::app(“default”); Mage::getSingleton(“core/session”, array(“name” => “frontend”)); $attribute = Mage::getSingleton(‘eav/config’)->getAttribute(‘catalog_product’, ‘color’); if ($attribute->usesSource()) { $options = $attribute->getSource()->getAllOptions(false); } print_r($options); When you excute the file getcolors.php either from shell or browser, It will print the […]

Add an External JS in Magento

To Add an External JS without any problem use this in XML Layout: [box type=”info”]<reference name=”head”><block type=”core/text” name=”google.cdn.jquery”> <action method=”setText”><text><![CDATA[<script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js”></script><script type=”text/javascript”>jQuery.noConflict();</script>]]></text></action></block></reference> The External JS will be added to the <head> tag.

Zend_Db_Statement_Exception with message ‘SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry’

Exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry” while Catalog Url Indexing Error: Next exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘xxxx/xxx/xxx-‘ for key ‘UNQ_CORE_URL_REWRITE_REQUEST_PATH_STORE_ID” in /data/apache/beta/lib/Zend/Db/Statement/Pdo.php:234 Stack trace: Soln: – Find out the request path on Url Rewrites Data, there must be more than single entries for […]

Magento Show Out of Stock Configurable Options – Magento 1.5+

To show Out of Stock options in configurable products, we need to make these changes: Create a Local Module : Mindgeek_Outofstock /app/code/local/Mindgeek/Outofstock/Product/Block/Product/View/Type/Configurable.php /app/code/local/Mindgeek/Outofstock/etc/config.xml /app/code/etc/modules/Mindgeek_Outofstock.xml Rewrite /app/code/core/Mage/Catalog/Product/Block/Product/View/Type/Configurable.php <config> <modules> <mindgeek_outofstock> <version>0.1.0</version> </mindgeek_outofstock> </modules> <global> <blocks> <catalog> <rewrite> <product_view_type_configurable>Mindgeek_Outofstock_Block_Product_View_Type_Configurable </product_view_type_configurable> </rewrite> </catalog> </blocks> </global> </config> In /app/code/core/Mage/Catalog/Product/Block/Product/View/Type/Configurable.php class Mindgeek_Outofstock_Block_Product_View_Type_Configurable  extends Mage_Catalog_Block_Product_View_Type_Configurable { //Rewrite getAllowProducts() function: public function […]

Magento redirect simple product to parent configurable product

Add this code in _initProduct() method in IndexController or ProductController in /app/code/core/Catalog/Product/controllers (Create same file in your local folder), which redirects the simple product to parent configurable product. if($product->type_id==”simple”) { $configurable_product = Mage::getModel(‘catalog/product_type_configurable’); $parentIdArray = $configurable_product->getParentIdsByChild($product->getId()); if(isset($parentIdArray[0])) { $product = Mage::getModel(‘catalog/product’)->load($parentIdArray[0]); } } Note:

Adding a Cron Job in Magento

Add the following lines to your module’s config.xml file under etc folder. <crontab> <jobs>             <namespace_yourmodulename>                 <schedule><cron_expr>*/1 * * * *</cron_expr></schedule> <run><model>navision/observer::methodToCall</model></run> </namespace_yourmodulename> </jobs> </crontab>   Observer: <?php class Namespace_Yourmodulename_Model_Observer { public static function methodToCall(){ //Code to Execute Mage::log(“Cron Executed”); } } ?> Note: Magento root file cron.php needs to be added to crontab […]