function uc_order_6013_condition_helper in Ubercart 6.2
1 call to uc_order_6013_condition_helper()
- uc_order_update_6013 in uc_order/
uc_order.install - Convert the settings for the uc_order_condition_has_products to models.
File
- uc_order/
uc_order.install, line 946 - Install, update and uninstall functions for the uc_order module.
Code
function uc_order_6013_condition_helper(&$conditions, $pid, $save = FALSE) {
foreach ($conditions as $key => &$condition) {
if (isset($condition['#conditions'])) {
$save = uc_order_6013_condition_helper($condition['#conditions'], $pid, $save);
}
else {
if ($condition['#name'] == 'uc_order_condition_has_products' && isset($condition['#settings']['products'])) {
$save = TRUE;
$products = array();
foreach ($condition['#settings']['products'] as $x => $nid) {
// The "Any" setting will be an empty string.
if (is_numeric($nid)) {
if (!isset($models[$nid])) {
// Get the latest revision's model.
$models[$nid] = db_result(db_query("SELECT p.model FROM {uc_products} AS p LEFT JOIN {node} AS n ON n.vid = p.vid WHERE n.nid = %d", $nid));
}
$model = $models[$nid];
}
else {
$model = $nid;
}
$condition['#settings']['products'][$x] = $model;
}
}
}
}
return $save;
}