I am using free version of the script Open Real Estate.
I need to add some extra fields to the booking page.
I added the HTML part in "/themes/classic/views/modules/booking/views/_form.php" and I now need to add them to the PHP code, part which I find a bit tricky.
Can anyone suggest how to approach the problem?
PS: The extra fields should only be sent by email to the owner and not listed in the admin panel.
Regards!
Well it's not tricky at all, you just have to take it one step at the time.
Since you already modified the _form file I think the next step is to add properties to the model. In your model add public properties that should be named exactly like the name of the input type in the view. You can set the validation for them if you like but if you don't care just list them as safe ( which means safe to assign without any custom validation ). Now go into the appropriate action of the controller and after you mass assign the $_POST to the model and use those properties in your mailer function after booking has been saved. Alternative approach is to do the mailing in afterSave() in your model.
Related
I have a situation where I need to create a shortcut for a specific filter in a Joomla component.
The problem is that I cannot unset it, as I do not know if Joomla sets the form fields to its own session handler, request handler or some kind of custom handler. There also does not appear to be any documentation on this specific case.
The full situation is that I have a link that will auto filter in the same view as another link (in the components sidebar). One view will be just a specific filter and the other is standard. So I need it when you click into the filtered view it will reset the current filters to make sure everything displays as it should, and vice-versa so clicking back will again reset the filters.
I have tried a number of approaches for this, and although I can consistently force it to filter but it will not reset the form when I re-enter the last page with any technique I have tried so far and of course I want to avoid bypassing Joomla's default functions.
if(JRequest::getVar('filter_group_id',false)==10){
JRequest::setVar('last_filter',true);
EthicstoolHelper::addSubmenu('supervisors');
}else{
if(JRequest::getVar('last_filter',false)===true){
JRequest::setVar('last_filter',false);
JRequest::setVar('filter_group_id',false)
}
EthicstoolHelper::addSubmenu('users');
}
This is the most recent think I have tried, as you can see I try to reset the value to false in a hope that Joomla will read it as not being set, as JRequest has no built in unset method.
I don't have enough rep to comment yet, so I'm guessing a bit as to what the problem could be. Assuming that you are using a model to set the state of the filters, you can look at overriding the populateState method.
Another options is to fiddle with the context property in the model. For example, you could change the context if you have your special filters enabled if you are using things like $app->getUserStateFromRequest(). If you can post a bit more information about the design of your component (controllers and models), I can help more.
I am working on a symfony 1.4 project and am trying to add a custom field in a backend form. At the moment, my module has a batch history with editing and deleting options for each row and a form that allows the user to filter through it. I would like to add a custom creation form and I am struggling to do that.
Going on the /*model_name*/new/ page does show me a form: this is the form I would like to make changes to.
I would like to display a dropdown list of elements from another table (and model) on this page. How can I do that knowing that the current module's widgetSchema doesn't have that relation?
Should I edit generator.yml? When I try adding a title: to new: , it doesn't seem to affect the /new/ page (even after cache:clear).
It would be easier if you create that relation in your schema.yml. Your generated form will be able to render the widget you want.
Otherwise, what you need to do is edit the *model_name*Form class by adding the widget and validator you want (sfWidgetFormDoctrineChoice and sfValidatorDoctrineChoice in your case)
The generator.yml uses the form *model_name*Form class by default, but I suggest you copy this class in a lib folder you create in your module, and edit this one instead. Then, you edit your generator.yml to use this new form, this is how you do it
Also, make sure there is not much rows in the table of your relation. Else, symfony will try to generate a html select tag with a lot of options and you will need to kill your php and even webserver processes.
Yes, you need to edit generator.yml, but in the form line:
# apps/backend/modules/whatever/config/generator.yml
config:
...
form:
display:
Whatever...
Here you have some examples. Taken from the official documentation:
http://symfony.com/legacy/doc/jobeet/1_4/en/12?orm=Doctrine#chapter_12_form_views_configuration
This way, the form that the generator uses will be the one you specify. And maybe you don't need to modify something else.
How can I add a form or HTML output to plgVmOnSelectPayment()?
I see no documentation about that.
I don't know this event Virtuemart payment select works.
I want add after selection a form with input fields.
Can anyone help ?
The plgVmOnSelectPayment() from what I've reversed engineered doesn't give any output to the HTML, but you can modify the cart content with that event.
I was myself in need of adding a form after a particular payment method was selected (to guarantee some additional data being supplied). Depending on where you want it you can either edit the View for the cart and add an if-statement where you see if the particular payment method is chosen. And then later access this information from plgVmConfirmedOrder() (you can access it through the $_POST global.
(This is an untested theory)
If you want to add the information to the field you can access the display form and add information there through the plgVmDisplayListFEPayment() event. Look in the vmPSPlugin class to see how they manage it there. What I did was simply copy that to get an image into that form, but you should be able to add other things there as well. And then you might be able to access the information there through plgVmOnSelectPayment() and using the $_POST global.
As a fair warning. All this I've gotten through reverse engineering VirtueMart. So it's neither pictue perfect nor might it be best practice. But the VirtueMart documentation leave not many other options :(. So if someone have a better way, I'm very interested in knowing that as well!
I'm using opencart v.1.5.1 How do I add extra text area on opencart checkout page?
I've added Step 6 using photoshop, how do I code that on opencart?
I don't know about your programming background, but you need to be a little bit more than familiar with PHP, AJAX, JavaScript and of course MySQL, you should also know about the MVC architecture. If you think you have enough knowledge of those then here is what you need to do:
Create a controller class and name it lets say "remarks"
class ControllerCheckoutRemarks extends Controller {
public function index() {
// Your code
}
}
add the code you need to process the data, you can get some ideas by looking at "checkout/guest/shipping" controller class. What you need is quite similar to what that class does.
if you need to interact with the database in order to process the data then you need to create a Model class in the same route under the Model folder and write your functions in it. again you can get the idea from other model classes. But I don't think you need this, probably you want to add this information to your order, in order to do that you should modify the Order class, both Controller and the Model !
Finally you need to create a template file for it, once again open the template file for "checkout/guest/shipping" and see how they did it, then you create your own.
For the controller and model classes make sure you name them properly.
There is one more thing you need to do, The controller class for the step 5 sets the redirect to the next step which by default is the Confirmation. Change this line and make it redirect to your section and do the same thing for the new section and redirect it to Confirm:
url: 'index.php?route=checkout/shipping'
I can only guide you what to do, how to do it is your job :D If you are a programmer then I don't think you'll have any problem with it. if you're not i guess you'll need someone to do it for you :)
I would like to add a validation function to every form field on the Drupal registation page, including the custom Profile fields I've added.
Is there a simple way to do this without manually attaching it to each field? Would like it to support future profile fields that may be added without having to manually update the code.
Depending on the complexity of the validation, the Validation API module may be able to do what you need. Be aware that the module is no longer being actively maintained though.
Depending on your needs, the Clientside Validation module might also work, though the rules wouldn't be applied to users with Javascript disabled.
I'm assuming you're on D6.
You can kinda see what you need to validate here:
http://api.drupal.org/api/drupal/modules--profile--profile.module/function/profile_form_profile/6
If you implemented something with hook_elements you could validate anything the profile module creates. It shouldn't be too hard if you've got some good developer skills.
http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_elements/6
You can access the form with a hook_form_alter, and add one of more additional form validators.
Make sure you don't overwrite your default validator, but just add an extra one.
$form['#validate'][] = 'my_custom_validate';
This extra validate handler could loop over the profile fields and check for empty entries for example, or something else.