Hello Guys,
I am using the latest version of opencart 2.2.0.0 .. and i need to make the model no. in product form in admin not mandatory and if this field is empty dont have a value , so to hide the model no. in product page on frontend .. how to do that please ?
can someone help me ?
Thanks
I am using the latest version of opencart 2.2.0.0 .. and i need to make the model no. in product form in admin not mandatory and if this field is empty dont have a value , so to hide the model no. in product page on frontend .. how to do that please ?
can someone help me ?
Thanks
First in admin/view/template/catalog/product_form.tpl find around line 98-105
And just change to
Then in catalog/view/theme/YOUR_THEME/template/product/product.tpl and find around line 131
And comment it out like this
Code: Select all
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-model"><?php echo $entry_model; ?></label>
<div class="col-sm-10">
<input type="text" name="model" value="<?php echo $model; ?>" placeholder="<?php echo $entry_model; ?>" id="input-model" class="form-control" />
<?php if ($error_model) { ?>
<div class="text-danger"><?php echo $error_model; ?></div>
<?php } ?>
</div>
Code: Select all
<div class="form-group ">
<label class="col-sm-2 control-label" for="input-model"><?php echo $entry_model; ?></label>
<div class="col-sm-10">
<input type="text" name="model" value="<?php echo $model; ?>" placeholder="<?php echo $entry_model; ?>" id="input-model" class="form-control" />
<?php if ($error_model) { ?>
<div class="text-danger"><?php echo $error_model; ?></div>
<?php } ?>
</div>
Code: Select all
<?php echo $text_model; ?> <?php echo $model; ?>
Code: Select all
<!-- <li><?php echo $text_model; ?> <?php echo $model; ?></li> -->
Ah ok
Try this then,
First in admin/view/template/catalog/product_form.tpl find around line 98-105
And just change to
Then in admin/controller/catalog/product.php around line 1318 find
And change to
Then in catalog/view/theme/YOUR_THEME/template/product/product.tpl around line 132 find
And change to
Hopefully this will help you out
And anyone wiser than me then please feel free to let me know if this is wrong !!
Try this then,
First in admin/view/template/catalog/product_form.tpl find around line 98-105
Code: Select all
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-model"><?php echo $entry_model; ?></label>
<div class="col-sm-10">
<input type="text" name="model" value="<?php echo $model; ?>" placeholder="<?php echo $entry_model; ?>" id="input-model" class="form-control" />
<?php if ($error_model) { ?>
<div class="text-danger"><?php echo $error_model; ?></div>
<?php } ?>
</div>
And just change to
Code: Select all
<div class="form-group ">
<label class="col-sm-2 control-label" for="input-model"><?php echo $entry_model; ?></label>
<div class="col-sm-10">
<input type="text" name="model" value="<?php echo $model; ?>" placeholder="<?php echo $entry_model; ?>" id="input-model" class="form-control" />
<?php if ($error_model) { ?>
<div class="text-danger"><?php echo $error_model; ?></div>
<?php } ?>
</div>
Code: Select all
if ((utf8_strlen($this->request->post['model']) < 1) || (utf8_strlen($this->request->post['model']) > 64)) {
$this->error['model'] = $this->language->get('error_model');
}
Code: Select all
if ((utf8_strlen($this->request->post['model']) > 64)) {
$this->error['model'] = $this->language->get('error_model');
}
Code: Select all
<li><?php echo $text_model; ?> <?php echo $model; ?></li>
Code: Select all
<?php if ($model) { ?>
<li><?php echo $text_model; ?> <?php echo $model; ?></li>
<?php } ?>
And anyone wiser than me then please feel free to let me know if this is wrong !!
Thank you for your help, actually i tried this out , the model no in admin remained mandatory .. but then i used an extension that make model no not mandatory .. and i modified in catalog/view/theme/YOUR_THEME/template/product/product.tpl .. so it became hidden from frontend .. so its ok now.
if i need to add a "Vendor code" field also in product form .. i make the same way ? right ?
if i need to add a "Vendor code" field also in product form .. i make the same way ? right ?
This may give you a few clues, but this is only up to version 2.1
If you goto the relevant files and compare the data you should be able to work out how to get this working
Always make a backup FIRST though, just in case
EDIT: have made an ocmod to test on oc2.2 and works good
If you goto the relevant files and compare the data you should be able to work out how to get this working
Always make a backup FIRST though, just in case
EDIT: have made an ocmod to test on oc2.2 and works good
Take note from the link above that the following parts of instructions on that site where it indicates:
andafter adding the above code, the complete insert query will be like this:
might be subject to change upon Opencart releases since these instructions describe results on a block of code that may have been modified afterwards.after adding the above code, the complete update query will be like this:
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
ya , i followed exactly the steps but i face error on admin :
Notice: Undefined index: entry_newfield1 in /home/fekman/public_html/test/vqmod/vqcache/vq2-system_storage_modification_admin_model_catalog_product.php on line 136
and also on frontend doesnt show the field ?
Notice: Undefined index: entry_newfield1 in /home/fekman/public_html/test/vqmod/vqcache/vq2-system_storage_modification_admin_model_catalog_product.php on line 136
and also on frontend doesnt show the field ?
Followed is the FAQ topic regarding VQ2 Cache errors: http://forum.opencart.com/viewtopic.php?f=170&t=165657vaguemind wrote:ya , i followed exactly the steps but i face error on admin :
Notice: Undefined index: entry_newfield1 in /home/fekman/public_html/test/vqmod/vqcache/vq2-system_storage_modification_admin_model_catalog_product.php on line 136
and also on frontend doesnt show the field ?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Did you make sure you run the sql query to start with And to display in front end you have to follow link at bottomvaguemind wrote:ya , i followed exactly the steps but i face error on admin :
Notice: Undefined index: entry_newfield1 in /home/fekman/public_html/test/vqmod/vqcache/vq2-system_storage_modification_admin_model_catalog_product.php on line 136
and also on frontend doesnt show the field ?
The table prefix name: oc_ may have to be renamed if a different prefix name is involved. Otherwise, the query will fail to add the field to the proper target database table.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Who is online
Users browsing this forum: No registered users and 107 guests