Collections provide an option to select columns to be display within the table view of collection.
We are extending most content-types with two fields using archetypes.schemaextender: teaser image and teaser text.
Is there a sane way to extend the list of available table columns?
Is there a way to display the teaser text and teaser image inside the table view of the collection with out further customization? Is the logic of the table view flexible enough in order to support a schema extension?
In the control panel -> collections ( typically /portal_atct/atct_manageTopicIndex) you can define every metadata you need. Collections depends on portal_catalog metadata and indexes, so you've to add your custom fields there. Use GenericSetup in your module profile to tell ZCatalog to create the new indexes, or create them by hand. In the former case, beware that reinstalling the module could wipe out the new created indexes ( http://maurits.vanrees.org/weblog/archive/2009/12/catalog ).
You might want to take a look at collective.formcriteria. I haven't polished it nearly enough and installing it can get you in some uninstall trouble so don't install it without first backing everything up. That said, it gives you more than enough rope to do what you want using column expressions. Of course this is also more than enough rope to hang yourself with.
Related
In previous versions, there was InventTable and InventTableModule(there were more but they often could be ignored), so copying an an item was easy with buf2buf and replacing itemId.
In ax2012 there are dozens of Eco* tables all over the place so copying them all would is much more error prone (easier to forget something).
What's proper way to copy an item with all its attributes values? Manual copy of tables? Axd classes? Ax classes? Some other mechanism?
As far as I know there aren't any classes available that allow you to copy an item out of the box so you'll have to write your own code to copy all the data.
I agree the new table structure makes it a bit cumbersome but you could start with the code as explained in this blog post
Basically the class allows you to
Copy product attributes and categories
Delete product attributes
Get product attributes
Set product attributes
Needless to say you will have to review the code to see if it meets all your requirements, but it could be a good starting point
I am creating a module to alter the output of Drupal 7 text list fields.
I know that I can use hook_form_alter to do this, the problem is that the text field is output in different forms in different places and at different depths in the array structure.
In one case it may be at -
$form['elements']['some_array_key']['fields']['my_text_list_field'];
In other cases it may be at -
$form['fields']['some_array_key'][0]['my_text_list_field'];
How can I reliably locate and alter ['my_text_list_field'] in Drupal's form array, regardless of structure of the array it is contained within?
drupal_array_nested_key_exists almost does it, but not quite, since it requires that I know the parents of the element I am looking for.
For your use case, i suggest you try creating a field widget.
Tutorial 1a
also example modules for developers contains excellent code (with documentation) which you can modify to suit your need. You would have to look at field_example module.
In many cases you may want to even provide a display formatter along with your field widget, so if you want to alter the output of a field without any prior knowledge of how and where its going to be used, then you need to create a custom field formatter.
Tutorial 2a
Tutorial 2b
I would like to create a data entry form in Drupal 7 that is similar to Filemaker's List View. List View is a view that contains many records on a page. When Submit button is clicked, data entered in the fields will be assigned to the individual records.
For example, I have a list of students' names and a column field of grade type. The student's name will be created from Drupal View's filtering, but the grade field will be empty waiting for me to key in.
What is the proper Drupal's module that can enable this functionality? Or what can I do to create this functionality.
This approach is closer to your original request, im testing this out now and I think it should more than do the trick, much more interestingly too.
http://drupal.org/project/slickgrid
Edit:
I highly recommend trying this its awesome!!
A couple quick tips
Be sure to also install http://drupal.org/project/title so you can reset the title (make it a field), Basically with this editor you can only edit actual fields, so same goes for location module, you'll need to use the field option rather than node option.
One possible downer, at least for my site, it appears the drupal module does not support jquery 1.7 which my site uses, so a few buttons etc don't work as expected, also the drupal module does not support the latest slickgrid release either. I'd like to look into fixing that but I dont have the time just yet, possibly someone will before long. If jquery 1.7 is not required for your site then none of that will be a problem for you.
I just figured how to do something similar, although I went about it a different way then I think would be the most desirable, at any rate what I did works perfectly for me at the moment.
What I did...
Used a google docs spreadsheet for data entry, exported a CSV file, then used Feeds module to Import and Map it to my desired content type. I was even able to get location, taxonomy & image fields to map.
Modules & Stuff Used...
Feeds http://drupal.org/project/feeds which also includes Feeds
Importer, you'll want to read through all the instructions to be sure
you understand the import methodology, I could never explain it all
here!
Feeds Tamper http://drupal.org/project/feeds_tamper , I used this to
explode the cell which had a | separated | list of taxonomy terms (dont use comma), the
nice side effect is if the term doesn't exist it creates it for you!
Spreadsheet - Personally I created a Google Docs Spreadsheet, any type
will do. This spreadsheet has every field you want to map to fields
in your content type.
"More Better"
Currently I am on the hunt for a simple backend UI way to do this, but this is what I've settled on for now. I just couldn't imagine hand entering hundreds of nodes, page submit after page submit! I will post back if I figure another way to do it. Good luck!
I have just started with
https://www.drupal.org/project/editableviews
which enables the creation of views where all the fields are editable, including when no data exists in the related entity. At the first url is also documentation.
There a screencast which shows more
https://www.youtube.com/watch?v=g_D4z4Bw6iw
I am working with the commerce module to create an online store. I am modifying the products .install file to create a content type (as I have been told this is required) and as part of that content type, I need to create lots of fields. The list will be around 50-60 different pieces of information.
Ideally I would like to store these in a single table with the productID at the beginning and all the other information along, but this doesn't seem to be the case; all the fields are stored in different tables.
I noticed that the "Address" module that is also used with commerce creates a field-type that has about 15 different values all stored in the same box. How is this possible? I noticed that if I set the cardinality up to 5 for example, it creates different rows. I just want a table with the following:
ID - value1 - value2 - value3 etc etc.
I also don't need any modules/extensions as this all needs to be written in the files. I also don't think that changing to the mongoDB ( I think ) is an option, so what are my options in this situation?
That's not how the Drupal field system works I'm afraid, one field == one table (well actually 2 tables if you include the revision table for each field).
The Address module uses hook_field_schema() to define several columns for that particular field (have a look in address.install and you'll see what I mean).
So if you want to put everything in one table you'll simply have to define your own field type (see the examples module, specifically field_example for help with that).
Bear in mind though that the number of columns you define in hook_field_schema() will be static once the module is installed, and the only way you're going to be able to increase/decrease it is with an _update hook for your custom module.
Also, if you're hacking at files that are included in the Commerce module...stop!: Commerce is still very much in it's infancy and you will likely have to update it soon...once you've done that your code changes will be gone and there's a good chance your site will be in an inconsistent state.
The whole point to Drupal is that everything is hooked/farmed out so that it can be altered by other parts of the system. There's nothing you can change in product.install that can't be done by implementing a Drupal hook in another module.
If you're unsure, post another question detailing what you're trying to accomplish by directly editing a contrib module file and one of the Drupal gurus on SO will point you in the right direction :-)
EDIT
Just to say I've been working with Ubercart in Drupal 7 for quite some time now and find it a very, very good solution (a lot of Commerce contributed modules are still in dev/alpha/beta; this is less so for Ubercart contributed modules). It might be worth a look.
Some more info
I think you've basically got two options here but either way you'll need to create a custom module (excellent set of instructions here).
Option 1: Create a custom field
If you're a Drupal coding beginner I'd suggest this is probably the easiest way to accomplish what you want, but it's still not totally straight forward. Grab the field_example module from the Drupal Examples module link above and have a look in the .install file, specifically the field_example_field_schema() function. That defines the columns that will be in the table for that field. Then have a look in field_example.module...pretty much every function that's commented with Implements hook_x is one that you're going to want to copy into your module and tweak for your own needs.
I think this will be easier because Drupal will handle the table/form field creation for you
so you don't have to mess with the database, schema or form APIs.
Option 2: Create a custom module
This option involves implementing your own table (like you suggest in your comment) where the primary key would be the entity ID of the product and would also contain all of your custom columns. (See the Schema API documentation for help with this).
Then you'd implement hook_form_alter() to add the form fields necessary for a user to input the data, and then implement hook_node_insert() and hook_node_update() to persist this data to your database table. It's quite hard to go into any more detail without actually writing code and it's quite a bit of code!
Hope that helps, sorry I can't be any more specific but it's not easy without knowing all the ins and outs of the situation
Is there a way to add one CCK field which consists of two separate fields, e.g. Author(s), having first name and last name on separate fields?
Thanks for any help!
Show answer: not easily.
Long answer: yes, but with a bit of php trickery.
Look at this doc here, specifically, the lower "join" part will get you on the right track, but its specifically for 5.x. If you are working on 7.x this would be quite a bit different.
You can use CCK 3.x for Drupal 6, which contains a sub-module called Multigroup, which allows you to take groups of fields (first name, last name for example), and repeat those groupings. However, before using this version of the module, note that it does not have an officially supported release, and its future is a bit uncertain.
In addition to other suggestions, you could try Flexifield, or just have two different fields.
To make two fields end up looking like one...
display them together later on using inline fields or by altering the template
use Actions to join the two values together and save them to a different field, or
use Computed Field to write them to another field on node save
Content Multigroup in CCK3 currently has no upgrade path to Drupal 7 and its interface is a bit clunky if you aren't planning on having a multi-value, multipart field.