Hi all,
I was just wondering what the best method for setting the subtract stock option to NO as default when adding a product. I would also like this field to be set to NO when adding options.
Running OC v1.5.1 - any info is appreciated.
Thank you.
I was just wondering what the best method for setting the subtract stock option to NO as default when adding a product. I would also like this field to be set to NO when adding options.
Running OC v1.5.1 - any info is appreciated.
Thank you.
Cheers, Sam
here is a mod that will do it for you. not sure if it works on options though
http://www.opencart.com/index.php?route ... order=DESC
http://www.opencart.com/index.php?route ... order=DESC
“Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.”
- Henry Ford
then do it manually, find this file admin > controller > catalog > product.php
find this line of code around line 841
change it to
find this line of code around line 841
Code: Select all
$this->data['subtract'] = 1;
Code: Select all
$this->data['subtract'] = 0;
“Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.”
- Henry Ford
Tried that, however there are a couple of issues...
1. the subtract stock field stays set to YES even though it saves as NO (not a big deal..)
2. if you add options to a product, the product subtract stock resets back to yes...
1. the subtract stock field stays set to YES even though it saves as NO (not a big deal..)
2. if you add options to a product, the product subtract stock resets back to yes...
Cheers, Sam
As per my understanding to the question, i have written below:
Change to be done at admin/view/template/catalog/product_form.tpl
=====================
For subtract
Find below
=====================
<?php if ($subtract) { ?>
<option value="1" selected="selected"><?php echo $text_yes; ?></option>
<option value="0"><?php echo $text_no; ?></option>
<?php } else { ?>
===================================
Change to
===================================
<?php if ($subtract) { ?>
<option value="1"><?php echo $text_yes; ?></option>
<option value="0" selected="selected"><?php echo $text_no; ?></option>
<?php } else { ?>
=====================================
For options
on the same product_form.tpl
Find
=====================================
<?php if ($product_option_value['subtract']) { ?>
<option value="1" selected="selected"><?php echo $text_yes; ?></option>
<option value="0"><?php echo $text_no; ?></option>
<?php } else { ?>
<option value="1"><?php echo $text_yes; ?></option>
<option value="0" selected="selected"><?php echo $text_no; ?></option>
<?php } ?>
</select>
======================================
<?php if ($product_option_value['subtract']) { ?>
<option value="1" ><?php echo $text_yes; ?></option>
<option value="0" selected="selected"><?php echo $text_no; ?></option>
<?php } else { ?>
<option value="1"><?php echo $text_yes; ?></option>
<option value="0" selected="selected"><?php echo $text_no; ?></option>
<?php } ?>
</select>
======================================
Find
======================================
html += '<td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][subtract]">';
html += ' <option value="1"><?php echo $text_yes; ?></option>';
html += ' <option value="0" ><?php echo $text_no; ?></option>';
html += ' </select></td>';
=====================================
Replace with
=====================================
html += '<td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][subtract]">';
html += ' <option value="1"><?php echo $text_yes; ?></option>';
html += ' <option value="0" selected="selected" ><?php echo $text_no; ?></option>';
html += ' </select></td>';
Seem codes look long but change is small, i showed all the codes for better understanding, hope this will work out.
Visit http://rupaknepali.com.np for more logics
Change to be done at admin/view/template/catalog/product_form.tpl
=====================
For subtract
Find below
=====================
<?php if ($subtract) { ?>
<option value="1" selected="selected"><?php echo $text_yes; ?></option>
<option value="0"><?php echo $text_no; ?></option>
<?php } else { ?>
===================================
Change to
===================================
<?php if ($subtract) { ?>
<option value="1"><?php echo $text_yes; ?></option>
<option value="0" selected="selected"><?php echo $text_no; ?></option>
<?php } else { ?>
=====================================
For options
on the same product_form.tpl
Find
=====================================
<?php if ($product_option_value['subtract']) { ?>
<option value="1" selected="selected"><?php echo $text_yes; ?></option>
<option value="0"><?php echo $text_no; ?></option>
<?php } else { ?>
<option value="1"><?php echo $text_yes; ?></option>
<option value="0" selected="selected"><?php echo $text_no; ?></option>
<?php } ?>
</select>
======================================
<?php if ($product_option_value['subtract']) { ?>
<option value="1" ><?php echo $text_yes; ?></option>
<option value="0" selected="selected"><?php echo $text_no; ?></option>
<?php } else { ?>
<option value="1"><?php echo $text_yes; ?></option>
<option value="0" selected="selected"><?php echo $text_no; ?></option>
<?php } ?>
</select>
======================================
Find
======================================
html += '<td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][subtract]">';
html += ' <option value="1"><?php echo $text_yes; ?></option>';
html += ' <option value="0" ><?php echo $text_no; ?></option>';
html += ' </select></td>';
=====================================
Replace with
=====================================
html += '<td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][subtract]">';
html += ' <option value="1"><?php echo $text_yes; ?></option>';
html += ' <option value="0" selected="selected" ><?php echo $text_no; ?></option>';
html += ' </select></td>';
Seem codes look long but change is small, i showed all the codes for better understanding, hope this will work out.
Visit http://rupaknepali.com.np for more logics
Rupak Nepali
webocreation.com@gmail.com
http://webocreation.com
Enjoy! Tips and tricks as well as free module.
Admin Enhancement Suite also allows you to set defaults for your products like subtract stock (both product and product options).
-Ryan
rupaknepali wrote:As per my understanding to the question, i have written below:
Change to be done at admin/view/template/catalog/product_form.tpl
=====================
For subtract
Find below
=====================
...
It's more safe and simplier (for option subtract) to change the direction...
Find
admin/view/template/catalog/product_form.tpl
Code: Select all
html += '<td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][subtract]">';
html += ' <option value="1"><?php echo $text_yes; ?></option>';
html += ' <option value="0" ><?php echo $text_no; ?></option>';
html += ' </select></td>'
Code: Select all
Find
======================================
html += '<td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][subtract]">';
html += ' <option value="0" ><?php echo $text_no; ?></option>';
html += ' <option value="1"><?php echo $text_yes; ?></option>';
html += ' </select></td>'
Who is online
Users browsing this forum: No registered users and 99 guests