Skip to main content

Posts

Showing posts from November, 2014

Snippet: Replace a field value with another one

In my current scenario, I wanted to find all nodes of a certain content type(product_display) which had a 0.00 value in a custom field(field_product_price) and replace it with a null value. The whole website used null values differently than 0.00 and since I didn't have time to check the what-if parameter, I preferred to use the following code in /devel/php: A much more quick approach in my case could also be the following:And an even quicker would be the following:Make sure to check the UrbanInsight article on this tactic in order to find out when this trick could or shouldn't be used.