php - Unset attribute value for a specific product magento -
i have attribute "clothes" multiselect options "skirt","pant","cargos"...
the attribute id's say,
skirt-198 pant-199 cargos-200
i have tag collection of products attribute skirt, way,
$collection->setclothes('198'); $collection->save();
now want tag same collection attribute pant well,
if use,
$collection->setclothes('199');
it overwrites , product tagged pants , not both skirts , pants.
i need in rightly tagging product multiple attributes(when multiselect used)
and case where, have product tagged skirts , want untag skirts.
i have tried best. can pls me solve this.
have tried $collection->setclothes(array('198','199'));
?
and untag, have to:
$tags = $collection->getclothes(); //let's have 5 tags.. 192, 193, 194, 199, 198. $tagstoremove = array('194','199'); $collection->setclothes( array_diff($tags, $tagstoremove) );
Comments
Post a Comment