Example #1
0
 public function addfieldAction()
 {
     $creditHistoryObj = new User_Model_DbTable_Chistory();
     $re = $creditHistoryObj->fetchAll();
     echo "<pre>";
     print_r($re);
     exit;
     //$db = Zend_Registry::get('db');
     //$creditHistoryObj->addnewField();
     //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();
        $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='space'>&nbsp;</div>\n\t\t        <div class='prices'>Price</div>";
        if ($company_data->account_type == '1') {
            $datahistory .= "<div class='quantity'>Quantity</div>";
        } else {
            $datahistory .= "<div class='quantity'>&nbsp;</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'];
            $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['author_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';
            }
            $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'] . '&nbsp;' . $authorInfo['last_name']) . '</span>';
            }
            $datahistory .= '<span><em>Category: </em> ' . stripslashes($catInfo['category_name']) . '</span>
					<span><em>publisher:</em> ' . stripslashes($product_details['publisher']) . '</span>
		           </div>       <div class="space_content">';
            $datahistory .= '</div>
		        <div class="prices_content">&#x20a6;' . $producturrency->currencyconverter($getCurrencyName, "NGN", $price) . '</div>
		        <div style="float: left;padding: 5% 0;text-align: center;width: 109px;">
		        	<div class="">';
            if ($dataDet['group_id'] != 0) {
                $datahistory .= '<div >' . $dataDet['quantity'] . '</div>';
            }
            $datahistory .= '</div>
		        </div>
		        <div class="total_content">&#x20a6;' . @number_format($producturrency->currencyconverter($getCurrencyName, "NGN", $dataDet['quantity'] * $price), 2) . '</div>    
		 		</div>';
        }
        $datahistory .= '<div class="shipping_total">
					<div class="row">
				    	<div class="lt">Subtotal</div>
				        <div class="rt">&#x20a6;' . @number_format($total_price, 4) . '</div>
				    </div>
				 		    
				    <div class="row" style="border:none;">
				    	<div class="lt">Tax</div>
				        <div class="rt">&#x20a6;' . '00.00</div>
				    </div>
				    
				    <div class="row subtotal">
				    	<div class="lt">Total</div>
				        <div class="rt">&#x20a6;' . @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'];
    }