- Issue created by @nicolasgraph
- @nicolasgraph opened merge request.
- π«π·France nicolasgraph Strasbourg
I need to switch to another project for now ; I'll be back asap !
While schemadotorg_physical seems to work on my install with the Person node type, tests still need work. - π«π·France nicolasgraph Strasbourg
I took a look at tests but I wasn't able to fix them for now.
- First commit to issue fork.
- πΊπΈUnited States jrockowitz Brooklyn, NY
\Drupal\schemadotorg\SchemaDotOrgEntityFieldManager::getSchemaPropertyDefaultFieldTypes is not returning any data. I will fix this in a new ticket.
- πΊπΈUnited States jrockowitz Brooklyn, NY
I merged 1.0.x to hopefully get the tests running.
- πΊπΈUnited States jrockowitz Brooklyn, NY
Below are my steps to review
- Enable the schemadotorg_physical module
- Confirm that the 'Default Schema.org type properties' are set to include depth, height, and width
- Confirm that the 'Default Schema.org property fields' type for depth, height, weight, and width are updated ./admin/config/schemadotorg/settings/properties
- Create IndividualProduct content type and confirm that depth, height, and width are being created and set to the expected physical field. /admin/structure/types/schemadotorg?type=IndividualProduct
- Review JSON-LD for depth, height, and width
I made some additional improvements.
Otherwise, this looks great!!!
- π«π·France nicolasgraph Strasbourg
Review process succeeded; thanks for your additional improvements!
- π«π·France nicolasgraph Strasbourg
Just in case @jrockowitz, I've created a new branch with one addtional commit to allow physical_dimensions to populate depth, height and width properties. It still need tests and can be added to a new dedicated MR. What do you think?
- πΊπΈUnited States jrockowitz Brooklyn, NY
Your improvements in #12 make sense. I am not sure how to merge it with the current MR. Can you please merge your change into the current MR?
- π«π·France nicolasgraph Strasbourg
nicolasgraph β changed the visibility of the branch 3479145-adds-physical-support-dimensions-extended to hidden.
- π«π·France nicolasgraph Strasbourg
Change merged, not sure if you want to change the issue status back to needs review or needs work to add a few more tests.
- πΊπΈUnited States jrockowitz Brooklyn, NY
This needs work because I realized the dimension JSON-LD needs to include the name of the dimension
We need to fix the below JSON must to include height, width, and depth as the name property.
// Check size JSON-LD. $expected_size = [ [ '@type' => 'QuantitativeValue', 'value' => '10', 'unitText' => 'mm', ], [ '@type' => 'QuantitativeValue', 'value' => '10', 'unitText' => 'mm', ], [ '@type' => 'QuantitativeValue', 'value' => '10', 'unitText' => 'mm', ], ];
- πΊπΈUnited States jrockowitz Brooklyn, NY
I'm sorry. I asked you to merge the MR without a full review. I misread the code as improving the existing logic rather than adding new logic.
I am confused about the changes you made to `schemadotorg_physical_schemadotorg_jsonld_schema_property_alter()`
If the Dimensions field is used for https://schema.org/size, we should extract the values into 'width, height, and depth'
The simplest solution is to generate the below JSON-LD, which I know is not recommended but is valid JSON-LD. NOTE: my original code did not have name property.
{ "@context": "https://schema.org", "@type": "IndividualProduct", "@url": "https://schemadotorg.ddev.site/example-product", "name": "Example Product", "size": [ { "@type": "QuantitativeValue", "name": "length" "value": "4.000000", "unitText": "ft" }, { "@type": "QuantitativeValue", "name": "width" "value": "5.000000", "unitText": "ft" }, { "@type": "QuantitativeValue", "name": "height" "value": "3.000000", "unitText": "ft" } ] }
Your code assumes a Dimension field could be used for just weight, height, or length. Dimension should only be used for something that needs weight, height, or length.
If the Schema.org type that uses https://schema.org/size supports https://schema.org/width, https://schema.org/height, and https://schema.org/depth, we could explore manipulating the generated JSON-LD to extract the value from 'size' in the more specific properties.
Can we please keep it simple and add more features as needed?
- π«π·France nicolasgraph Strasbourg
Your approach makes sense. However, in the Commerce Shipping β case, a shippable product variation will have a dimension field, AND it could also have an attribute field for the size which could be XL for example. Do your think that this particular case should be handled by schemadotorg_commerce β ?
- πΊπΈUnited States jrockowitz Brooklyn, NY
You might have to create a
field_dimensions
field that uses a custom JSONLD hook to set the https://schema.org/height, https://schema.org/width, and https://schema.org/depth of the product. I agree that size should be used for XL, L, M, and S.The OOTB solution is to create dedicated https://schema.org/height, https://schema.org/width, and https://schema.org/depth, which seems wrong when there is a dimensions field type.
- π«π·France nicolasgraph Strasbourg
It's ok for me, I'll implement this hook ; we can revert my changes and explore manipulating the generated JSON-LD to extract the value from 'size' in the more specific properties later if needed.
- π«π·France nicolasgraph Strasbourg
Unwanted changes reverted and names added for width, length and height.
- πΊπΈUnited States jrockowitz Brooklyn, NY
@nicolasgraph Thank you!!!
-
jrockowitz β
committed c9782d72 on 1.0.x authored by
nicolasgraph β
Issue #3479145 by nicolasgraph, jrockowitz: Adds Physical support
-
jrockowitz β
committed c9782d72 on 1.0.x authored by
nicolasgraph β
Automatically closed - issue fixed for 2 weeks with no activity.