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 😊