Ecommerce new product defaults

Hopefully this is an easy answer for those of you that are proficient coders out there. I am looking for a way to set the defaults for the add product screen. For example, whenever I add a new product, it always comes up as disabled. I would like the screen to add a product to always come up as enabled and have the unlimited quantity checkbox checked. Does anyone know what file I can find this info in so I can change it. I have browsed around the ecommerce files but have not seemed to dig up what I am looking for.

View Replies: View Best Answer
mesuva replied on at Permalink Best Answer Reply
The form for adding products is located at /packages/core_commerce/elements/product/form.php

You'd want to copy this to /elements/product/form.php and edit it there.

To change the defaults, the best way to do it I believe is to set things before the line:
if(is_object($product)) {

so that you're not inferring with the form when it's used for editing an existing product.

So in your case, above that line you could add:
$prStatus = true;
$prQuantityUnlimited = true;

to set the product to enabled and unlimited stock by default.
yunotakemymoney replied on at Permalink Reply
thanks a bunch, worked like a charm!
PassionForCreative replied on at Permalink Reply

I recently used this, however it does not appear to work.

When we import, the checkbox for Unlimited Quantity is checked, but if you try to add an item more than once it says there is not enough stock.

If I go to the product attributes, I can see the Unlimited Quantity is checked, I uncheck, re-check and click save, now it is set to unlimited and I can add multiples of an item.

I did exactly as was mentioned here, except "You'd want to copy this to /elements/product/form.php and edit it there." As I wasnt entirely sure where to copy it too.

Can you advise?

mesuva replied on at Permalink Reply
Hi Barry,

all that this edit does is modify the defaults for the form to add new products - it doesn't change anything else to do with importing product data.

Since you've used the word 'import' instead of add, I'm assuming you're using this add-on to do your product import - ?

If that's the case, it sounds like you're missing a piece of import data, perhaps it's a question to ask via the support for the add-on.

Regarding the path /elements/product/form.php, this means you should find the highest elements folder you can find (they'll be an index.php file at the same level, that's the site 'root'), put a product folder in that, and copy the file from the package into there. The top level empty folders are all the override folders that you use when you want to make a change to something in the core or an add-on.
PassionForCreative replied on at Permalink Reply
Thank you, and apologies for incorrect posting.