コード例 #1
0
 private function setValues($feature, $values)
 {
     if (!$this->isMultidimensional($feature)) {
         return $this->feature_model->setValues($feature, $values, false);
     } else {
         $type = $feature['type'];
         $parts = explode('.', $type);
         $values_model = shopFeatureModel::getValuesModel($parts[1]);
         $children = $this->getChildren($feature);
         $data = array();
         $sort = 0;
         foreach ($values as $id => $value) {
             $val = $value['value'];
             $f_id = $value['feature_id'];
             $row =& $data[];
             $row = $values_model->addValue($f_id, $val, $id, $children[$f_id]['type'], ++$sort);
             $row['feature_id'] = $f_id;
         }
         foreach ($children as $c) {
             $this->feature_model->recount($c);
         }
         return $data;
     }
 }
コード例 #2
0
ファイル: 1372418186.php プロジェクト: Lazary/webasyst
<?php

$model = new shopFeatureModel();
try {
    $model->query('SELECT `count` FROM `shop_feature` WHERE 0');
} catch (waDbException $ex) {
    $model->query('ALTER TABLE  `shop_feature`  ADD  `count` INT UNSIGNED NOT NULL');
}
$model->recount();