예제 #1
0
 public function onSave()
 {
     $product = Product::findOrFail($this->param('id'));
     $attributes = array('category', 'quantity', 'quantity_UM');
     foreach ($attributes as $attr) {
         $key = sprintf("%s.%s", $product->id, $attr);
         $attribute = ModelProductAttributes::firstOrNew(['id' => $key]);
         $attribute->key = $attr;
         $attribute->value = post($attr);
         $attribute->save();
     }
 }
예제 #2
0
 public function onRun()
 {
     $this->product = Product::findOrFail($this->param('id'));
     $this->addCss("styles/index.css");
     return parent::onRun();
 }