Adding custom field

Phoca Cart - complex e-commerce extension
rusty-bearing
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 19 Nov 2023, 18:26

Adding custom field

Post 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?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49125
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Adding custom field

Post 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
If you find Phoca extensions useful, please support the project
rusty-bearing
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 19 Nov 2023, 18:26

Re: Adding custom field

Post 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 😊
Post Reply