Jump to content
thirty bees forum
  • 0

Unset Feature before setFeature


Question

Posted

Hi,

I have this little function here 

               setFeature($obj->id, 37, $meta->Platform[0]);

The issue here is that it just "adds" the information it don't "set" the value. 

What i like here is that it does "clear" the already selected elements and then "set" the new information. It just need to overwrite/replace the current information with the new one. 

How can i do that.? 

And can i do that when i have selected the "allow multiple values"? 

 

I want to force update this field : https://take.ms/9fV1A so that we always have the current set by the "script" 

2 answers to this question

Recommended Posts

  • 0
Posted

If feature and feature value already exists in database, you can associate it with product by calling

$product->addFeaturesToDB($id_feature, $id_feature_value)

To dissociate product from all feature values, call

$product->deleteFeatures();

 

  • 0
Posted
On 2/24/2023 at 2:21 PM, datakick said:

To dissociate product from all feature values, call

$product->deleteFeatures();

 

Will this be done to all or just the selected, or do we need to filter it? so that we filter it into the ($obj->id, 37)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...