Girdhari kumawat

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

6
Aug

What is Node.js?

Node.js is a server side platform built on Google Chrome’s JavaScript Engine(V8 Engine). Node.js was developed by Ryan Dahl in 2009 and it’s latest version is v0.10.36. Defintion of Node.js as put by its official documentation is as follows: Node.js® is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking

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>”; } ?>

11
Feb

Hide/Remove Toolbar on front end for logged in users?

add_action(‘set_current_user’, ‘csstricks_hide_admin_bar’); function csstricks_hide_admin_bar() { if (!current_user_can(‘edit_posts’)) { show_admin_bar(false); } }

11
Jan

Display Child Page title and Image In WordPress

<?php $child_pages = $wpdb->get_results(“SELECT *    FROM $wpdb->posts WHERE post_parent = “.$post->ID.”    AND post_type = ‘page’ ORDER BY menu_order”, ‘OBJECT’);  ?> <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); $i+=count($pageChild); ?> <a href=”<?php echo  get_permalink($pageChild->ID); ?>” rel=”bookmark” title=”<?php echo $pageChild->post_title; ?>”> <?php echo get_the_post_thumbnail($pageChild->ID, ‘full’); ?></a><br/> <h3><a href=”<?php echo  get_permalink($pageChild->ID); ?>” rel=”bookmark” title=”<?php

Read more

15
Dec

My Sql Query

1. Get Second Maximum Salary In mysql. SELECT * FROM `employee` WHERE salary = ( SELECT MAX( salary ) FROM employee  WHERE salary < (SELECT MAX(salary) FROM employee)    

30
Sep

Active Menu

Active Menu Java Script <script> function selected(obj){ var lilist = document.getElementById(‘menu’); var alist = lilist.getElementsByTagName(‘a’); for (i=0; i<alist.length; i++ ) { alist[i].className=””; } obj.className=”red”; } </script> Style <style> .red { color:red; background:#F39; width:150px; } HTML <ul id=”menu”> <li><a href=”#” onClick=”selected(this)”>Home</a></li> <li><a href=”#”  onClick=”selected(this)”>About Us</a></li> <li><a href=”#”  onClick=”selected(this)”>Our Products</a></li> <li><a href=”#” onClick=”selected(this)”>Trade Offers</a></li> <li><a href=”#”  onClick=”selected(this)”>Contact Us</a></li> </ul>

10
Sep

WordPress Function

WordPress Function Jquery Include     <?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?> 2. Thumbnail Image <?php the_post_thumbnail();?> <?php  the_post_thumbnail(‘thumbnail’);  ?> <?php  the_post_thumbnail(‘medium’);   ?> <?php the_post_thumbnail(‘large’);      ?> <?php the_post_thumbnail(‘full’);?> <?php the_post_thumbnail( array(100,100) );?> 3. Get Template Url      <?php get_template_directory(); ?> <?php get_template_directory_uri(); ?>

1
Aug

How to Prevent Your WordPress Website from Being Hacked

How to Prevent Your WordPress Website from Being Hacked Keep your WordPress website updated with the latest version of WordPress.  Wordpress is regularly upgraded with new functionality and wity security measures that help stop hackers. Use complex usernames and passwords as described above. Install security plugins such as Better WP Security.  It covers most of the wordpress vulnerabilities mentioned earlier in this

Read more

27
Jul

Woocommerce Category, Image , Description Display

<?php $all_categories = get_categories( ‘taxonomy=product_cat&hide_empty=0&hierarchical=1’ ); foreach ($all_categories as $cat) { //print_r($cat); if($cat->category_parent == 13) { $category_id = $cat->term_id; $thumbnail_id     = get_woocommerce_term_meta( $cat->term_id, ‘thumbnail_id’, true ); $image = wp_get_attachment_url( $thumbnail_id ); /*echo ‘<a href=”‘. get_term_link($cat->slug, ‘product_cat’) .’”><div>’. “Read more” .'</div></a>’;*/ ?> <li style=”width: 183px;”> <div> <h3><?php  echo $cat->name; ?></h3> <div><img src=”<?php echo $image; ?>” alt=”<?php $cat->name; ?>” width=”120″ height=”120″

Read more

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