function deleteAction() { $this->view->title = "Delete Product"; if ($this->_request->isPost()) { $id = (int) $this->_request->getPost('id'); $del = $this->_request->getPost('del'); if ($del == 'Yes' && $id > 0) { $products = new Product(); $where = 'id=' . $id; $products->delete($where); } $this->_redirect('/'); } else { $id = (int) $this->_request->getParam('id'); if ($id > 0) { $product = new Product(); $this->view->product = $product->fetchRow('id=' . $id); } } }
function adminsetselectedorderAction() { $type = $this->_request->getParam('type'); if ($type == 'orderState') { $idStr = $this->_request->getParam('orderids'); $idStrArray = explode(',', $idStr); $productOrderModel = new ProductOrder(); foreach ($idStrArray as $idAndState) { if (null == $idAndState || '' == $idAndState) { continue; } $idAndStateArray = explode('@', $idAndState); $productOrder = $productOrderModel->fetchRow('id = ' . $idAndStateArray[0]); // consumer cancel order if ($productOrder->state == 'CANCEL') { continue; } // confirm used point in table 'reward_point_transaction_record' $rewardPointTransactionRecordModel = new RewardPointTransactionRecord(); $rewardPointTransactionRecord = $rewardPointTransactionRecordModel->fetchRow('id = ' . $productOrder->reward_point_transaction_record_id); if ($rewardPointTransactionRecord == null) { continue; } else { $productModel = new Product(); $product = $productModel->fetchRow('id = ' . $productOrder->product_id); if ($product == null) { continue; } else { if ($idAndStateArray[1] == 'UNAPPROVED') { $rewardPointTransactionRecord->point_amount = 0; } } $rewardPointTransactionRecord->save(); } // change order state $currenttime = date("Y-m-d H:i:s"); $productOrder->state = $idAndStateArray[1]; $productOrder->handle_date = $currenttime; $productOrder->save(); } } $this->_helper->json('Success'); }
function admintestAction() { $formData = $this->_request->getPost(); // Zend_Debug::dump($formData); $productModel = new Product(); $product = $productModel->fetchRow("id = " . $formData['id']); $product->product_id = $formData['product_id']; $product->name = $formData['name']; $product->point = $formData['point']; $product->state = $formData['state']; $product->source = $formData['source']; $product->category = $formData['category']; $product->subcategory = $formData['subcategory']; $product->description = $formData['description']; $product->url = $formData['url']; $product->long_desc = $formData['long_desc']; $product->save(); $this->_redirect('gift/description/id/' . $formData['id']); // Zend_Debug::dump($formData['long_desc']); }