Hi all, I discovered what seems to be a bug and I'm guessing its something to do with how CCK attribute is coded but I'm sure someone can clarify.

The issue is relatively simple (SCENARIO 1)
1. I have a content_type called person with one Auto complete text field called field_name.
2. I have a product type called "computer" which has the CCK Attribute "person" from above.
STATUS: THIS WORKS. FIELD_NAME CAN BE SEEN IN THE CART. THIS IS GOOD.

SCENARIO 2 however doesn't work:
1. I have a content_type called person with one Auto complete text field called field_name.
2. I have a product type called "computer" which has the CCK Attribute "person" from above.
3. I have another content_type called "person_details" which has the "field_name" (using the Existing field option in CCK)
STATUS: FIELD_NAME IS NOT SEEN IN THE CART. THIS IS NOT GOOD. HELP!

Looking forward to responses and perhaps an easy fix!

--Risharde
http://www.risharde.com

Comments

trungonly’s picture

I check now. Do you confirm the scenario 2: "person_details" is or is not a CCK Attribute type of "computer"?

planctus’s picture

I can confirm this.
I posted my problem in this issue:http://drupal.org/node/1048814 but right after i found out this issue and i checked.
The fields i'm not seeing in cart are those i've shared between two content type, actually.
We need to find out the problem, this is critical.
Thanks,
Da.

todd zebert’s picture

subscribe

trungonly’s picture

Status: Active » Fixed

Quick fix: Please replace the function uc_product_get_attributes_cck() by this one:

/**
 * Declares uc_product_get_attributes_cck() API.
 */
function uc_product_get_attributes_cck($nid) {
  static $attributes_cck;

  if (isset($attributes_cck[$nid]))  return $attributes_cck[$nid];          // cache is good

  $result = db_query("SELECT type FROM {uc_attribute_cck_node_types} WHERE nid = %d", $nid);

  $types = array();
  $content_fields = array();
  while ($row = &db_fetch_array($result)) {
    $types[] = $row['type'];
    $content_type = content_types($row['type']);
    $content_fields += $content_type['fields'];
  }
  $attributes_cck[$nid]['types'] = &$types;

  $attributes_cck[$nid]['fields'] = array();
  foreach ($content_fields as $field) {
    if (in_array($field['type_name'], $types)) {
      $attributes_cck[$nid]['fields'][$field['field_name']] = $field;
    }
  }

  return $attributes_cck[$nid];
}
planctus’s picture

Cool, i've just updated that function and it seems to work fine.
Thanks,
Da.

risharde’s picture

Thanks alot!!!! I updated to the new version released and it works!!!
Excellent response time as well!

todd zebert’s picture

Is this fixed included in 1.6?

trungonly’s picture

Fixed in 1.6.

Status: Fixed » Closed (fixed)

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