Tutorial: Product
Edit on GitHubThis 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
ProductCountry
module located insrc/Zed
. - Create the
ProductCountry
table under the persistence layer. - After defining the new table, run the database migration and check that the table was added to your database.
console propel:install
- Implement query by product ID and query by country ID under the persistence layer.
- Implement
ProductCountryManager
and add the facade call. ImplementProductCountryBusinessFactory
. - Implement the operations under
ProductCountryFacade
. - 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.
- Add
product_country
to 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.
Thank you!
For submitting the form