Magento Max Selected Options Issue Fix

By Michael Kramer on October 3rd 2014 @ 9:46 am

I ran into an issue with Magento where we had a product that needed to have ~60 selected options for a single attribute, but it would only save ~50 of them, the problem comes from the backend type of the attribute being set to varchar which has a limited length.

The fix is to overwrite one of the Magento core files that tells what attributes relate to what types in the backend.

Copy the file
app/code/core/Mage/Eav/Model/Entity/Attribute.php 
over to your local code directory: 
app/code/local/Mage/Eav/Model/Entity/Attribute.php

~ line 227 is a function getBackendTypeByInput($type), 
You'll need find

case 'multiselect':

 

You'll need to move it below the next break; statement, and then add below it:

$field = 'text';
break;

 

The function should look as follows (Version 1.7 of Magento):

public function getBackendTypeByInput($type)
{
	$field = null;
	switch ($type) {
		case 'text':
		case 'gallery':
		case 'media_image':
			$field = 'varchar';
			break;
		case 'multiselect':
			$field ='text';
			break;
		case 'image':
		case 'textarea':
			$field = 'text';
			break;
		
		case 'date':
			$field = 'datetime';
			break;
	
		case 'select':
		case 'boolean':
			$field = 'int';
			break;

		case 'price':
			$field = 'decimal';
			break;
	}
}
comments powered by Disqus