public function addsubscriptionAction() { $this->view->messages = $this->_flashMessenger->getMessages(); $this->_helper->layout->disableLayout(); $modelPrice = new Publisher_Model_DbTable_Subscriptions(); $formData = array(); $formErrors = array(); $formData = $_POST; if ($this->getRequest()->isPost() && (!empty($formData['createsubscription']) && $formData['createsubscription'] == 'Add Subscription')) { $check_data = $modelPrice->fetchAll('country_sub="' . $formData['country_sub'] . '" and language_sub="' . $formData['language'] . '" and subscription_type="' . $formData['subscription_type'] . '" and product_id="' . $formData['productid'] . '"'); if (!isset($formData['country_sub']) || trim($formData['country_sub']) == "") { $formErrors['country_sub'] = "Please select country "; } if (!isset($formData['language']) || trim($formData['language']) == "") { $formErrors['language'] = "Please select language"; } if (!isset($formData['individual_price']) || trim($formData['individual_price']) == "") { $formErrors['individual_price'] = "Please select price"; } if (count($check_data) > 0) { $formErrors['subscription_type'] = "Subscription could not be saved. This subscription already exists"; } if (count($formErrors) == 0) { $priceId = 0; $price_error = array(); if ($formData['group_price_sub'] == '') { $group_price = $formData['individual_price']; } else { $group_price = $formData['group_price_sub']; } $priceData = array('product_id' => $formData['productid'], 'country_sub' => $formData['country_sub'], 'language_sub' => $formData['language'], 'subscription_type' => $formData['subscription_type'], 'number_of_issues' => $formData['number_of_issues'], 'individual_price' => $formData['individual_price'], 'group_price_sub' => $group_price); $priceId = $modelPrice->insert($priceData); //print_r($priceData); //echo ">>>".$priceId; //die(); } if (empty($priceId)) { $price_error[] = ""; } //$createsubscriptionURL = "http://miprojects2.com.php53-6.ord1-1.websitetestlink.com/projects/evendor/publisher/book/addsubscription/"; $createsubscriptionURL = $this->view->url(array('module' => 'publisher', 'controller' => 'book', 'action' => 'addsubscription'), '', true); ?> <form name="form-add-subscription" id="form-add-subscription " method="post" onsubmit="return validate_subscription_form('form-add-subscription','<?php echo $createsubscriptionURL; ?> ');"> <fieldset class="dashboard_fieldset"> <legend>Publication Subscription</legend> <table width="99%" class="table-list publisher" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" colspan="2"><div id="priceoutput"></div></td> </tr> <tr> <td class="tdleftBold">Store<span class="required">*</span> : </td> <td> <?php $modelCountry = new Publisher_Model_DbTable_Books(); $countryList = $modelCountry->getCountryList(); ?> <select name="country_sub" id="country_sub" class="req" onchange="getCurrency(this.value);" message="Please select country for subscription"> <option value="">Select Store</option> <?php for ($ii = 0; $ii < count($countryList); $ii++) { ?> <option value="<?php echo $countryList[$ii]['id']; ?> "><?php echo $countryList[$ii]['country']; ?> </option> <?php } ?> </select> <?php if (array_key_exists('country', $formErrors)) { echo '<div class="inline-error">' . $formErrors['country'] . '</div>'; } ?> <br/> <span id="err_country" style="color:#f00;"></span> </td> </tr> <tr> <td class="tdleftBold">Language<span class="required">*</span> : </td> <td> <?php $modelLanguage = new Publisher_Model_DbTable_Books(); $languageList = $modelLanguage->getLanguageList(); ?> <select name="language" id="language" class="req" message="Please select language"> <option value="">Select Language</option> <?php for ($ii = 0; $ii < count($languageList); $ii++) { ?> <option value="<?php echo $languageList[$ii]['id']; ?> "><?php echo $languageList[$ii]['language_name']; ?> </option> <?php } ?> </select> <?php if (array_key_exists('language', $formErrors)) { echo '<div class="inline-error">' . $formErrors['language'] . '</div>'; } ?> <br/> <span id="err_language" style="color:#f00;"></span> </td> </tr> <tr> <td class="tdleftBold">Select Subscription<span class="required">*</span> : </td> <td><span id="currency_singh"></span> <select name="subscription_type" id="subscription_type" class="req" message="Please select subscription type"> <option value="">Select</option> <option value="Weekly">Weekly</option> <option value="Monthly">Monthly</option> <option value="Quarterly">Quarterly</option> <option value="Half Yearly">Half Yearly</option> <option value="Yearly">Yearly</option> </select> <br/> <span id="err_subscription" style="color:#f00;"></span> </td> </tr> <tr> <td class="tdleftBold">Number of issues<span class="required">*</span> : </td> <td><span id="currency_singh"></span> <input type="text" name="number_of_issues" id="number_of_issues" class="req number" message="Please enter number of issues" invalidmessage="Please enter numeric value for number of issues" /> <?php if (array_key_exists('number_of_issues', $formErrors)) { echo '<div class="inline-error">' . $formErrors['number_of_issues'] . '</div>'; } ?> <br/> <span id="err_numberofissues" style="color:#f00;"></span> </td> </tr> <tr> <td class="tdleftBold">Individual Price<span class="required">*</span> : </td> <td><span id="currency_singh"></span> <input type="text" name="individual_price" id="individual_price" class="req number" message="Please enter price"/> <?php if (array_key_exists('individual_price', $formErrors)) { echo '<div class="inline-error">' . $formErrors['individual_price'] . '</div>'; } ?> <br/> <span id="err_individualprice" style="color:#f00;"></span> </td> </tr> <tr> <td class="tdleftBold">Group Price : </td> <td><span id="currency_singh"></span> <input type="text" name="group_price_sub" id="group_price_sub" /> <?php if (array_key_exists('group_price_sub', $formErrors)) { echo '<div class="inline-error">' . $formErrors['group_price_sub'] . '</div>'; } ?> </td> </tr> <tr> <td> </td> <td align="center"><input type="checkbox" name="chk_terms" id="chk_terms" value="1" class="req" message="Please check if you agree terms and conditions"/>I agree to <a href="terms_conditions.php">Terms and conditions</a> <br/> <span id="err_chkterms" style="color:#f00;"></span> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="2"> <div style="text-align:center;"> <input type="hidden" name="createsubscription" value="Add Subscription"> <input type="hidden" name="productid" id="productid" value="<?php echo $_REQUEST['productid']; ?> " /> <input type="submit" name="createsubscription" id="createsubscription" value="Add Subscription" class="button-Save"/> </div> </td> </tr> </table> </fieldset> </form> <?php echo "77777777777<fieldset class='dashboard_fieldset'>\n\t\t\t\t<legend>Store Price</legend><table width='100%' class='table-list' border='0' cellspacing='0' cellpadding='0'><tr>\n\t\t<td width='50%'><div align='left'><strong>Store</strong></div></td>\n\t\t<td width='30%'><div align='left'><strong>Language</strong></div></td>\n\t\t<td width='10%'><div align='left'><strong>Subscription type</strong></div></td>\n\t\t<td width='10%'><div align='left'><strong>Number of issues</strong></div></td>\n\t\t<td width='10%'><div align='left'><strong>Price</strong></div></td>\n\t\t<td width='20%'><div align='left'><strong>Group Price</strong></div></td>\n\t\t<td width='10%'><div align='left'><strong>Action</strong></div></td>\n\t\t</tr>"; $modelSubscription = new Publisher_Model_DbTable_Subscriptions(); $subscriptionList = $modelSubscription->getSubscriptionList($formData['productid']); for ($jj = 0; $jj < count($subscriptionList); $jj++) { $deletePriceUrl = $this->view->url(array('module' => 'publisher', 'controller' => 'book', 'action' => 'deletesubscription', 'id' => $subscriptionList[$jj]['id']), '', true); echo "<tr><td><div align='left'>"; $modelCountry = new Publisher_Model_DbTable_Books(); $producturrency = new Admin_Model_DbTable_Countries(); $countryRecord = $modelCountry->getCountryName($subscriptionList[$jj]['country_sub']); echo $countryRecord['country']; echo "</div></td><td><div align='left'>"; $modelLanguage = new Publisher_Model_DbTable_Books(); $languageRecord = $modelLanguage->getLanguageName($subscriptionList[$jj]['language_sub']); echo $languageRecord['language_name']; echo "</div></td><td><div align='left'>"; echo $subscriptionList[$jj]['subscription_type']; echo "</div></td><td><div align='left'>"; echo $subscriptionList[$jj]['number_of_issues']; echo "</div></td><td><div align='left'>"; echo $producturrency->getCurrencyInfo($subscriptionList[$jj]['country_sub']) . "" . $subscriptionList[$jj]['individual_price']; echo "</div></td><td><div align='left'>"; echo $producturrency->getCurrencyInfo($subscriptionList[$jj]['country_sub']) . $subscriptionList[$jj]['group_price_sub']; echo "</div></td><td><div align='left'>"; /*echo "<a class='action-icon' href='".$deletePriceUrl."' onclick='return deletesubscription(this.href);' title='Delete'>"; echo "<img src='".$this->view->serverUrl().$this->view->baseUrl()."/public/css/publisher/images/trash.gif' height='10' width='10'>"; echo "</a> ";*/ ?> <?php if ($subscriptionList[$jj]['status'] == '1') { ?> <a class="action-icon" href="<?php echo $this->view->url(array('module' => 'publisher', 'controller' => 'book', 'action' => 'inactivesubscription', 'id' => $subscriptionList[$jj]['id']), '', true); ?> " title="Deactivate Subscription" onclick="return inactivesubscription(this.href,'tab2','book');"><img alt="Active" src="<?php echo $this->view->serverUrl() . $this->view->baseUrl(); ?> /public/css/admin/images/active.png"/></a> <?php } else { ?> <a class="action-icon" href="<?php echo $this->view->url(array('module' => 'publisher', 'controller' => 'book', 'action' => 'activesubscription', 'id' => $subscriptionList[$jj]['id']), '', true); ?> " title="Activate Subscription" onclick="return activesubscription(this.href,'tab2','book');"><img alt="Inactive" src="<?php echo $this->view->serverUrl() . $this->view->baseUrl(); ?> /public/css/admin/images/inactive.png"/></a> <?php } ?> <a href="javascript:void(0);" onclick="return updatesubscription1('<?php echo $subscriptionList[$jj]['id']; ?> ','<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/book/savesubscription"; ?> ','<?php echo $formData['productid']; ?> ','<?php echo $subscriptionList[$jj]['id']; ?> ','<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/publisher/book/savesubscription"; ?> ','<?php echo $formData['productid']; ?> ');"> <img src="<?php echo $this->view->serverUrl() . $this->view->baseUrl() . "/public/css/publisher/images/icon_edit.png"; ?> " width="10" height="10"/> </a> <?php echo "</div></td></tr>"; } if (count($subscriptionList) == 0) { echo "<tr><td colspan='6' align='center'>No Record Found</td></tr>"; } if (!empty($price_error)) { foreach ($price_error as $error_msg) { echo "<tr><td colspan='6'><strong><font color='red'>" . $error_msg . "</font></strong></td></tr>"; } } if (!empty($formErrors)) { foreach ($formErrors as $error_msg) { echo "<tr><td colspan='6'><strong><font color='red'>" . $error_msg . "</font></strong></td></tr>"; } } echo "</table></fieldset>"; } $this->view->formData = $formData; $this->view->formErrors = $formErrors; exit; }
function displayorderAction() { ########################## data ########################### $orderIdForPurchase = $this->_getParam('orderid'); $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(); $productPrice = new Publisher_Model_DbTable_BookPrices(); $modelImage = new Publisher_Model_DbTable_BookImages(); $modelStore = new Admin_Model_DbTable_Countries(); $productPrice = new Publisher_Model_DbTable_BookPrices(); $modelSubscription = new Publisher_Model_DbTable_Subscriptions(); $this->modelBooks = new Publisher_Model_DbTable_Books(); $storage_company = new Zend_Auth_Storage_Session('company_type'); $company_data = $storage_company->read(); $storage = new Zend_Auth_Storage_Session('account_type'); $data = $storage->read(); if ($data->id) { $user_id = $data->id; } elseif ($company_data->id) { $user_id = $company_data->id; } if ($company_data->account_type == '1') { $groupObj = new Company_Model_DbTable_Groups(); $groupList = $groupObj->getGroupList($company_data->id); } $datahistory = "<div class='top_heading'>\t\t\t\t\n\t\t \t<div class='item'>Item(s)</div>\n\t\t <div class='prices'>Subscription Type</div>\n\t\t <div class='prices'>Price</div>"; if ($company_data->account_type == '1') { $datahistory .= "<div class='quantity'>Qty</div>"; } else { $datahistory .= "<div class='quantity'> </div>"; } $datahistory .= "<div class='total'>Total</div>\n\t\t </div>"; $orderData = $creditHistoryObj->fetchAll("order_id='" . $orderIdForPurchase . "'"); $dataDet = ''; foreach ($orderData as $dataDet) { $price = $dataDet['price']; $subscription_data = $modelSubscription->fetchAll('id="' . $dataDet['subscription_type'] . '"'); $product_details = $this->modelBooks->fetchRow("id='" . $dataDet['bookid'] . "'"); $transaction_details = $transactionHistoryObj->fetchRow("id='" . $dataDet['transaction_id'] . "'"); $catInfo = $this->modelBooks->getCategoryInfo($product_details['cat_id']); $getCurrencyName = $producturrency->getCurrencyCode($dataDet['store_id']); $authorInfo = $modelAuthor->getInfoByPublisherId($product_details['publisher_id']); $imageInfo = $modelImage->getImageInfoByProductId($product_details['id']); $total_price = $total_price + $producturrency->currencyconverter($getCurrencyName, "NGN", $dataDet['quantity'] * $price); if ($dataDet['payment_status'] == 1) { $orderStatus = 'Approved'; } elseif ($dataDet['payment_status'] == 2) { $orderStatus = 'Declined'; } else { $orderStatus = 'Pending'; } if (count($subscription_data) > 0) { $subtype = $subscription_data[0]->subscription_type; } else { $subtype = "N/A"; } $datahistory .= '<div class="cart_detail"> <div class="item_content"> <img src="' . $this->view->serverUrl() . $this->view->baseUrl() . '/' . USER_UPLOAD_DIR . 'thumb1_' . $imageInfo['image_name'] . '" width="140" height="175" alt=""> <h5>' . stripslashes($dataDet['book_name']) . '</h5>'; if ($authorInfo['first_name'] != '') { $datahistory .= '<span><em>by: </em> ' . stripslashes($authorInfo['first_name'] . ' ' . $authorInfo['last_name']) . '</span>'; } $datahistory .= '<span><em>Category: </em> ' . stripslashes($catInfo['category_name']) . '</span> <span><em>publisher:</em> ' . stripslashes($authorInfo['publisher']) . '</span> </div> <div class="space_content"></div> <div class="prices_content">' . $subtype . '</div> <div class="prices_content">₦' . $producturrency->currencyconverter($getCurrencyName, "NGN", $price) . '</div> <div style="float: left;padding: 5% 0;text-align: center;width: 70px;"> <div class="">'; if ($dataDet['group_id'] != 0) { $datahistory .= '<div >' . $dataDet['quantity'] . '</div>'; } $datahistory .= '</div> </div> <div class="total_content">₦' . @number_format($producturrency->currencyconverter($getCurrencyName, "NGN", $dataDet['quantity'] * $price), 2) . '</div> </div>'; if ($company_data->account_type == '1') { $finalsubprice = $finalsubprice + $dataDet['quantity'] * $price; } else { $finalsubprice = $finalsubprice + $price; } } $datahistory .= '<div class="shipping_total"> <div class="row"> <div class="lt">Subtotal</div> <div class="rt">₦' . @number_format($total_price, 2) . '</div> </div> <div class="row" style="border:none;"> <div class="lt">Tax</div> <div class="rt">₦' . '00.00</div> </div> <div class="row subtotal"> <div class="lt">Total</div> <div class="rt">₦' . @number_format($total_price, 2) . '</div> </div> <div class="row subtotal"> <div class="lt">Order Id</div> <div class="rt">' . $orderIdForPurchase . '</div> </div> <div class="row subtotal"> <div class="lt">Payment Status</div> <div class="rt">' . $orderStatus . '</div> </div> </div>'; $this->view->datahistory = $datahistory; $this->view->orderId = $orderIdForPurchase; $this->view->transactionId = $orderData[0]['transaction_id']; $this->view->orderStatus = $orderStatus; $this->view->responseDescription = $transaction_details['responseDescription']; }