0

I am dealing with a product that is totally dynamic in nature and am using a completely custom controller/page to handle things.

There are a bunch of various custom entities I've built to handle the various business models that handle product logic. On my custom page, I assemble all these options into a form that allow a user to add this unique configuration to the cart.

Seeing as each customer's combination of values is likely to be rare (with millions of possible combinations), it is not practical to create a new catalog product each time someone adds to cart. Additionally, the product's image will be unique for each item, which makes it problematic to have one "generic" instance of my product in the catalog and use that every time it's added to cart.

I've thought a lot about various product types in Magento, and am not really seeing a good fit. Each composite type of product (bundle, configurable, etc) will require many customizations to make it work, so I've been developing based on Simple Products (I add all configured options as additional_options and set the price in observer during add-to-cart), but I can't help but think this is a good candidate for a custom product type (even if there is only one product in that list).

Given a product type that needs to be configured with a various amount of dimensions, colors, styles, etc, how would you handle this at the product model level?

(I have tried to be clear while at the same time honoring my client's NDA, if my question comes off as too generic, I am happy to clarify).

edit --- For reference, imagine a web site that sells model doll house bits. Each of those bits is it's own product for sale (ie. 4 pack of little model trees, little itty bitty wallpaper, etc) but there is also a feature where a user can build a completely custom doll house, including custom dimensions for the number of floors, area in each room, etc. What product type would you make the "build a custom dollhouse?"

2
  • It is very hard to work out where your true problems are here. But if you cant find a base product type thats sutible, and your not really making use of any core logic other than the cart, perhaps you should consider that Magento might not be the right platform for your project? Apr 29, 2015 at 23:02
  • If Magento is not the right platform, then none is and everything would need to be a completely custom application. I think it's a better option to use Magento and customize the bits you need rather than building a custom application that works how I want while also having to build everything else Magento provides.
    – pspahn
    Apr 29, 2015 at 23:11

2 Answers 2

1

I like to think about scenarios like this one backwards. Forget about the product itself for a moment. What is the desired outcome in the cart? And when the cart is converted into an order, how would the order hold the custom product information?

The simplest (and built-in) solution is to use custom options on the sales quote and order items, similar to how the simple product type's custom options work. How you structure your options is up to you, but you can store whatever you want in them because they're serialized (see serialize()) - dimensions, colors, styles, anything.

So, moving backwards, how do you represent the product itself? Create a custom product type to house any custom functionality you might need. The custom functionality should add the custom options that the customer configures to the sales quote items, similar to how simple products do their custom options.

You'll need to create at least 1 actual product of this product type. Depending on your configuration scenarios, you may want to create more (e.g. if you're customizing doll houses, you may have different "styles" of doll houses, each "style" being a different instance of the custom product type). Give this product a URL that makes sense (e.g. doll-house-configurator.html).

Once you have the product, you need to give it custom templates. Using Magento's layout XML, you can set up all of your custom templates. For example, to update the product view page, use a layout update handle like PRODUCT_TYPE_doll_house, similar to PRODUCT_TYPE_simple and PRODUCT_TYPE_configurable (see catalog.xml for further examples).

Note that you may not need custom templates for everything. For example, maybe it's perfectly fine to display your product as a thumbnail using the standard product list template. However, if your product generates custom images (perhaps based on the options that the user has selected), you'll want to override all of the "configured item" templates (account order history section, order emails, cart page, checkout page, and so on) to display the custom images.

That's really it. Easier said than done, but that's the general idea of how you would create a completely custom product in Magento. The actual customization portion is up to you, but this should give you a good idea of how to represent your product within Magento.

1

I've also thought about this and have come of the opinion to use the composite product type that fits best, if you factor out all dynamic options. Dynamic options (aka range options or calculated options) can be handled by this extension.

In short:

  • configurable products are an alternative way to select one stock mutation, with pre-configured values. This means every combination of the options is known when the product is created and corresponds to one actual product.
  • bundle products are an alternative way to build a whole out of parts that can work together. In this case every option corresponds to one stock mutation and the possibilities of all options are known when the product is created. In contrast to configurable, a bundle product has a base component that is always selected and separates one bundle from the next. For example for a custom build computer, the motherboard would be the best fit as the base computer. Typically the items corresponding to the product options are not sold separately or at a different price with different packaging.
  • grouped products are sets of products that do just as well and have the same price and packaging when sold separately and results in multiple stock mutations.

All of these result in predictable stock mutations. Custom options are provided typically for services (warranty, installation), packaging (birthday wrapping paper) or related products (Do you want fries with that?).

None of these result in something that is tailor made and where stock mutations are none of Magento's concern, because they affect source materials not sold in the shop. A price is then calculated based on specifications of the customer (which are custom options) and the cost of the amount of material used, overhead and profit. This is something outside of the scope of core Magento and earlier mentioned extension is an example of how one can implement it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.