Post by seachen » Wed Jan 05, 2011 3:57 am

i need to set Subtract Stock = no, everytime i add product

how to make it default Subtract Stock = no?

New member

Posts

Joined
Mon Oct 25, 2010 8:15 pm

Post by mystifier » Wed Jan 05, 2011 5:43 am

You will need to do this with a database management tool (eg. phpMyAdmin).

In the `Product` table definition, change the default value of the `Subtract` field from 1 to 0

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm

Post by Qphoria » Wed Jan 05, 2011 6:24 am

No.. he means the default.

1. EDIT: admin/controller/catalog/product.php

2. FIND:
$this->data['subtract'] = 1;

3. REPLACE WITH:
$this->data['subtract'] = 0;

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by seachen » Wed Jan 05, 2011 12:08 pm

thanks. a lot

New member

Posts

Joined
Mon Oct 25, 2010 8:15 pm

Post by ahdindy » Thu Oct 13, 2011 11:01 am

Thanks, that was helpful for future products, but I have close to 600 products that I would like to change the Subtract Stock option on (in the Data tab) from Yes to No...is there any quicker way to do that than going in one by one and changing the status?

Thanks!

Newbie

Posts

Joined
Sat May 28, 2011 2:26 am

Post by SXGuy » Thu Oct 13, 2011 5:40 pm

refer to first answer, change the field from 1 to 0 using phpmyadmin. Or install export/import tool and use the exported spreadsheet and mass change the column for subtrack stock.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by ahdindy » Thu Oct 13, 2011 7:04 pm

SXGuy wrote:refer to first answer, change the field from 1 to 0 using phpmyadmin. Or install export/import tool and use the exported spreadsheet and mass change the column for subtrack stock.
Thanks...I did that but the Subtract Stock still didn't change for the products in the admin area. Did I do something wrong?

Newbie

Posts

Joined
Sat May 28, 2011 2:26 am

Post by ahdindy » Thu Oct 13, 2011 7:24 pm

I did some thinking and finally just edited the code. I went to:

catalog\view\theme\default\template\checkout\cart.tpl

And deleted the lines:

<?php if (!$product['stock']) { ?>
<span style="color: #FF0000; font-weight: bold;">***</span>
<?php } ?>

Which gets rid of the asterisks after the product name - crude, I know, but effective :) If you use a different template you'll need to do that in the active template, not in the default theme.

Newbie

Posts

Joined
Sat May 28, 2011 2:26 am

Post by haydent » Tue Jan 17, 2012 4:19 pm

Qphoria wrote:No.. he means the default.

1. EDIT: admin/controller/catalog/product.php

2. FIND:
$this->data['subtract'] = 1;

3. REPLACE WITH:
$this->data['subtract'] = 0;

this worked fine thankyou.

User avatar
Active Member

Posts

Joined
Wed Nov 09, 2011 9:50 am
Location - Sydney, Australia

Post by thbr02 » Wed Feb 08, 2012 4:39 pm

Is there anyway to change the subtract stock default for the option stock as well?

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden

Post by kotysoft » Thu Jun 14, 2012 5:32 pm

thbr02 wrote:Is there anyway to change the subtract stock default for the option stock as well?
Simply change the order of lines
(yes, no >> no, yes)

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>'
Modify

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>'

New member

Posts

Joined
Sat Feb 06, 2010 10:01 pm

Post by rph » Thu Jun 14, 2012 11:23 pm

thbr02 wrote:Is there anyway to change the subtract stock default for the option stock as well?
If you don't feel like editing code yourself there's also Admin Enhancement Suite which allows you to set subtract stock defaults for product and option quantities.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by xlam » Sun Jun 24, 2012 11:34 pm

Qphoria wrote:No.. he means the default.

1. EDIT: admin/controller/catalog/product.php

2. FIND:
$this->data['subtract'] = 1;

3. REPLACE WITH:
$this->data['subtract'] = 0;
working for me ;D

Baju Muslim Baju Pria Baju Anak Baju Korea Sparepart Printer Baju Muslim JNE Surabaya


New member

Posts

Joined
Sun Dec 25, 2011 2:58 pm

Post by Avvici » Mon Jun 25, 2012 1:01 am

rph wrote:
thbr02 wrote:Is there anyway to change the subtract stock default for the option stock as well?
If you don't feel like editing code yourself there's also Admin Enhancement Suite which allows you to set subtract stock defaults for product and option quantities.
Is there an extension that you "don't" have? :crazy:

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by neljan » Fri Nov 20, 2015 8:56 am

Thanks very much Qphoria. I found this thread looking for an answer to the same question.

In 2.0.x it's slightly different:

1. EDIT: admin/controller/catalog/product.php

2. FIND:
$data['subtract'] = 1;

3. REPLACE WITH:
$data['subtract'] = 0;

Cheers!

Newbie

Posts

Joined
Fri Nov 13, 2015 8:35 pm

Post by parkookk » Thu Sep 28, 2023 8:08 pm

Hi, I use OC3038 and would like the Subtract Stock to be NO by default as I it's a website that sells services.
The solution above doesn't work with my OC.
Many Thanks

I am using English OpenCart 3.0.3.8, Default Template/Theme, php 7.4, Latest Brave Browser (No Ads-Blocker, etc.)


User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by WaxedPerfection » Thu Sep 28, 2023 8:30 pm

parkookk wrote:
Thu Sep 28, 2023 8:08 pm
Hi, I use OC3038 and would like the Subtract Stock to be NO by default as I it's a website that sells services.
The solution above doesn't work with my OC.
Many Thanks
carnt you just set your stock levels to 999999 rather than tinkering? seems a better option to me and future proof.

i carnt remeber if OC 3.0.3.8 has in each product the option to "Subtract Stock" set to NO under the data tab.
(update on my part - Yes it does under that data the tab)

https://www.waxedperfection.co.uk/ Car Detailing Product Blog's and Review's


Active Member

Posts

Joined
Sun Mar 26, 2017 8:23 pm

Post by ADD Creative » Fri Sep 29, 2023 7:19 am

parkookk wrote:
Thu Sep 28, 2023 8:08 pm
Hi, I use OC3038 and would like the Subtract Stock to be NO by default as I it's a website that sells services.
The solution above doesn't work with my OC.
Many Thanks
Did you refresh modifications?

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 94 guests