public function metasetloader(&$records, &$record, $id = 'id', $property = false, $collate = false, $merge = false) { if (isset($this->prices) && !empty($this->prices)) { $prices =& $this->prices; } else { $prices = array(); } $metamap = array('download' => 'download', 'options' => 'options', 'settings' => 'settings'); $metaclass = array('meta' => 'ShoppMetaObject'); if ('metatype' == $property) { $property = isset($metamap[$record->type]) ? $metamap[$record->type] : 'meta'; } if ('download' == $record->type) { $collate = false; $data = unserialize($record->value); foreach (get_object_vars($data) as $prop => $val) { $record->{$prop} = $val; } $clean = array('context', 'type', 'numeral', 'sortorder', 'created', 'modified', 'value'); foreach ($clean as $prop) { unset($record->{$prop}); } } if (isset($record->type) && isset($metaclass[$record->type])) { $ObjectClass = $metaclass[$record->type]; $Object = new $ObjectClass(); $Object->populate($record); if (method_exists($Object, 'expopulate')) { $Object->expopulate(); } if (is_array($prices) && isset($prices[$Object->{$id}])) { $target = $prices[$Object->{$id}]; } elseif (isset($this)) { $target = $this; } if (!empty($target)) { if (is_array($Object->value)) { foreach ($Object->value as $prop => $setting) { $target->{$prop} = $setting; // Determine weight ranges from loaded price settings meta if ('dimensions' == $prop && isset($setting['weight'])) { $product = is_array($this->products) ? $this->products[$target->product] : $this->products; if (!isset($product->min['weight']) || $product->min['weight'] == 0) { $product->min['weight'] = $product->max['weight'] = $setting['weight']; } $product->min['weight'] = min($product->min['weight'], $setting['weight']); $product->max['weight'] = max($product->max['weight'], $setting['weight']); } } } else { $target->{$Object->name} = $Object->value; } } return; } parent::metaloader($records, $record, $prices, $id, $property, $collate, $merge); }