Ejemplo n.º 1
0
 public function deleteimageAction()
 {
     $this->view->messages = $this->_flashMessenger->getMessages();
     $id = $this->_request->getParam('id', 0);
     $viewid = $this->_request->getParam('viewid', 0);
     $modelImage = new Publisher_Model_DbTable_BookImages();
     $imageDetail = $modelImage->getImageInfo($id);
     unlink(USER_UPLOAD_DIR . $imageDetail['image_name']);
     unlink(USER_UPLOAD_DIR . $imageDetail['image_name_thumb']);
     unlink(USER_UPLOAD_DIR . 'thumb1_' . $imageDetail['image_name']);
     if ($id > 0 && $modelImage->isExist($id)) {
         $success = $modelImage->delete('id=' . $id);
         if ($success) {
             $this->_flashMessenger->addMessage('<div class="div-success">Image deleted successfully</div>');
         } else {
             $this->_flashMessenger->addMessage('<div class="div-error">Sorry!, unable to delete image</div>');
         }
     }
     $this->_redirect('publisher/book/view/id/' . $viewid . '/tab_ajax/book');
 }
Ejemplo n.º 2
0
 public function freepurchaseAction()
 {
     $producturrency = new Admin_Model_DbTable_Countries();
     $modelAuthor = new Publisher_Model_DbTable_Publishers();
     $tempObj = new Model_DbTable_Checkout();
     $creditHistoryObj = new User_Model_DbTable_Chistory();
     $transactionHistoryObj = new User_Model_DbTable_Transactionhistory();
     $this->modelBooks = new Publisher_Model_DbTable_Books();
     $modelImage = new Publisher_Model_DbTable_BookImages();
     $modelStore = new Admin_Model_DbTable_Countries();
     $productPrice = new Publisher_Model_DbTable_BookPrices();
     $productPrice = new Publisher_Model_DbTable_BookPrices();
     $orderId = time();
     $subscription_store = "";
     $subscription_language = "";
     $subscription_issues = "";
     $formDataTransApproved = array("orderId" => $orderId, "transactionType" => $transactionType, "pan" => $pan, "purchaseAmount" => $purchaseAmount, "tranDateTime" => $tranDateTime, "responseCode" => $responseCode, "responseDescription" => $responseDescription, "orderStatus" => $orderStatus, "approvalCode" => $approvalCode, "approvalCode" => $approvalCode, "merchantTranId" => $merchantTranId, "orderDescription" => $orderDescription, "approvalCodeScr" => $approvalCodeScr, "currency" => $currency, "threeDsVerification" => $threeDsVerification);
     $inserted_id = $transactionHistoryObj->insert($formDataTransApproved);
     $tempData = $tempObj->fetchAll("order_id='" . $orderIdForPurchase . "'");
     foreach ($tempData as $dataDet) {
         $productPriceInfo = $productPrice->getPriceByStoreId($dataDet['product_id'], $dataDet['store_id']);
         if ($dataDet['subscription_type'] == '' || $dataDet['subscription_type'] == '0') {
             if ($dataDet['group_id'] > 0) {
                 $price = $productPriceInfo['group_price'];
             } else {
                 $price = $productPriceInfo['price'];
             }
         } else {
             $price = $dataDet['subscription_price'];
             $subscription_store = $dataDet['subscription_store'];
             $subscription_language = $dataDet['subscription_language'];
             $subscription_issues = $dataDet['subscription_issues'];
         }
         if ($orderStatus == 'APPROVED') {
             $orderSt = 1;
         } else {
             $orderSt = 0;
         }
         $product_details = $this->modelBooks->fetchRow("id='" . $dataDet['product_id'] . "'");
         $getBrandInfo = $this->modelBooks->getBrandInfo($product_details['title']);
         if (!empty($getBrandInfo) && is_numeric($this->{$product_details}['title'])) {
             $titleBrand = $getBrandInfo['brand'];
         } else {
             $titleBrand = $product_details['title'];
         }
         if (!empty($product_details['parent_brand_id']) && $product_details['cat_id'] != '3') {
             $productInfo = $this->modelBooks->fetchRow('id="' . $product_details['parent_brand_id'] . '"');
             $getParentBrandInfo = $this->modelBooks->getBrandInfo($productInfo->title);
             if (!empty($getParentBrandInfo)) {
                 $titleBrand = $getParentBrandInfo['brand'] . " - " . $titleBrand;
             }
         }
         $getCurrencyName = $producturrency->getCurrencyCode($dataDet['store_id']);
         $authorInfo = $modelAuthor->getInfoByPublisherId($product_details['author_id']);
         $imageInfo = $modelImage->getImageInfoByProductId($product_details['id']);
         $tempDatInsert = array();
         $tempDatInsert['userid'] = $dataDet['user_id'];
         $tempDatInsert['bookid'] = $dataDet['product_id'];
         $tempDatInsert['store_id'] = $dataDet['store_id'];
         $tempDatInsert['price'] = $price;
         $tempDatInsert['userid'] = $dataDet['user_id'];
         $tempDatInsert['quantity'] = $dataDet['quntity'];
         $tempDatInsert['book_name'] = $titleBrand;
         $tempDatInsert['transaction_id'] = $inserted_id;
         $tempDatInsert['add_date'] = date('Y-m-d H:i:s');
         $tempDatInsert['group_id'] = $dataDet['group_id'];
         $tempDatInsert['order_id'] = $dataDet['order_id'];
         $tempDatInsert['payment_status'] = $orderSt;
         $tempDatInsert['subscription_type'] = $dataDet['subscription_type'];
         $tempDatInsert['subscription_name'] = $dataDet['subscription_name'];
         $tempDatInsert['subscription_store'] = $dataDet['subscription_store'];
         $tempDatInsert['subscription_language'] = $dataDet['subscription_language'];
         $tempDatInsert['subscription_issues'] = $dataDet['subscription_issues'];
         $creditHistoryObj->insert($tempDatInsert);
         $total_price = $total_price + $dataDet['quntity'] * $price;
         $todaysdate = date('Y-m-d H:i:s');
         if ($dataDet['subscription_name'] == 'Weekly') {
             $date = new DateTime($todaysdate);
             $date->modify("+7 day");
             $end_date = $date->format("Y-m-d H:i:s");
         } else {
             if ($dataDet['subscription_name'] == 'Monthly') {
                 $date = new DateTime($todaysdate);
                 $date->modify("+30 day");
                 $end_date = $date->format("Y-m-d H:i:s");
             } else {
                 if ($dataDet['subscription_name'] == 'Quarterly') {
                     $date = new DateTime($todaysdate);
                     $date->modify("+90 day");
                     $end_date = $date->format("Y-m-d H:i:s");
                 } else {
                     if ($dataDet['subscription_name'] == 'Half Yearly') {
                         $date = new DateTime($todaysdate);
                         $date->modify("+182 day");
                         $end_date = $date->format("Y-m-d H:i:s");
                     } else {
                         if ($dataDet['subscription_name'] == 'Yearly') {
                             $date = new DateTime($todaysdate);
                             $date->modify("+365 day");
                             $end_date = $date->format("Y-m-d H:i:s");
                         }
                     }
                 }
             }
         }
         $subscriptionObj = array();
         $subscriptionObj['order_id'] = $orderid;
         $subscriptionObj['product_id'] = $dataDet['product_id'];
         $subscriptionObj['group_id'] = $dataDet['group_id'];
         $subscriptionObj['user_id'] = '';
         $subscriptionObj['subscription_type'] = $dataDet['subscription_type'];
         $subscriptionObj['subscription_name'] = $dataDet['subscription_name'];
         $subscriptionObj['subscription_price'] = $price;
         $subscriptionObj['country'] = $dataDet['subscription_store'];
         $subscriptionObj['language'] = $dataDet['subscription_language'];
         $subscriptionObj['number_of_issues'] = $dataDet['subscription_issues'];
         $subscriptionObj['start_date'] = date('Y-m-d H:i:s');
         $subscriptionObj['end_date'] = $end_date;
         $subscriptionObj['remaining_downloads'] = $dataDet['subscription_issues'];
         $subscriptionObj['publication_id'] = $product_details['parent_brand_id'];
         $UsersubObj->insert($subscriptionObj);
     }
     $tempObj->delete('order_id="' . $orderIdForPurchase . '"');
     $this->_redirect('/checkout/displayorder/orderid/' . $orderIdForPurchase);
     //exit;
 }