Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Update multi-select attribute limit issue
 
Maxpatat
Jr. Member
 
Total Posts:  16
Joined:  2009-10-21
 

we need to set some attributes for each product on a daily base
our products are accessoires and parts for mobile phones

i.e. a universal screen protector can be used for a lot of phone models
also, new phone models are being introduced now and then
the mentioned screen protector could also be an accessoire for this new type
therefore we decided to generate the attribute connections daily and overwrite the existing values

All avaliable phone brands and models are already values in magento model/brand attributes.

$brandvals and $modelvals are being generated from our supplier data on a daily base
the below fixed values are just an example for debug purposes for 1 product only

newaspect_id is a custom text attribute containing supplier_id which has a reference to their brands/models
model and brand are custom multi select attributes

After updating a product only 255 chars of the string are being sent to the database resulting in 64 connected models instead of 1547!

I have tried to select all available models in magento backend and save it manually too.
this also will not go beyond 255 chars when viewing the product _origData:protected afterwards
The “Product succesfully saved” message appears though.

I use this function to update the product:

function update2ProductId($productId$brandvals$modelvals{
  
// returns 1 if saved, 2 if error, 99 product not exist, 0 no action  

 
global $debug
 
$action false
 
$errorlevel 0;

 if (
$debug{
  var_dump
($productId);
  
var_dump($prod->sku);
  
var_dump($prod->brand);    
  
var_dump($prod->model);
 
}  

  $prod 
Mage::getModel('catalog/product')->loadByAttribute('newaspect_id'$productId);  
  if (!
$prod{ $errorlevel 99; return $errorlevel}  

  $prod
->brand $brandvals;  
  
$prod->model $modelvals;
  
  if (
$debug{ var_dump($prod); }  

      
try {  
      $prod
->save();
      
$errorlevel 1;            // success
    
}
    
catch (Exception $ex{
      
//Handle the error    
      
$errorlevel 2;            // general error
    
}      
   
if ($debug{ var_dump($errorlevel); }
   
return $errorlevel;
}

I’ve attached my full script since code snippet didn’t work for the total stringlengths.
please advice....

File Attachments
set_model_attributes.php  (File Size: 10KB - Downloads: 36)
 
Magento Community Magento Community
Magento Community
Magento Community
 
inktonly
Jr. Member
 
Total Posts:  7
Joined:  2012-03-28
 

Does anyone have an solution for this? I have the same problem too!

 
Magento Community Magento Community
Magento Community
Magento Community
 
severinolorilla
Jr. Member
 
Total Posts:  4
Joined:  2012-11-19
 

Can someone please enlighten us regarding the multiple select product attribute?
Is there some kind of limit to these? or anything that would help us resolve the issue?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
wisemanbryan
Jr. Member
 
Total Posts:  1
Joined:  2014-02-25
 

Sorry,I can’t understand what you are saying.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top