Hello,

I have problems with latest CVS version : CCK addresses are saved but are not displayed.
User addresses work OK.

I have traced display problem. It seems that #theme (line 2754 in includes/common.inc) is set to addresses_cck_formatter_addresses and that this theme function is not implemented.

I do not know enough in Drupal internals. I have added a theme_addresses_cck_formatter_addresses function in addresses_cck.inc and an entry for this function in addresses_cck_theme in address_cck.module.

It works now, but not elegant at all. Best should be to change the value of #theme, but I don't know how to do it, and it is late !

Please note that Fieldset modification (Alexis patch) does not work with CCK (form data is not saved). For CCK, I think it is better to use a CCK group if a fieldset is needed, and thus make fieldset display optional with this option set to false in case of CCK use.

Frederic

Comments

flebas’s picture

Hello,

I found the origin of display problem : in addresses_cck_field_formatter_info function (file addresses_cck.module), the first item in $formatters array should be 'default' instead of 'addresses'.

function addresses_cck_field_formatter_info() {
  $default = array(
    'arguments'       => array('element'),
    'multiple values' => CONTENT_HANDLE_CORE,
    'field types'     => array('addresses_cck'),
  );
  $formatters = array(
    'default' => array(
      'label'           => t('Default'),
      'arguments'       => array('element'),
      'multiple values' => CONTENT_HANDLE_CORE,
      'field types'     => array('addresses_cck'),
    ),

Frederic

SimonVlc’s picture

Hi there,

I have the same problem and was unnable to solve it modifying with that code Frederic.

Just to inform!

nokes’s picture

I made this change today, and it solved the problem. However, it's worth noting that I had to go to the content type's Display Fields tab and Save it again before I started seeing the changes in the nodes that I had already created. SimonVic...you may want to try that if you haven't already.

zoltán balogh’s picture

Code in #1 works fine. Thx.

phdhiren’s picture

Code on #1 work for me too, but after saving the display field tab settings again. thanks flebas.. :)

phdhiren’s picture

Status: Active » Reviewed & tested by the community
brmassa’s picture

Status: Reviewed & tested by the community » Fixed

Frederic and guys,

thanks for the patch. Commited. Soon on the next release.

regards,

massa

unitec’s picture

The patch does not work for to display address fields in views.

mcjudd’s picture

Hi Guys

The fix in #1 does not see to work for me. Have tried re-saving the content type (#3), but no luck??

Any ideas?

flebas’s picture

I have got Views to work. It seems that current code is incomplete. I think massa will udate it in a future release.

1) In function addresses_cck_theme, in addresses_cck.module, add entries for the fields you want to display in views :


function addresses_cck_theme() {
  return array(
    // Shows address in the default view: Multilines
    'addresses_cck_formatter_default' => array(
      'arguments' => array('element'),
      'file'      => 'addresses_cck.inc',
    ),
    // Shows address in only one line
    'addresses_cck_formatter_single_line' => array(
      'arguments' => array('element'),
      'file'      => 'addresses_cck.inc',
    ),
    // Shows address postal code
    'addresses_cck_formatter_addresses_field_postal_code' => array(
      'arguments' => array('element'),
      'file'      => 'addresses_cck.inc',
    ),
    // Shows address city
    'addresses_cck_formatter_addresses_field_city' => array(
      'arguments' => array('element'),
      'file'      => 'addresses_cck.inc',
    ),
    ...

2) in addresses_cck.inc, add the theme functions for each field :

function
theme_addresses_cck_formatter_addresses_field_postal_code($element) {
  return
$element['#node']->node_data_field_address_field_address_postal_code;
}

You need to disable then enable the addresses modules and to clear views cache for changes to take effect.

Frederic

flebas’s picture

To mcjudd : you have to disable the enable addresses modules in admin/modules.

mcjudd’s picture

Hi Flebas

That's works for me too now/

Thanks for your help

mcjudd’s picture

Hi Flebas

Just one other thing now that I have updated the address module the address fields now shows, but not the State / Province, phone, fax fields.

Have you got a solution for this one (or experienced this one)?

Thanks once again

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

AntiNSA’s picture

would be nice to have this in cck display only the city in a field, and then only one for the country, and then only one for the provence , on one line, which could be sorted by field.....

AntiNSA’s picture

I have the following :City:
Guangzhou
,
Province:
Guangdong

Country:
China

listed in one column, and its not sortable.... I need to have one field from each.... and sortable, and grouped by country let me know.... and why is there no field for continent?

Mark_Watson27’s picture

The alteration suggested by flebas worked for me, yet I see it hasn't been implemented in a release as yet, will this be rolled in to a general release?