Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I can't seem to create an product class from an advertisement content type.
I get this:
This is a node type provided by another module. Only custom node types may become product classes.
Is there anyway around this
Comments
Comment #1
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedI modified this line in the following function.
What is the thought behind not making products out of node types created by other modules? Is it because there might be some custom code?
function uc_product_class_form_validate($form, &$form_state) {
if ($form['pcid']['#type'] == 'textfield') {
$type = node_get_types('type', $form_state['values']['pcid']);
if ($type) {
if ($type->module == 'uc_product') {
form_set_error('pcid', t('This product class already exists.'));
}
elseif ($type->custom == 0) {
// form_set_error('pcid', t('This is a node type provided by another module. Only custom\
node types may become product classes.'));
}
}
}
}
Comment #2
Island Usurper CreditAttribution: Island Usurper commentedRight. Once you make a node type a product class, it uses uc_product's node hooks instead of the module that created it. Advertisements, images, events, these all have special functionality in their modules, and turning them into products would break them.
Comment #3
Damien Tournoud CreditAttribution: Damien Tournoud commentedThe reasoning is sound, but this needs to be fixed in 3.x ;)
Comment #4
Stutzer CreditAttribution: Stutzer commentedSo have anyone found decision of this problem? I just bumped with the same issue — can not make my_module content type a product.
Comment #5
TR CreditAttribution: TR commentedMoving to the Ubercart 3.x issue queue. The current behavior will not be changed for Ubercart 2.x.
Comment #6
grasmash CreditAttribution: grasmash commentedSubscribe. This would be an excellent feature.
Comment #7
jwilson3Subscribe.
As soon as you export a custom Content Type to code (eg with the Feature module), it becomes a module's Content Type, and no longer is a candidate for Ubercart product classization. You get the error mentioned above.
Similarly, a custom content type that has been 'classized' into being an Ubercart-able product is no longer able to be exported to Features. Note that custom attached CCK fields *can* still be exported to Features. I'm talking about the content type definition that typically gets put in [feature_name].features.inc: [feature_name]_node_info().
Edit: Clarified the post with more details about features.
Comment #8
jwilson3Found a workaround for exporting the Content Type definitions to features.
I'm using the hook_enable() function inside [feature_name].install file to "build" the content type programmatically.
See sample code (part of the COD):
http://drupalcode.org/viewvc/drupal/contributions/modules/cod_support/co...
and related ticket:
#784404: Add date field to event content type and associate with signup.module
Comment #9
ezra-g CreditAttribution: ezra-g commentedI marked #1017692: Allow content types not owned by uc_product to be products as a duplicate of this issue.
Comment #10
noahlively CreditAttribution: noahlively commentedCheck out this Drupal 7 implementation of the uc_donation module:
This allows donation nodes to function as products. Does this answer the question?
Comment #11
longwaveMarked #1449944: How to make 'Book' content type as Product? as duplicate
Comment #12
giorgio79 CreditAttribution: giorgio79 commented#298890: Ubercart: "Product classes" or "Product types"? was also marked as duplicate
webchick summed it up perfectly
This could work very well given content types are also entities in D7.
Comment #13
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedcan I make any entity a product using ubercart for drupal 7?
Comment #14
Alan D. CreditAttribution: Alan D. commentedWhat are the functional differences between a "product class" node entity type and the default product content type?
A great abstraction out would allow multiple classes to be assigned, and the single uniting class being the product class that defines that a content type can have a price, id, etc (and enforced I guess). Another class would be a attributed product (for lack of a better name) that allows a type to have assigned attributes, ...