Txmmy83 Posted March 31, 2012 Report Posted March 31, 2012 think it have not been asked before? if yes please give me a hint where I have added something like this to simpilots charter module to get prices for the charter flights which works quite well $charter[price] = ($distance/100)*20; is it possible to remove the manual price input and do it in background following maths operations like above? Best Regards and Thanks in advance Thomas Quote
Moderators Kyle Posted March 31, 2012 Moderators Report Posted March 31, 2012 You would need to edit the core files, but I'm not sure what your trying to do here. Are you saying that you don't want the price to be counted in the schedule flight and use the php math in the code you used and put it in the schedules? Is that that your trying to do? Quote
Txmmy83 Posted March 31, 2012 Author Report Posted March 31, 2012 You would need to edit the core files, but I'm not sure what your trying to do here. Are you saying that you don't want the price to be counted in the schedule flight and use the php math in the code you used and put it in the schedules? Is that that your trying to do? what I want to do is that php math calculates the flight price for me and fill it in the flightplan formular it works great with Charter Modul from Simpilot but I don't know how I can get it into the schedule submit form in admin backend Quote
Moderators Kyle Posted March 31, 2012 Moderators Report Posted March 31, 2012 what I want to do is that php math calculates the flight price for me and fill it in the flightplan formular it works great with Charter Modul from Simpilot but I don't know how I can get it into the schedule submit form in admin backend Your likely going to have to edit the admin core files, and what if you updated your phpVMS and you'll lose that feature? If you want to go ahead and agree with that and it's not my fault for you to lose that feature when you update, and I'll type a piece of a code, simple and I'll show you how. Quote
Txmmy83 Posted March 31, 2012 Author Report Posted March 31, 2012 Your likely going to have to edit the admin core files, and what if you updated your phpVMS and you'll lose that feature? If you want to go ahead and agree with that and it's not my fault for you to lose that feature when you update, and I'll type a piece of a code, simple and I'll show you how. yes please help me with the code just found out that 30 works better as multiplicator thanks in advance Thomas Quote
Moderators Kyle Posted March 31, 2012 Moderators Report Posted March 31, 2012 Okay, here we go... 1) Go to admin/modules/Operations/Operations.php 2) Find the following line... (Around Line 950 to 1150) $data = array( 'code' => $this->post->code, 'flightnum' => $this->post->flightnum, 'depicao' => $this->post->depicao, 'arricao' => $this->post->arricao, 'route' => $this->post->route, 3) Add before the line I posted above the $data = array $payperdis = ($this->post->distance/100)*20; 4) Then we need to change the $data arrays, so find this, in the same area 'price' => $this->post->price, 5) Replace the code with the following... 'price' => $payperdis, And it should do it automatically for you, and if you putted in the price, remember, it will change because of that. 1 Quote
Txmmy83 Posted March 31, 2012 Author Report Posted March 31, 2012 thank you very much will make the changes tomorow since I have a flight running at the moment! modified your code a bit $payperdis = round((($this->post->distance/100)*30), 2); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.