среда, 27 августа 2014 г.

Magento Inline translation doesn't work in chrome brower (SOLVED)

Open Inline.php file from this path /app/code/core/Mage/Core/Model/Translate/Inline.php

Now find below code in that file. (In my case line 272)
 <script type="text/javascript">  
   new TranslateInline('translate-inline-trig', '<?php echo $ajaxUrl ?>', '<?php  
     echo Mage::getDesign()->getArea() ?>');  

Add this code after:

 if(Object.__defineGetter__)  
 {  
   var hasTranslateAttribute = function(){  
     return $(this).hasAttribute("translate");  
   };  
   document.observe("dom:loaded", function() {  
     $$('*').each(function(theElement){  
        theElement.__defineGetter__("translate", hasTranslateAttribute);  
     });  
   });  
 }  

Now check it. It should work in Chrome browser now.

 Enjoy :)

четверг, 14 августа 2014 г.

Get navigation menu categories and category path url key


 <ul>  
               <?php  
                 $obj = new Mage_Catalog_Block_Navigation();  
                 $storeCategories = $obj->getStoreCategories();  
                 foreach ($storeCategories as $_category):  
               ?>  
                   <li><a href="<?php echo $this->getUrl(). $_category->getUrl_key(); ?>"><?php echo $_category->getName(); ?></a></li>  
                 <?php endforeach ?>  
             </ul>  

среда, 21 мая 2014 г.

Export Products CSV -> The error "No valid data sent"

There seems to be something wrong with the filters on the export products' form. The simple fix for this, on magento 1.7.0.2:
  1. Copy the file app/code/core/Mage/ImportExport/Model/Export.php toapp/code/local/Mage/ImportExport/Model/Export.php.
  2. Around line 145, on the export() method, comment out the if, and the else. There is never a filter on the form.
  3. Copy the file app/code/core/Mage/ImportExport/controllers/Adminhtml/ExportController.phpto app/code/local/Mage/ImportExport/controllers/Adminhtml/ExportController.
  4. Around line 77, on the exportAction() method, comment out the if and the else. Same reason as above
Hope it will help U =)

среда, 8 мая 2013 г.

среда, 1 мая 2013 г.

Adding products to cart using AJAX

JS functions:
    function processNext(urls, i) {
            var next = i + 1;
            //jQuery('processing-text').update('Processing item ' + next);
            if (next < urls.size()) {
                new Ajax.Request(urls[i], {
                  method: 'get',
                  onComplete: function(transport) {
                    processNext(urls, next);
                  }
                });
            } else {
                new Ajax.Request(urls[i], {
                  method: 'get',
                  onComplete: function(transport) {
                      window.location.href = "/checkout/cart/";
                  }
                });
            }
        }

        function addItemsToCart() {
            jQuery('#add-items-to-cart').hide();
            jQuery('#loading').show();
            jQuery('#add-items-to-cart-col').hide();
            jQuery('#loading-col').show();
            var addToCartUrls = [];
            jQuery('input.add').each(function(){
                if(jQuery(this).is(":checked")) {
                    var id = jQuery(this).attr('id').split('_')[1];
                    var urlo = jQuery("input[name='url_"+id+"']").val();
                    var qtylo = jQuery("input[name='qty_"+id+"']").val();
                    if (qtylo < 1) qtylo = 1;
                    addToCartUrls.push(urlo + 'qty/' + qtylo);

                }
            });
  if (addToCartUrls.size() > 0) {
                processNext(addToCartUrls, 0);
            } else {
                jQuery('add-items-to-cart').show();
                jQuery('waiting').hide();
            }
        }




пятница, 19 апреля 2013 г.

Disable state/province option in the Magento

update core_config_data set `value`=0 where path = 'general/region/display_all';
update core_config_data set `value`='' where path = 'general/region/state_required';
source: http://www.magentotricks.com/disable-stateprovince-option-in-the-magento/