There are several problems with product classes in order for them to be usable. On the store administrative page is listed Manage Classes (admin/store or click on Store in the admin menu). The description says "Create and edit product node types." When clicking on this link there is a list of product classes which have links for editing. But no where is there anything to create a product class. It is possible to create a product class by creating a new content type. In the vertical tabs is listed Ubercart product settings and there is a checkbox "Content type is product." It took me a long time to find this and if this is how product classes are intended to be created it is safe to say they will almost never be used. It is also possible to create a product class programmatically but that is not something most users would be able to do. So Manage classes should provide a simple way to create a product class. I thought about just providing a link to the NodeTypeForm but the default settings will not create a product class. Even if I could figure out a way to use the form with the checkbox enabled I think it is still way too complex. So I created a simplified form with the name, machine name and description. This allows product classes to be created quickly and they can always edit it once it is created to add additional functionality. But there is room for some other thoughts on the best way to add a product class.
A patch will be included in the next comment.
Comment | File | Size | Author |
---|---|---|---|
#6 | 2763535-6-product-class-add.patch | 7.56 KB | TR |
#4 | Screenshot from 2016-07-10 11-21-56.png | 65.05 KB | trobey |
#4 | Screenshot from 2016-07-10 11-21-24.png | 83.71 KB | trobey |
#4 | Screenshot from 2016-07-10 11-16-13.png | 75.71 KB | trobey |
#4 | Screenshot from 2016-07-10 11-14-23.png | 97.67 KB | trobey |
Comments
Comment #2
trobey CreditAttribution: trobey as a volunteer commentedComment #3
TR CreditAttribution: TR commentedComment #4
trobey CreditAttribution: trobey as a volunteer commentedThe first screenshot shows the Ubercart menu in Drupal 7. The Manage classes item has the description "Create and edit product node types." Clicking on this link we get the second screenshot. This page lists the product classes and then has an Add a class form. The form has fields for class ID, class name and description.
The third screenshot shows the Ubercart menu in Drupal 8. The Manage class item is identical to the one for Drupal 7. Clicking on this link we get the fourth screenshot. This page has a listing of the product classes but there is not place to create a product class. This conflicts with the description in the link.
After applying the patch the web page looks like the fifth screenshot. Now there is a link provided to Add a new product class. Clicking on the link takes us to the sixth screenshot. Here we see a field for product class name and description (the machine name is automatically added to the form).
The patch provides the missing functionality that existed for Ubercart in Drupal 7. The only difference is that the form is on a separate page then the listing. This seems consistent with the way Drupal 8 does things. As can be seen there is no new functionality provided by this patch; it merely provides the same functionality that Ubercart had for Drupal 7.
Comment #5
TR CreditAttribution: TR commentedI agree, this is a big improvement. Thanks for the patch!
I would like a functional test for the new form before I commit this.
There are a bunch of other things that could be done to improve the user experience here:
Comment #6
TR CreditAttribution: TR commentedThis patch modifies the patch from #2 to use short array syntax (the current Drupal coding standard) and uses $this->t() instead of t(). I also added a line to the submitForm() function to save the description text, as it wasn't being saved.
I also added the table of existing classes to the bottom of the "Add a product class" page, so it looks more like D7 and because I find having the list of existing classes useful when I'm creating a new class.
I added some Javascript to do the tab summaries (item 3 above) and to append text to the content type description (item 2 above).
No tests yet, and no progress yet on items 1 and 4 above - just posting this for the testbot to tell me if I made any mistakes so far.
Comment #7
TR CreditAttribution: TR commentedPerhaps we could go even further and eliminate the specialized product class forms, instead do everything from the normal content type administration pages? The "Add a new product class" action could be added to the top of the content types page, and the store admin menu "Manage product classes" could take the user directly to the content types page.
See also #404416: Add a simple form to /admin/store/products/classes to add a class
Comment #8
starlightE CreditAttribution: starlightE as a volunteer commentedIn D8.4. 4, Ubercart 8.x-4.0-alpha5
An Ubercart Product Class is created by adding a New Content type made from admin/structure/types/"add content"
and setting the new content type to be an ubercart "product". This new content type then shows up
in the ubercart/manage classes page. It took a while to discover that.
In ubercart/manage classes page the CLASS ID column shows the MACHINE ID that is found in admin/structure/content types edit page
in ubercart/manage classes, clicking the EDIT button in the "Operations" column takes the user to admin/structure/types/manage/xyz product
The use of different terminology CLASS vs Content Type is confusing. So is CLASS ID vs MACHINE ID ..
IMHO the Ubercart Class should be renamed from "Manage Classes" to "Manage Product Content Types" with a hover title reference to content types and CLASS ID should be renamed MACHINE ID, with a hover description "As shown in the Structure/Types page"and "Operations" should be renamed "Content", then users would quickly derive associations with little wasted time.
Having an "ADD Classes button" labeled "Add Product Content Type" would be real nice too.
Personally, to me, given the voluminous amount of things to understand in Drupal, its better to not introduce a new word "Class"
when its functionally a "Content type". its a little war of words, but i hope for consistency most of all. Drupal is great!
Comment #9
TR CreditAttribution: TR commentedJust to be perfectly clear:
However, the whole point of this issue is that if we do treat product classes identically to content types, then there is confusion and difficulty of use as the original poster and you both say. Additionally, people who have used Ubercart for years will see this as a missing feature. So we need a bridge between the two.
You can help out by testing the patch in #6 and commenting on the steps in #5.
Comment #10
nigelwhitePatch #6 won't apply here. On composer install I get "Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2763535-6-product-class-add.patch".
At admin/store/products/classes there is no "Add a class" link, as it seems there should be according to documentation at https://www.drupal.org/docs/8/modules/ubercart/all-about-products/unders....
Drupal 8.6.4 Ubercart 4.0.0-alpha5
Comment #11
TR CreditAttribution: TR commented@nigelwhite: "Patch #6 won't apply here."
No, you're wrong. I triggered a re-test of the patch in #6 and you can see in the above test results that the patch still applies to HEAD. I also tested this locally, and the patch still applies cleanly with no offsets or fuzz.
You must be trying to apply it to something other than HEAD.