Reputation: 604
Does magento have some sort of built in limit to the number of options one can select in a multiselect field?
I need to select >50 options on a regular basis except it doesn't seem to be able to select more than 41 out of the array of option ID's I pass to it.
The code I'm using is like this... Where $valueIds is an array of option ID's
if($valuesIds){
$product = Mage::getModel('catalog/product')->loadByAttribute('sku',$trimmedSKU);
if($product){
try {
$product->setData($this->attrCode, $valuesIds);
$product->save();
} catch (Mage_Core_Exception $e) {
echo $e->getMessage();
}
}else{
echo "SKU $trimmedSKU Does Not Match any Product";
}
}
When this is being processed only the first 41 items in the array are selected, everything after that is ignored. Does anybody know why this might be?
Upvotes: 0
Views: 1608
Reputation: 15216
Most probably it's a limitation of MySQL. If the attribute you use has the backend_type
varchar
then limit is 255 characters.
If that is the case, try to change the backend_type
to text
, but back-up first. You might lose the values that already exist.
You may need to move them from table catalog_product_entity_varchar
to catalog_product_entity_text
.
Upvotes: 2