Post by snjflame » Sat Jan 16, 2010 12:51 am

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!

Newbie

Posts

Joined
Sat Jan 16, 2010 12:34 am

Post by suraj.work0126 » Sat Mar 14, 2015 2:59 pm

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 :)


Posts

Joined
Sat Mar 14, 2015 2:51 pm
Who is online

Users browsing this forum: No registered users and 5 guests