(Solution): MDN CrmTicket Bug when searching for a name and go back to Grid View

23. August 2016 at 18:18

firebug

In function „getCondition“ in der class
app/code/community/MDN/CrmTicket/Block/Admin/Widget/Grid/Column/Filter/CustomerName.php

change this buggy part

        if ($customerIdsSelected && sizeof($customerIdsSelected)>0) {
            if((count($customerIdsSelected) == 1) && count($customerIdsSelected[0] > 0)) {
                return array('in' => $customerIdsSelected);
            } else {
                return null;
            }
        }
        else
          return null;
      }

to

        if ($customerIdsSelected && sizeof($customerIdsSelected)>0) {
            if(count($customerIdsSelected) == 1 && count($customerIdsSelected[0]) > 0) {
                return array('in' => $customerIdsSelected);
            } else {
                return null;
            }
        }
        else
          return null;
      }

BTW: The programmer from MDN-CrmTicket unfortunately disregard both Zend and Magento Coding Style Guide! 🙁

 

Please share this article von facebook & google plus or where you want, thank you!

Fix: TypeError: jQuery(.sf-menu).superfish is not a function

14. September 2015 at 15:40

XHTML

If you’re working with the superfish drop down menu and you’re getting the error message „TypeError: jQuery(.sf-menu).superfish is not a function“ it is possible that you’re loading the jquery script twice, e.g.:

<script type="text/javascript" src="/assets/js/jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="/skin/frontend/default/default/js/jquery-1.11.1.min.js"></script>

Solution 1

Remove the dublicated js-implementation (remove one of this lines)

Solution 2

If you need to include two versions of jquery on the same page because of plugin support or so …
Change the lines

jQuery(function(){
	jQuery('.sf-menu').superfish()
})

to

jQuery(function(){
	$(document).ready(function(){
		jQuery('.sf-menu').superfish()
	});
})

if you get an error like „$(document).ready is not a function“
use:

(function($){
	$(document).ready(function(){
		$('.sf-menu').superfish()
	});
})(jQuery);

Please share this article von facebook & google plus or where you want, thank you!

Magento: Access Denied errors after installing SUPEE-6285 or since Magento 1.9.2.1 – ACL Error – Solution

13. August 2015 at 15:06

If you use restricted admin accounts, some menus of third party extensions might not work anymore for them. The reason is that the default return value of Mage_Adminhtml_Controller_Action::_isAllowed() has been changed from true to Mage::getSingleton(‚admin/session‘)->isAllowed(‚admin‘). Extensions that do not override this method in their admin controllers because they don’t use the ACL, now need the „ALL“ privilege.

The only solution is to patch the extensions and add this method to all their admin controllers:

protected function _isAllowed()
{
  return true;
}

Or if they actually have an ACL resource defined in etc/adminhtml.xml:

protected function _isAllowed()
{
  return Mage::getSingleton('admin/session')->isAllowed('ENTER RESOURCE IDENTIFIER HERE'); //e.g. 'admin/sales/productreturn'</pre>
} 

 

Please share this article von facebook & google plus or where you want, thank you!

Magento: Product options are wrong if order edit in admin and last order article is taken

15. Juli 2015 at 12:48

php code

If you edit an order and take over last article it is possible that the wrong product options are mapped.

The reason is that the wrong options are taken – not the „options“ taken – magento get the „info_buyRequest“-options from the database, but sometimes the „options“ array has the options data that you need.

You can solve this problem with overwriting the „getBuyRequest()“ function in app/code/local/Mage/Sales/Model/Order/Item.php with this php code:

/**
 * Returns formatted buy request - object, holding request received from
 * product view page with keys and options for configured product
 *
 * @return Varien_Object
 */
public function getBuyRequest()
{
    $option = $this-&gt;getProductOptionByCode('info_buyRequest');   // this get the wrong options
    $option2 = $this-&gt;getProductOptionByCode('options');
    foreach($option2 as $option_tmp) {
        if($option_tmp['option_type'] == 'area'
            || $option_tmp['option_type'] == 'file'
            || $option_tmp['option_type'] == 'field'
            || $option_tmp['option_type'] == 'date'
            || $option_tmp['option_type'] == 'date_time'
            || $option_tmp['option_type'] == 'time'
        ) {
            $option['options'][$option_tmp['option_id']] = $option_tmp['value'];
        } elseif($option_tmp['option_type'] == 'drop_down'
            &amp;&amp; $option_tmp['label'] == 'Farbe'
            &amp;&amp; $productOptions = $this-&gt;getProduct()-&gt;getOptions()[$option_tmp['option_id']]-&gt;getValues()
        ) {
            foreach($productOptions as $productOption) {
                if($productOption-&gt;getData('title') == $option_tmp['value']) {
                    $option['options'][$option_tmp['option_id']] = $productOption-&gt;getData('option_type_id');
                }
            }
        } else {
            $option['options'][$option_tmp['option_id']][0] = $option_tmp['option_value'];
        }
    }
    unset($option2, $option_tmp, $productModel, $attr);
    if (!$option) {
        $option = array();
    }
    $buyRequest = new Varien_Object($option);
    $buyRequest-&gt;setQty($this-&gt;getQtyOrdered() * 1);
    return $buyRequest;
}

 

Please share this article von facebook & google plus or where you want, thank you!

Magento: Fixing error „[unknown object].fireEvent()“

8. Januar 2015 at 10:02

Recently I’ve encountered the following Javascript error in my Magento store:

error: error in [unknown object].fireEvent():
event name: address_country_changed
error message: zipElement.up(…).down(…) is undefined

This error pops out when creating the order from admin panel and entering customer shipping address. It pops out when editing every filed in the address, which is quite annoying.

Regarding to this forum post, this has something to do with defining the zip code as not required filed in the database. Specialists recommend to set zip code as required filed in the database and then setting it as not required on the country basis. But people report that setting so will still not make zip code as optional field.

So I decided to do my own fix. Here it is:

1. Copy the file app\design\adminhtml\default\default\template\directory\js\optional_zip_countries.phtml to your local design-folder like

app\design\adminhtml\default\fly2marsmedia\template\directory\js\optional_zip_countries.phtml

2. Navigate approximately to line 57.

3. Find the function setPostcodeOptional(zipElement, country)

4. Find the following line: zipElement.up(1).down(‚label > span.required‘).hide();

5. Change it to the following code:

var zipElementLabel = zipElement.up(1).down('label > span.required');
 if (zipElementLabel)
 zipElementLabel.hide();

6. Find the following line: zipElement.up(1).down(‚label > span.required‘).show();

7. Change it to the following code:

var zipElementLabel = zipElement.up(1).down('label > span.required');
if (zipElementLabel)
zipElementLabel.show();

Notice that this code repeats two times inside the function, but differs a little bit in „hide()“ and „show()“ calls at the end.

8. Save the file and upload to the server. Page reload might be required.

This helped me fighting the mentioned error in Magento version 1.9.0.1 and other versions.

Please share this article von facebook & google plus or where you want, thank you!