Created
May 7, 2014 12:07
-
-
Save dsnopek/ed50a736e36b82d2b497 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$type = 'product_kit'; | |
$field = 'field_availability'; | |
$value = 'in stock'; | |
$result = db_query("SELECT nid, vid FROM {node} WHERE type = :type", array(':type' => $type))->fetchAllAssoc('nid'); | |
foreach ($result as $nid => $values) { | |
$fields = array( | |
'entity_type' => 'node', | |
'bundle' => $type, | |
'deleted' => 0, | |
'entity_id' => $values->nid, | |
'revision_id' => $values->vid, | |
'language' => LANGUAGE_NONE, | |
'delta' => 0, | |
"{$field}_value" => $value, | |
); | |
db_insert("field_data_{$field}") | |
->fields($fields) | |
->execute(); | |
db_insert("field_revision_{$field}") | |
->fields($fields) | |
->execute(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment