It would be useful to have subtypes of products--e.g., apparel product type inherits tangible's methods, rather than having to repeat the code in the new module.

Attached is a draft implementation. Product type modules can register parent types through a new productapi $op, 'parent_ptypes'. When registered, parent types are called when a child content type's methods are called.

Implementation details:

* All productapi calls for a particular product type now go through product_invoke_productapi.
* product_invoke_productapi cycles through parent products, using different approaches depending on the expected data types (concatenating strings, merging arrays, etc.).
* a new function product_wizard_select_options helps conctruct nested select lists, similar to how taxonomy selects work.

Still to consider: how to display themed results when there is more than one type's info being displayed?

CommentFileSizeAuthor
#1 apparel.module669 bytesnedjo
product-subtypes.patch16.75 KBnedjo

Comments

nedjo’s picture

StatusFileSize
new669 bytes

Here's an example of what a 'child' product type module would look like, that can be used for testing. When you enable this module and have applied the above patch, apparel gets all the functionality of tangible ('shippable product'). Of course, the point would be to add something extra in apparel.module, which I haven't done in this example.

Eglish’s picture

Status: Needs review » Closed (duplicate)
nedjo’s picture

Status: Closed (duplicate) » Needs review

This is not a duplicate. This patch creates subtypes, not subproducts.

Eglish’s picture

Sorry nedjo, my mistake. How is the development of this patch coming along?

nedjo’s picture

No prob, the two ideas do look similar.

How is the development of this patch coming along?

Well, I don't think anyone has had the time to review it. I'll need to rework this once the 4.7 updates are done.

But any comments meantime welcome!

nedjo’s picture

Title: Product subtypes » Product subtypes--implementent inheritance in product types

I'm starting work on a 4.7 version of this patch.

nedjo’s picture

Title: Product subtypes--implementent inheritance in product types » Product subtypes--implement inheritance in product types
alynner’s picture

Category: feature » support

Hello

I've just installed this patch (http://drupal.org/files/issues/product-subtypes.patch) and am trying out the apparel.module provided, but I don't really understand it. I made the ability to add Apparel items but I don't see any parent objects or wizard select. How/where does the apparel_productapi() function get called to determine the $op?

I noticed that when I create a new product, I have the option to choose 'apparel product' under 'choose type of product to create' but I'm not sure the significance of this. Is that all it's supposed to do? I was hoping to make a select list myself with whatever items I wanted.

Perhaps I don't understand the purpose of the patch?

Sorry if I'm slightly ignorant here, it looks like a really good module/patch, I just need some assistance with it.

Cheers,
Alynner

fgm’s picture

Version: master » 4.6.x-1.x-dev
Component: product.module » apparel

Reclassified: uses the 4.6 API.

sime’s picture

Status: Needs review » Closed (won't fix)

I'd defer to gordon's plans to do something similar with the product type.