Tutorial: ProductEdit on GitHub
This tutorial shows how to add information to products regarding the country where the product was manufactured (for example, Made in “China”) and display it on the product details page rather than just adding it as an attribute.
Bonus challenge: Add a glossary key for “Made in”. Show this string translated in the product detail page.
ProductCountry module (Zed)
- Create the
ProductCountrymodule located in
- Create the
ProductCountrytable under the persistence layer.
- After defining the new table, run the database migration and check that the table was added to your database.
- Implement query by product ID and query by country ID under the persistence layer.
ProductCountryManagerand add the facade call. Implement
- Implement the operations under
- To have relations between abstract products and countries (for testing few products would be enough), manually add values to the table.
Collector module (Zed)
- Update the query that aggregates the product data and aggregation/processing logic.
product_countryto the data set that goes to Redis.
- Run the collectors to bring data to Redis.
Product module (Yves)
Update the Twig template that shows the product details (
src/Pyz/Yves/Product/Theme/default/product/detail.twig) so that it also shows where the product is being produced.
For submitting the form