VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: artoulis on December 12, 2019, 10:01:23 AM

Title: Writing new field in SQL regarding specific order
Post by: artoulis on December 12, 2019, 10:01:23 AM
Hello,

i have developed a php script inside views/orders/tmpl/order.php
When a user press the button inside an order in the backend it "sends" a few fields from the objects $this->orderbt and $this->orderbt to an external software.

What i would like to do is "check" if it has been sent in the past or not, so i was thinking to write a new field into the object class $this->orderbt->newfield

do you know of any way to do this?
thank you in advance,
Title: Re: Writing new field in SQL regarding specific order
Post by: GJC Web Design on December 12, 2019, 10:19:45 AM
why not make a new status  and set the order to this status when the info is sent?
Title: Re: Writing new field in SQL regarding specific order
Post by: artoulis on December 12, 2019, 10:35:11 AM
hmmm
how can i do that?
Title: Re: Writing new field in SQL regarding specific order
Post by: artoulis on December 12, 2019, 11:23:53 AM
never mind, i figured how to do it.
however when the status of the order will be changed to shipped for example i'm still loosing this functionality.
do you have any other suggestions?
Title: Re: Writing new field in SQL regarding specific order
Post by: Studio 42 on December 12, 2019, 11:47:37 AM
Use own table and add record.
If record exist, do not send again.
You can use own plugin for this and show a button if no record exist only and you can do this using ajax to not reload the whole view.
Title: Re: Writing new field in SQL regarding specific order
Post by: artoulis on December 14, 2019, 22:44:34 PM
Thank you studio42   :)
I appreciate it.
Title: Re: Writing new field in SQL regarding specific order
Post by: Milbo on December 17, 2019, 21:58:10 PM
Quote from: artoulis on December 12, 2019, 10:01:23 AM
Hello,

i have developed a php script inside views/orders/tmpl/order.php
When a user press the button inside an order in the backend it "sends" a few fields from the objects $this->orderbt and $this->orderbt to an external software.

What i would like to do is "check" if it has been sent in the past or not, so i was thinking to write a new field into the object class $this->orderbt->newfield

do you know of any way to do this?
thank you in advance,


Super simpel, just create a new userfield. It will create the column(s). You can directly create a one for plugins and write a plugin for the job.
Title: Re: Writing new field in SQL regarding specific order
Post by: AH on December 18, 2019, 10:31:20 AM
No doubt you will want  to know when, not just if, it was pressed

So suggest use a date field