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

Re: Adding custom field

Post 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
If you find Phoca extensions useful, please support the project
Post Reply