Page 1 of 1

Adding custom field

Posted: 04 Dec 2025, 09:10
by rusty-bearing
I need a 'stock_notes' field in the advanced stock option which i have managed to add and saves text succesfully but for the life of me i can't get it to show/load the text on save or when the modal opens. Which file controls this please?

Re: Adding custom field

Posted: 06 Dec 2025, 01:33
by Jan
Hi, Phoca Cart uses standard MVC - this means, the html produces the input, the input saves it - the controller is run and then it saves it to database in model. Did you create all the steps:

- input field
- preparing the data in model
- database field (store the value in model)
- and load it after saving?

Jan

Re: Adding custom field

Posted: 08 Dec 2025, 10:27
by rusty-bearing
Here's what i've done

1. created #_phocacatabaseart_stock_notes in the
2. added the input field in models/forms/subform_product_stock.xml
3. updated the thable class in tables/phocacartproductstock.php with var $stock_note = '';

So now in the advanced stock options modal I have the field and can enter text which on 'save' is in the stock notes table but disappears from the modal stock notes field.
Advice gratefully received 😊

Re: Adding custom field

Posted: 12 Dec 2025, 03:39
by Jan
Hi, I didn't do such customization yet, so hard to say what is working on your server and what not. You just need to debug it and see if the value is stored in database, if not, then why not, if yes, then if it is loaded to the form, etc. etc. :idea:

Unfortunately, programming does not work the way that without seeing and debugging the code you can say where the problem is located :-(

Jan