Magento

18
Mar

Magento Interview Questions and Answers

Q 1. What is Magento? Ans. Magento is a feature-rich eCommerce platform built on open-source technology that provides online merchants with unprecedented flexibility and control over the look, content and functionality of their eCommerce store. Magentos intuitive administration interface features powerful marketing, search engine optimization and catalog-management tools to give merchants the power to create sites that are tailored to

Read more

30
Jul

Display Cart Quantity & Total price In MAgento Top Menu

Display Cart Quantity & Total price In MAgento Top Menu <?php $count = $this->helper(‘checkout/cart’)->getSummaryCount();  //get total items in cart $total = $this->helper(‘checkout/cart’)->getQuote()->getGrandTotal(); //get total price if($count==0) { echo $this->__(‘<a href=”/checkout/cart” >(0 ITEMS)</a>’,$count); } if($count==1) { echo $this->__(‘<a href=”/checkout/cart” >(1 ITEM)</a>’,$count); } if($count>1) { echo $this->__(‘<a href=”/checkout/cart” >(%s ITMES)</a>’,$count); } echo $this->__(‘Total: %s’, $this->helper(‘core’)->formatPrice($total, false)); ?>

30
Jul

How TO change Category Page Layout in Magento

How TO change Category Page Layout in Magento Change local.xml file in layout folder <catalog_category_default> <reference name=”root”> <action method=”setTemplate”> <template>page/2columns-left.phtml</template> </action> </reference> </catalog_category_default> <catalog_category_layered> <reference name=”root”> <action method=”setTemplate”> <template>page/2columns-left.phtml</template> </action> </reference> </catalog_category_layered>

30
Jul

check Home page Or Not condition in magento

<?php $routeName = Mage::app()->getRequest()->getRouteName(); $identifier = Mage::getSingleton(‘cms/page’)->getIdentifier(); if($routeName == ‘cms’ && $identifier == ‘home’) { ?> <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘footer_links’)->toHtml();?> <?php  } else { echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘footer_links2’)->toHtml(); } ?>

30
Jul

Get Child Category in Magento

<?php $root = Mage::getModel(‘catalog/category’)->load($cat3); $subCat = explode(‘,’,$root->getChildren()); $collection  = $root ->getCollection() ->addAttributeToSelect(“*”) ->addFieldToFilter(“entity_id”, array(“in”, $subCat) ); ?> <ul><?php foreach($collection as $catname){ $_img_path = Mage::getBaseUrl(‘media’).’catalog/category/’; //print_r($catname); ?><li> <img src=”<?=$_img_path.$catname->getThumbnail();?>”/> <a href=”<?=$catname->getUrl();?>”><?php echo $catname->getName(); echo $catname->getThumbnailUrl(); ?></a></li><?php } ?></ul>

12
Apr

Prestashop – SSL bug with front & back end

Que: I have a Prestashop online, we were having issues with the host so my client decided to move the website to another domain (his own). He did it himself and added an SSL connection. The problem is the SSL connection. It crosses the https in chrome when I force the browser to enter the website. In the admin, Preferences

Read more

4
Apr

Last Updated Store in Magento

<?php $con=mysql_connect(“localhost”,”root”,”root”); mysql_select_db(“i-buy-express”); $sql=”SELECT * FROM `catalog_product_entity` ORDER BY `catalog_product_entity`.`updated_at` DESC LIMIT 0 , 1″; $result=mysql_query($sql); while($row = mysql_fetch_array($result)) { $store_date=$row[‘updated_at’]; $store_date=date(‘d/m/Y’, strtotime($store_date)); echo “<strong> Store Updated:  “.$store_date.”</strong>”; } ?>

12
Jul

How to change shipping rate in Percent

How to change shipping rate in Percent app/code/core/Mage/Shipping/Model/Carrier/Flatrate.php find line $method->setPrice($shippingPrice); and put following code above that line      $session        = Mage::getSingleton(‘checkout/session’);             $quote_id       = $session->getQuoteId();             $item_quote     = Mage::getModel(‘sales/quote’)->load($quote_id);             $shippingPrice  = $item_quote->getSubtotal()*($this->getConfigData(‘price’)/100);  

12
Jul

To Show Custom Option , configuration option , quantity in list page.

To Show Custom Option , configuration option , quantity in list page. Put the code in place of where add to cart is now: <?php echo $this->helper(‘checkout’)->formatPrice($_product->getFinalPrice()) ?> <form action=”<?php echo Mage::getBaseUrl(); ?>checkout/cart/add/” method=”post” style=”display:block; clear:both;”> <?php $product = Mage::getModel(‘catalog/product’); $product->load($_product->getId()); //print_r($product); //exit(); $xml = “”; $hasAtts = 0; // configurable products $productType = $product->getTypeId(); if($productType == “configurable”) { //

Read more

11
Jul

Making default of product attributes like is_active,tax class, weight,status,stock,qty in magento

UPDATE `eav_attribute` SET `default_value` = ‘container1′ WHERE `eav_attribute`.`attribute_code`=’options_container’; UPDATE `eav_attribute` SET `default_value` = ‘1’ WHERE `eav_attribute`.`attribute_code`=’is_active’; UPDATE `eav_attribute` SET `default_value` = ‘1’ WHERE `eav_attribute`.`attribute_code`=’is_anchor’; UPDATE `eav_attribute` SET `default_value` = ‘1’ WHERE `eav_attribute`.`attribute_code`=’status’; UPDATE `eav_attribute` SET `default_value` = ‘0’ WHERE `eav_attribute`.`attribute_code`=’weight’; UPDATE `eav_attribute` SET `default_value` = ‘2’ WHERE `eav_attribute`.`attribute_code`=’tax_class_id’; insert into core_config_data values ( null, ‘default’, 0, ‘cataloginventory/item_options/is_in_stock’, 1 ); insert

Read more

11
Jul

Auto generated SKU when add product in magento

Auto generated SKU when add product in magento Open /app/design/adminhtml/default/default/template/catalog/product/edit.phtml and add the following code to the bottom of the file: <?php $dbread = Mage::getSingleton(‘core/resource’)->getConnection(‘core_read’); $sql = $dbread->query(“SELECT * FROM catalog_product_entity ORDER BY created_at DESC LIMIT 1″); $res = $sql->fetch(); ?> <script type=”text/javascript”> if(document.getElementById(‘sku’).value == “”){ document.getElementById(‘sku’).value = <?php echo (int)$res[“sku”] + 1; ?>; } </script> Note:Read the SKU (must

Read more

11
Jul

How To Get Special Price in magento Product

How To Get Special Price in magento Product <?php Mage::app(); Mage::getSingleton(‘core/session’, array( ‘name’ => ‘frontend’ )); $_productCollection = Mage::getResourceModel(‘catalogsearch/advanced_collection’)-> addAttributeToSelect(Mage::getSingleton(‘catalog/config’)-> getProductAttributes())->addMinimalPrice()->setPageSize(1)->addStoreFilter(); Mage::getSingleton(‘catalog/product_status’)->addVisibleFilterToCollection ($_productCollection); Mage::getSingleton(‘catalog/product_visibility’)->addVisibleInSearchFilterToCollection ($_productCollection); $todayDate    = date(‘m/d/y’); $tomorrow     = mktime(0, 0, 0, date(‘m’), date(‘d’) + 1, date(‘y’)); $tomorrowDate = date(‘m/d/y’, $tomorrow); $_productCollection->addAttributeToFilter(‘special_from_date’, array( ‘date’ => true, ‘to’ => $todayDate ))->addAttributeToFilter(‘special_to_date’, array( ‘or’ => array( 0 => array( ‘date’ =>

Read more

11
Jul

Custom Menu In Magento

Custom Menu In Magento <?php         $root_category = Mage::getModel(‘catalog/category’)->load(3); // Put your root category ID here.         $subcategories = $root_category->getChildren();   foreach(explode(‘,’,$subcategories) as $subcategory) {         $category = Mage::getModel(‘catalog/category’)->load($subcategory);         echo ‘<a href=”‘.$category->getURL() .’” />’.$category->getName().'</a><br/>’;   }   ?>

11
Jul

Add Page In Navigation Menu

Add Page In Navigation Menu 1 Go To CatalogèManage Categories=> Add Sub Categories====note the categories ID 2 Go to CMS èPage => add New Page=====note the the url  key 3 Got To CatalogèURL Rewrite Management=> find Category Id and open store ==note the Request Path and delete this category 4Go toè add url Rewrite => select custom=>ID path– categories ID(1

Read more

28
May

Custom Menu In Magento

<?php $root_category = Mage::getModel(‘catalog/category’)->load(3); // Put your root category ID here. $subcategories = $root_category->getChildren(); foreach(explode(‘,’,$subcategories) as $subcategory) { $category = Mage::getModel(‘catalog/category’)->load($subcategory); echo ‘<a href=”‘.$category->getURL() .’” />’.$category->getName().’</a><br/>’; } ?>

28
May

How to set number of columns in category listing

Go to  app\design\frontend\default\my_theme1\layout\catalog.xml  open file Paste this   <action  method=”setColumnCount”><count>4</count></action> top of the previous layout details Paste again in bottom side that show previous layout details<action method=”setColumnCount”><count>4</count></action> Save the file Go To admin Panel and clear all the caches.

22
May

How to Install Magento

1 Create Account magneto Site. 2 Download Sample Data 1.6.1.0/magento-sample-data-1.6.1.0.zip. 3 Unzip this sample data and run query in mysql. 4 Download The magneto Full Latest Version 1.7.0.2/magento- 1.7.0.2.zip 5 Unzip and upload into server. 6 and Install This fill Complete Details. 7 Now Ready To your Magento Store.