When e-commerce won't create products ...

Submitted by Frederic Marand on

I was working on an existing site today, and after installing the e-commerce 3.4 suite (EC), noticed something was very weird: product type modules were enabled, all basic EC modules were there too, and yet, when I created products by hand, the "Anonymous purchase" fieldset appeared, but nothing else from EC.

Worse, when saving the new products, they were properly created in the {node} table, but never appeared in the {ec_product} table, which caused them never to appear as products in the admin products list of the product view available to users. What could be going on ?

The insight came from noticing that the product submission form did not contain the usual product-related elements, like SKU or unit price. Debugging node_form, which is used to actually implement the product_node_form form_id, showed that the "extra" information generated by $extra = node_invoke($node, 'form', $form_values) did not contain the "product" row, as it should have, meaning node_content_form was being invoked to created the form instead of product_form.

Which in turn gave the answer: the "product" content type had been admin-defined previously (at admin/content/types), and was overloading the "product" type from EC. Moving the existing to content to another type and deleting that type solved the problem: after deleting the custom "product" type (which could be identified by the presence of a "delete" link next to it), the EC "product" type appeared, this time unmasked.

So, lesson to learn: before installing a node module like EC to an existing site, make sure its types do not bear the same name as existing types elsewhere on the site. The problem has little chance of occurring in 4.7, but with the inclusion of admin-level defined content types since D5, it is poised to appear more frequently nowadays.