Add custom field to Magento Admin (URL field) - php

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!

Related

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...

How can i add custom fields in shopify add product page?

i am making a shopify store and want to add custom html and image upload when adding new product, something like this image
as far as i know you cannot add custom html by any metfields plugins( correct me if i am wrong ). do you know any way to do it ?
Hello there you don't need any app for this you can use the Shopify UI Elements Generator tool to easily generate the HTML and Liquid code for each form field that you want to add to your cart page. This tool was created by Shopify to help simplify the process of adding custom user interface elements, such as form fields and icons, to Shopify themes.
Product metafields can also be managed from the Shopify adminpanel directly. You don't need a third-party app or chrome extension anymore!
From the adminpage, go to settings (bottomleft corner) and go to Metafields. From there, you can add the metafields to the product and set the desired contenttype (inputfield, image upload, checkbox, etcetera)
You will need to provide a namespace and key, which you can refer to from the code template. For instance:
setting the "namespace and key" field to my_custom_fields.somefield, you will be able to access it from the product template file (product.liquid) like so:
{{ product.metafields.my_custom_fields.somefield }} or, of course, assign it like so: {% assign myField = product.metafields.my_custom_fields.somefield %}
The created metafields will appear on the product editpage at the bottom. No chrome extensions needed!!
You can add custom HTML fields using the Metafield Manager or SuperFields app.
You just click the More Actions dropdown and that's where you can add your content.

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.

Wordpress - display media on page

A client wants a full page full of PDFs, and an option to be able to assign a PDF to a page automatically.
For example, conveyancing.pdf would appear on downloads.php (along with several others), but also have an option to tick 'yes I want this PDF to also feature on the conveyancing page'. Is this possible, and if so how would you approach it?
If I made a custom post type for the pdfs, is there an option to list all the pages it can appear on, like you'd tick categories but this would be 'pages'?
"a full page full of PDFs"?
Do you mean a page with links to multiple PDFs on the server?
Chrome / firefox and maybe IE have a built in PDF viewer and there is an option to save, download or print.
How to Upload & Link to a PDF file in WordPress
if i get you right, you want to upload pdf files from the admin panel and attach them to pages.
since you didn't specify what you already done, i will start from the beginning.
I've done this before on some project, i needed to let a client upload documents to post type page and custom post types. you can create a new custom fields on your code if you like too but i think if you'r out of time, you can installed for example the WCK plugin because besides of options like create new custom post types or taxonomy easily, it also let you create custom fields with repeater (which is not freely in every other good custom field creator plugin).
create with the plugin a new meta box and then the document field (you will need to do it for each post type). after that, you will see the new custom field on the post type you've been chosen, upload a document for the test and on you theme code call to get the field, check this link to get the detailed instructions.
after it will work for you you will want to add an option to attach some documents to other page by some checkbox right? you can create another custom field (checkbox) under the same meta box so it will Appear with every document field and then get the value on the code theme to check if it checked or not, that way you can control what documents will appear in the template you want to get by the checked checkbox of document ("show this document in other templates").
the problem with this should be how to get the id's of the pages who have the selected checkbox to the current page, i didn't try it but maybe you call all the pages with WP_Query and in the array use the specific post type you like and the custom field parameter to get only the pages with the check box, after that you can run a foreach on the array and use a condition to check for the value of each page checkbox, if it true get the custom field (document) and in the place to insert the post id use the id of the post in the foreach so it need to bring you the specific document. i would love to hear if it worked for you, good luck!

magento custom form on product page

I'm new to Magento, and i need some conceptual guide and/or references.
I need to create custom form that will be a part of product-info page (at it's bottom) and that will collect user input (email, size, color). Only some product will have this feature/form (it's up to admin). So, goal of this form will be to email store-admin about a product that is available in stock but not in wished size and/or color. Should i customize existing Contact us form or should i create fresh custom form in new module?
Form should submit data to admin via email along with name of the product.
Ok, so first create a .phtml file under app/design/frontend/[namespace]/[theme]/template/catalog/product/send_request.phtml
then, add this .phtml file reference in catalog.xml in /app/design/frontend/[namespace]/[theme]/layout/catalog.xml
<block type="core/template" name="customer_request" template="catalog/product/send_request.phtml"/>
below the :
<label>Catalog Product View (Any)</label>
section but you should find to right section where to place ( you will find after a few try )
Finally, add your php logic into send_request.phtml file. The form contain that you implemented in send_request.phtml will available under product view page.
Sounds like you'll need a custom form. You'll need a new database table to store the data, a Model to represent the data, and a controller to post the form to at the very least. You'll probably want to add an attribute to Products which is a yes/no of whether to display the form. You'll also probably want to view the data, so you'll have to make pages in the admin site. Perhaps a grid of all answers and a page to view/edit a specific answer.
There is a free extension available. You can use this extension and customize it according to your needs. Product Questions

Categories