I want to add an icon near phone_no in phone field. It should have a jQuery click() action. It's necessary to create new module to install or I just have to add new hook to existing field (if hook - where to add it)? I found file /custom/modules/logic_hooks.php but when I changed it (added line):
$hook_array['after_ui_frame'][] = Array(12, 'Description', 'custom/modules/MyModule/mymodule.php','MyModule', 'showIcon');
Some pages fired strange popup (lots of \t\t\t\n\n\n etc). Could someone give me a tip how to do it properly? I'm totally new user of SugarCRM
after_ui_frame logic hook fire every page load. while you render studio the hook is fired and html is not properly render.
apply check for particular module so your hook code execute only for given module.
if(checkmodulename for you module){
//hook code here...
}
Ok, I found the solution. I can add a field or customize existing one by editing the detailviewdefs.php. I made new field and added onclick action in 'custom_code'.
Thank you for your effort, Rupesh.
Related
I created a custom plugin for my joomla extension, it all works well while trying to trigger it from a template override (just for test).
But when I try to fire it from the extension model (the same code that works in the override) it doesn't trigger the event.
Is there anything specific that needs to be done to the extension to be able to trigger it from the model?
here is what I am using and works in the template override but doesn't work in the model
JPluginHelper::importPlugin('bookingnotification');
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onHelloWorld', array());
I am clueless
I found the answer to own my question.
For some reason if I am triggering the event from a template override I can specify only the plugin folder in the importPlugin, like below
JPluginHelper::importPlugin('bookingnotification');
But if I am triggering it from the model it will only work (or at least in my case) if I specify the the group and the plugin folders, like below
JPluginHelper::importPlugin('user','bookingnotification');
I hope this helps some else
Having gained no response on the official Prestashop forum, I thought I would try turning to you guys, my first post. Thanks for reading.
I am building a site that sells personalized items, and it is essential that i can limit the characters entered into the customization fields for each item, a feature that is still sadly missing from Prestashop, so I am endeavoring to incorporate the feature myself.
Having tinkered about a bit, I have the front end working nicely, using maxlength to limit the characters allowed in the customization input field using a value read from the database in a new field 'max_chars' in the ps_customization_field (entering the values manually at the moment)
But now I have reached the limit of my knowledge and as much as i hunt around and tinker I cannot get the last bit done, so hopefully someone more knowledgeable than I can help.
Basically, when creating the customization fields in the back office, I need an extra input field that allows me to enter the max_chars for each customization, I then need this value to be written to the database in the max_chars field of ps_customization_field table.
TL:DR How do i create a new field in the back office product customization area and save the input to the db.
Kind regards,
Clive
Your question about "how to save input to my db" is too broad to be answered in a single answer. Look up how SQL queries and PDO work, as they may give you an idea on how to start.
Displaying your customization fields in the frontend can be done as following with Smarty:
{foreach $inputfields as $field}
<input type="{$field.type}" name="{$field.name}" maxlength="{$field.maxlength}">
{/foreach}
I think you should create a module for that. Simply make a module which add a tab to the admin product controller, and list all customized field created. Then, make a form with a simple id_customization => maxcharacter relationship.
The last thing you need is to create a hook in this module and add it in the product front controller where customizations are saved (inside initContent i think). This hook will do the validation and may cancel the process by throwing an error (a prestashop's error of course).
With that, you can add some extra validations for your fields, like a type validation, or anything else.
If you never made it, you should try this one : create a module
Here are some extra clues :
Hook for extra product tabs :
$this->registerHook('displayAdminProductsExtra')
Create the validation hook :
$this->registerHook('CFvalidation')
Handle it :
public function hookCFvalidation($param)
{
//Validate the customized values in the $_POST
//return formated errors if any or nothing if it's valid
}
Add it in the overrided product controller :
[...]
if (Tools::isSubmit('submitCustomizedDatas'))
{
$this->errors[] = Hook::exec('CFvalidation');
[...]
}
To display your inputs you need to override the method _displayLabelField in controllers/admin/AdminProdutsController.php.
To update the fields you need to override the method updateLabels in classes/Product.php.
I would like to be able to use multiple form field widgets for the same field and to be able to switch it based on session data from the user. But I am not really sure how to accomplish this. This is for Drupal 6. Any ideas on how to accomplish this?
You might be able to accomplish this with one of the field access modules but to do it properly you'd probably need to create a custom widget. Your widgets can return existing widgets by calling their handles, so your widget would more or less be a wrapper that returns the correct widget call.
this tutorial gives a pretty good overview of widget creation in Drupal 6.
What I ended up doing was creating a second form field that uses the filefield upload widget and loaded it on the form alongside the Flash widget. Then I put JS on the page that detects if Flash is on the page and is of the correct version. If it is found then it hides the html/AJAX uploader. If it is not then it hides the Flash uploader.
Follow up to Adding attributes to customer entity
My goal is to make new attribute appear on the registration form. I've added $oAttribute->setData('used_in_forms', array('customer_account_create', 'adminhtml_customer')); call which should add the new field. Point is to add new field without modifying register.phtml template directly. I will also need to hook into registration save method to handle ability to select custom answer e.g. 'Other'
Thanks in advance
the thing is that in the admin all defined customer fields are rendered automatically, but in the frontend they are added in the template (customer/form/register.phtml).
As you don't want to edit the phtml file, you could listen for example to controller_action_layout_load_before, check if the fullActionName is customer_account_create and then include a layout handle of your module which refers to a template file containing the field you want to add. See for more detailed code my last question.
Then you'll need another observer listening to Mage_Customer_AccountController's createPostAction method to process the field's value.
Hope That Helps
I'd like to develop a module as an event with registration form. An event is actually a page module with slight modification by adding some fields such registration form url. When the controller return a view, I'd like the controller to return a registration form widget along with the event info (article) and a google maps widget.
Imagine a widget class:
<?php
class Registration_Form_Widget extends Widget{
......
}
My question is:
Is it possible to create widget dynamically (I mean the creation of widget instance is dynamic (not the content) such using new Registration_Form_Widget and bypass the parameter such the registration form url that has been stored to the database?
So far, I never see an example that show how to create widget instance dynamically with automatic increment id
thanks...
Nope, widgets are created whenever you create em.
Although it is obviously possible to achieve it with a bit of code.
There is no "magic function" to do that automatically, but you can look into the widget module files to understand what is done when a user create a widget in the admin CP. And then you could reproduce the behaviour yourself.