function after_save(&$Image) { $StoreImage = new mStoreItemImage(); $StoreImage->storeitem_id = $this->StoreID; $StoreImage->order = $StoreImage->max('order') + 1; $StoreImage->save($Image); $this->after_delete($Image); return; }
function updateimage($StoreItem) { $Model = new mStoreItemImage($StoreItem); if ($_POST['field'] == 'order') { $Other = new mStoreItemImage(); $Other->order = $_POST['value']; $Other->load(); $Other->order = $Model->order; } $Model->{$_POST['field']} = $_POST['value']; $Result['result'] = $Model->save(); $this->output->delete_cache('/'); if ($Result['result'] === true && isset($Other) && $Other->is_loaded()) { $Other->save(); } echo json_encode($Result); }