Sometime we forget check a category when inserting a new product, as a result those product will not display in the web site, So i want to add a validation to the Product Insert form.
pls help!
Step 1:
just go to controller of admin follow the path below
/admin/controller/catalog/product.php
in this file you find validateForm() function at approx 1295 line
inside the foreach loop just put the code below
if ((utf8_strlen($this->request->post['category']) < 1) || (utf8_strlen($this->request->post['category']) > 64)) {
$this->error['category'] = $this->language->get('error_cat');
}
Step 2: Now open product_form.tpl
/admin/view/catalog/product_form.tpl
there you find
<tr>
<td><?php echo $entry_category; ?></td>
<td><input type="text" name="category" value="" /></td>
</tr>
at approx 227 line
Replace this with code below
<tr>
<td><span class="required">*</span><?php echo $entry_category; ?></td>
<td><input type="text" name="category" value="" />
<?php if ($error_cat) { ?>
<span class="error"><?php echo $error_cat; ?></span>
<?php } ?>
</td>
</tr>
That solve
just go to controller of admin follow the path below
/admin/controller/catalog/product.php
in this file you find validateForm() function at approx 1295 line
inside the foreach loop just put the code below
if ((utf8_strlen($this->request->post['category']) < 1) || (utf8_strlen($this->request->post['category']) > 64)) {
$this->error['category'] = $this->language->get('error_cat');
}
Step 2: Now open product_form.tpl
/admin/view/catalog/product_form.tpl
there you find
<tr>
<td><?php echo $entry_category; ?></td>
<td><input type="text" name="category" value="" /></td>
</tr>
at approx 227 line
Replace this with code below
<tr>
<td><span class="required">*</span><?php echo $entry_category; ?></td>
<td><input type="text" name="category" value="" />
<?php if ($error_cat) { ?>
<span class="error"><?php echo $error_cat; ?></span>
<?php } ?>
</td>
</tr>
That solve

Who is online
Users browsing this forum: No registered users and 5 guests