add inventory to frontend

This commit is contained in:
2016-03-24 07:44:00 +01:00
parent e7b16f20ce
commit ed837d6580
27 changed files with 1259 additions and 71 deletions

View File

@@ -142,9 +142,14 @@ class InventoryItem extends BaseFitnessActiveRecord
public function afterSave($insert, $changedAttributes){
if ( !$insert ){
$product = $this->product;
$product->stock = $this->count;
$product->save(false);
if ( $this->type == 'product'){
$product = $this->product;
$product->stock = $this->count;
if ( !$product->save(false) ){
\Yii::error("Failed to save product stock");
throw new \Exception("A leltár elem mentése nem sikerült");
}
}
}
}