Пример #1
0
    public function savepriceAction()
    {
        $this->view->messages = $this->_flashMessenger->getMessages();
        $this->_helper->layout->disableLayout();
        $formData = array();
        $formErrors = array();
        $formData = $this->getRequest()->getPost();
        if ($this->getRequest()->isPost() && (!empty($formData['createprice']) && $formData['createprice'] == 'Update Price')) {
            if (!isset($formData['country']) || trim($formData['country']) == "") {
                $formErrors['country'] = "Please select country ";
            }
            if (!isset($formData['language']) || trim($formData['language']) == "") {
                $formErrors['language'] = "Please select language";
            }
            if (!isset($formData['price']) || trim($formData['price']) == "") {
                $formErrors['price'] = "Please select price";
            }
        }
        $modelPrice = new Publisher_Model_DbTable_BookPrices();
        $pricedata = $modelPrice->fetchAll("id='" . $_POST['priceid'] . "'");
        ?>
	
	  <form name="form-add-price" id="form-add-price" method="post" onsubmit="return updateprice1('<?php 
        echo $_POST['priceid'];
        ?>
','http://www.miprojects.com.php53-16.ord1-1.websitetestlink.com/projects/evendor/publisher/book/updateproductprice/productid/<?php 
        echo $_POST['productid'];
        ?>
','<?php 
        echo $_POST['productid'];
        ?>
');">
	  <fieldset class="dashboard_fieldset">
			<legend>Publication Store & Langauge</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" id="country" class="req"  message="Please select country">
				<option value="">Select Store</option>
				
				<?php 
        for ($ii = 0; $ii < count($countryList); $ii++) {
            ?>
				<option value="<?php 
            echo $countryList[$ii]['id'];
            ?>
" <?php 
            if ($pricedata[0]["country_id"] == $countryList[$ii]["id"]) {
                ?>
 selected <?php 
            }
            ?>
 ><?php 
            echo $countryList[$ii]['country'];
            ?>
</option>
				<?php 
        }
        ?>
		   
				</select>
				
				<?php 
        if (array_key_exists('country', $formErrors)) {
            echo '<div class="inline-error">' . $formErrors['country'] . '</div>';
        }
        ?>

				</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 
            if ($pricedata[0]["language_id"] == $languageList[$ii]['id']) {
                ?>
 selected <?php 
            }
            ?>
><?php 
            echo $languageList[$ii]['language_name'];
            ?>
</option>
				<?php 
        }
        ?>
		   
				</select>
				
				<?php 
        if (array_key_exists('language', $formErrors)) {
            echo '<div class="inline-error">' . $formErrors['language'] . '</div>';
        }
        ?>

				</td>
				</tr>
		
				<tr>
				<td class="tdleftBold">Price<span class="required">*</span> : </td>
				<td>
				<input type="text" name="price" id="price"  class="req" value="<?php 
        echo $pricedata[0]["price"];
        ?>
"  message="Please enter price"/>
				<?php 
        if (array_key_exists('price', $formErrors)) {
            echo '<div class="inline-error">' . $formErrors['price'] . '</div>';
        }
        ?>
				</td>
				</tr>
				
				<tr>
				<td class="tdleftBold">Group Price : </td>
				<td>
				<input type="text" name="group_price" id="group_price" value="<?php 
        echo $pricedata[0]["group_price"];
        ?>
" />
				<?php 
        if (array_key_exists('price', $formErrors)) {
            echo '<div class="inline-error">' . $formErrors['price'] . '</div>';
        }
        ?>
				</td>
				</tr>
		
				<tr>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2">
						<div style="text-align:center;">
							<input type="hidden" name="createprice" value="Update Price">
							<input type="hidden" name="productid" id="productid" value="<?php 
        echo $_POST['productid'];
        ?>
" />
							<input type="hidden" name="priceid" id="priceid" value="<?php 
        echo $_POST['priceid'];
        ?>
" />
							<input type="submit" name="updateprice" id="updateprice" value="Update Price" class="button-Save"/>
						</div>
						
					</td>
				</tr>

				</table>
		</fieldset>
		</form>
 
	<?php 
        exit;
    }