Adding a CustomField to Infusuionsoft contact - php

I am trying to modify an existing integration with Infusionsoft that uses the Novak Infusionsoft PHP SDK.
The config.php file has a few custom fields defined in config.php like
//To Add Custom Fields, use the addCustomField method like below.
//Infusionsoft_Contact::addCustomField('_LeadScore');
Infusionsoft_Contact::addCustomField('_FooBar');
Infusionsoft_Contact::addCustomField('_BarFoo');
and that all works. I want to add another custom field for a text field named "Best Describes Me" in Infusionsoft and added what I thought would be the appropriate line
Infusionsoft_Contact::addCustomField('_BestDescribesMe');
But putting that line in gets an error:
[NoFieldFound]No field found: Contact._BestDescribesMe Attempted: 1 time(s).
I have been searching to see if there is anything else to be done either in the PHP toolkit or in Infusionsoft, but cannot find anything. I would actually expect that I have to do something in Infusionsoft to make the custom field externally available, but cannot find anything about that.
Any help would be greatly appreciated.

I fid find the solution. The actual field name in Infusionsoft may not be the same as what is displayed. You have to dig into the Backend Database Names for Custom Fields as described on this page:
http://help.infusionsoft.com/related-articles/backend-database-names-for-custom-fields
Go to Admin > Settings in the main navigation menu
Go to the custom field section, select a field type from the drop-down, and then click on Go.
Click on the View the field database names (for the API ) link.
The database field names will be listed in a new window.
The backend name is what needs to be put into the SDK config.php

Related

Moodle custom fields API for course page

Unfortunately I can't quite follow how the custom field API works. What I actually want are additional fields for the custom course format such as address, directions and other (hybrid courses). And no, I don't want to use the web interface for this.
As I understand it, two files are needed, myFormatPlugin/classes/customfields/course_handler.php
and
myFormatPlugin/customfield.php
Do I need to register the customfield.php file somewhere or does it work via autoload?
Do I need to create a separate database table for this?
What am I missing?
Could someone make an example for just one field? I don't find the github links in the documentation helpful either.
Hope you want to add some custom fields for your custom course format. To add custom fields for the format plugin you don't want to use the custom field API.
The course format plugin contains options to add your custom fields using the function course_format_options in your course/format/PLUGINNAME/lib.php.
Moodle will automatically store these custom course format options in the database table course_format_options.
Please have look at the designer course format plugin.
https://github.com/bdecentgmbh/moodle-format_designer/blob/master/lib.php#L241

Wordpress - Hide specific fields to certain user role on back end

Is there a way in which I can disable/hide specific fields from the "page form" in the back-end? I have currently test two plugins but none of them meet the requirement that I have, like for example this plugin "User Role Editor by Members – Best User, Role and Capability Management Plugin for WordPress":
I'm sorry that the options are in spanish but the capabilities options are for example: "edit pages", "edit other people's pages", "publish pages", "delete pages"... What I want is to hide certain sections to the "editor" user role from the page form:
Is this even possible?, and if not, what alternatives do I have?, the thing is that I'm afraid that whoever is in charge of editing will end up messing up with the pages...
Use Adminimize plugin It will resolve problem easily.
This plugin changes the administration back-end and gives you the power to assign rights on certain parts.
In most cases, the plugin "Adminimize" that Tech Sourav mentioned will work just fine, but since this page I'm working with is using some annoying custom content editor and other theme tools, the workaround that I ended up doing was:
Create a custom post type with the "Custom Post Type UI" plugin.
In this case I will only and always have 3 pages that have this "modifiable" price field, so once the custom post type is added I added 3 entries to this custom post type (here I will show you just one).
I'm also using the "advanced custom fields pro" plugin in order to create this price field into my entries.
When the custom field has been created there's this option inside the same previous form that allows me to show that specific field just created into specific post types entries, so I made up the rules in order to show this field in the created custom post type entries:
In this example I'm just showing you the rule for one entry, in order to make it appear on the other 2 entries, I would just click in the "agregar grupo de reglas" and select one by one.
Once this custom field and rules are configured correctly, I should see now the custom field "precio" inside my specified entries form:
After saving the entry with the updated custom field value, I will now check the post id and save it for later (we're going to need it):
According to the documentation of Advanced Custom Fields plugin I can show the saved value of certain input within certain post with the shortcode: [acf field="{$field_name}" post_id="{$post_id}"], in this case I will change the values to: [acf field="precio" post_id="1372"] and paste the code into the section of the page that I will show this:
The builder that this page is using has an element called "code block" but you can use it in the equivalent element that allows you to paste code from your theme.
After saving the changes, now the only thing that I have left is to restrict the ability to edit pages to a user with the "editor" role, for this I will use the plugin that I mentioned before in my question called "User Role Editor by Members – Best User, Role and Capability Management Plugin for WordPress":
As you can see, I will not let editor users to mess up with the pages post types, so with this, they will only be able to edit the custom post type that I created, which even if they write something inside the content of that custom post type entry, the website won't be affected at all. This may be a little bit hacky but it works...

Display custom field tabs in front end article edit page in Joomla 3.x

I have been looking for a solution to display custom field tabs in the Joomla
front article edit page.
http://www.aixeena.org/extensions/aixeena-easy-cck
Aixeena Easy CCK
I installed the plugin of aixeena, two custom field tabs: the Extra content and Extra content 2 are displayed in the backend admin article edit page, which is great. But we also need to let regular edit their article and enter values in custom fields under those two tabs. Any idea how to achieve this?
I tried a couple of other sites posting the solution of adding custom fields in article, such as Rating region described in the site:
https://docs.joomla.org/Adding_custom_fields_to_the_article_component
I was not able to make the Rating tab displayed in the front end article edit page neither.
I tried the fieldattach, it does supports custom field tab ( which is the group name of custom field), the list field type only contains static values, we have to define fieldset and field type through xml file.
Any help is greatly appreciated.
I just finished writing a couple pluginsto do this similar thing. I wrote my own plugin to add the extra fields - but it looks like the one you've already used is very similar.
I had a really hard time figuring out how to add the fields for frontend editing as well. But I finally figured it out.
First, you're going to need to copy the com_content form edit.php into a template override (/templates/your_template_name/html/com_content/form/edit.php).
In that file, add the extra fields you have. You'll need the name of the field that you put in the xml file for your plugin you already have. Add them right before/after the fields that are already in the file, that you want your fields to appear before/after. Example:
<!-- CUSTOM begin custom fields -->
<?php echo $this->form->renderField('video_url', 'attribs'); ?>
add all your fields in there - replacing 'video_url' with your own field name. The plugin you already have already saved these fields to the 'attribs' part of the article, so you can leave that there.
The plugin that I used to create the fields for the backend is a really simple one based off of this tutorial https://zunostudios.com/blog/development/203-how-to-add-custom-fields-to-articles-in-joomla
What I'd suggest is to go ahead and create that plugin too. Except in the zfields.php file, change "$app->isAdmin()" to "$app->isSite()" - make sure the xml files have the same names as your other plugin xml files, so they save to the same place, and you're done. The fields will show up on the frontend edit form now.
What I'd really recommend is to get rid of the Aixeena plugin, and just make that easy plugin using the tutorial above - it's super easy. When you make it, duplicate the "if ($app->isAdmin())" section, copy it right below it, and change "isAdmin" to "isSite" - and now you've got the entire thing, all your custom fields, both frontend and backend, all in one place. Now just do the edit.php template override, and you'll have them displayed in both the front and backend. I hope that helps - if you need I can upload more example code.

Add custom field to Magento Admin (URL field)

I'm trying to add a custom field in the Magento backend, at the Configuration -> Web section. I want to add an additional URL text space (can be in any of the sections, URL options, for example, would work well). How can I do that? I have seen other people who tried it by making a custom module, but that was for the category section. I need it at the Web section though, have not had success yet.
Thank you!
You can add an custom field to the web section. The best approach is to create a custom module for this.
In your system.xml you need to add your section to the Web section.
More information on this blog.
If you want to add attribute for product (can be text string named URL text) you can do it in catalog/attributes/manage attributes here you can create a new EAV attribute.
Next go to catalog/attributes/ manage groups/ and there you can drag/drop attribute to the correct group (will be shown in product admin page in the left list of groups)
In template you can call a attribute by call $_product->getAtributteName (if the attribute was named atributte_name) or $_product->getAnotherAttributeName (for attribute named another_attribute_name).
Always make sure if attribute is enabled for catalog / or product view you are using to make possible "get..." call from that view.
If you want it for using at URL, you can edit URL call by adding it to the end of URL as a GET parameter example:
http://www.somestore.com/?yourproductorcategoryurl&myparmforurl=<?php echo $_product->getSomeAtributteName ?>
if you using attribute type list (list of defined values, it always return an id of attribute value, not name) then you can use $_product->getAttributeText('name_of_your_attribute')
I was able to do this via the official Magento blog: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_add_a_custom_module_for_custom_admin_config_options
Thank you for your help though!

Prestashop - How to add a custom input field to product customization and write to db

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.

Categories