Skip to main content

Posts

Ajax In Magento using module

Write your code to hit the module in script tag <script> function api(id){ jQuery.ajax({ type: "POST", url: "<?php echo $this->getUrl('ankur') ?>", data: { id : id } }) .done(function( msg ) { //alert( "Data Saved: " + msg ); }); } </script> Now create a module  location: /public_html/app/code/local module name(create folders):Excellence\Test\controllers/IndexController.php <?php class Excellence_Test_IndexController extends Mage_Core_Controller_Front_Action{ public function indexAction(){ // Write here ajax action, what you want to do... } } ?> now create another folder Excellence\Test\etc\config.xml <?xml version="1.0"?> <config>     <modules>         <Excellence_Test>             <version>0.1.0</version>    <!-- Version of module -->         </Excellence_Test>     </modules>     <frontend>

Custom Import function in magento

Open the file  app\code\local\mainModule\moduleName\Block\Adminhtml\moduleName.php Add or replace  public function __construct() { $this->_controller = "adminhtml_myoffer"; $this->_blockGroup = "myoffer"; $this->_headerText = Mage::helper("myoffer")->__("Myoffer Manager"); $this->_addButtonLabel = Mage::helper("myoffer")->__("Add New Item"); $this->_addButton('testbutton', array(             'label'     => Mage::helper('Sales')->__('Import'),             'onclick'   => 'jsfunction(this.id)',             'class'     => 'go'         ), 0, 100, 'header', 'header'); parent::__construct(); } And add a java script on same page <script> function jsfunction(){ window.open("http://localhost/ankur/yourPageName.php",'_blank','width=335,height=330,resizable=1');

NEW FEATURES IN THE LATEST MAGENTO RELEASE – ENTERPRISE EDITION 1.14 & MAGENTO COMMUNITY EDITION 1.9

NEW FEATURES IN THE LATEST MAGENTO RELEASE – ENTERPRISE EDITION 1.14 & MAGENTO COMMUNITY EDITION 1.9 The new version of Magento Enterprise and Magento Community Edition was launched at the 2014 Global Imagine Ecommerce Conference in Las Vegas. The release of the newest versions of  Magento Enterprise Edition version 1.14  and  Magento Community Edition version 1.9  introduced numerous features with which Magento based websites can be better managed and which help all Magento users to manage their Magento based websites more competently. 1.- RESPONSIVE WEB DESIGN TEMPLATE ( Images from  New Features in Magento Community Edition (CE) 1.9 and Magento Enterprise Edition (EE) 1.14  by Magento) The default theme uses Responsive Web Design for a tablet and smart phone-friendly site Retailers are now able to obtain a tablet- and smartphone-friendly responsive site in approximately half the time as previously required, taking advantage of the rapid growth in mobile commerce. M

How to Display Custom Options in Magento

$productSku = "ABCDE" ; $product = Mage :: getModel ( 'catalog/product' ); $productId = $product -> getIdBySku ( $productSku ); $product -> load ( $productId ); /** * In Magento Models or database schema level, the product's  Custom Options are * executed & maintained as only "options". So, when checking  whether any product has * Custom Options or not, we should check by using this method  "hasOptions()" only. */ if ( $product -> hasOptions ()) { echo '<pre>' ; foreach ( $product -> getOptions () as $o ) { $optionType = $o -> getType (); echo 'Type = ' . $optionType ; if ( $optionType == 'drop_down' ) { $values = $o -> getValues (); foreach ( $values as $k => $v ) { print_r ( $v ); } } else { print_r ( $o ); } }

Calculate the days difference between two dates using Jquery

$(document).ready(function () { $("#date1").datepicker({ minDate: new Date(2012, 7 - 1, 8), maxDate: new Date(2012, 7 - 1, 28) }); //$("#date2").datepicker({ minDate: new Date(2012, 7 - 1, 9), maxDate: //new Date(2012, 7 - 1, 28) });    $('#date1, #date2').datepicker({onSelect: function(dateStr) {       var d1 = $('#date1').datepicker('getDate');       var d2 = $('#date2').datepicker('getDate');       var diff = 0;       if (d1 && d2) {             diff = Math.floor((d2.getTime() - d1.getTime()) / 86400000); // ms per day       }       $('#calculated').val(diff); } }); }); Check Js Fiddle :  http://jsfiddle.net/MebwN/48/