当前位置: 首页>>代码示例>>PHP>>正文


PHP ShoppDatabaseObject::metaloader方法代码示例

本文整理汇总了PHP中ShoppDatabaseObject::metaloader方法的典型用法代码示例。如果您正苦于以下问题:PHP ShoppDatabaseObject::metaloader方法的具体用法?PHP ShoppDatabaseObject::metaloader怎么用?PHP ShoppDatabaseObject::metaloader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShoppDatabaseObject的用法示例。


在下文中一共展示了ShoppDatabaseObject::metaloader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: metasetloader

 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);
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:57,代码来源:Price.php


注:本文中的ShoppDatabaseObject::metaloader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。