Tutorial- Product

Edit 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)

  1. Create the ProductCountry module located in src/Zed.
  2. Create the ProductCountry table under the persistence layer.
  3. After defining the new table, run the database migration and check that the table was added to your database.
console propel:install
  1. Implement query by product id and query by country id under the persistence layer.
  2. Implement ProductCountryManager and add the facade call. Implement ProductCountryBusinessFactory.
  3. Implement the operations under ProductCountryFacade.
  4. Manually add values to table in order to have relations between abstract products and countries (for testing few products would be enough).

Collector module (Zed)

  1. Update the query that aggregates the product data and aggregation/processing logic.
  2. Add product_country to the data set that goes to Redis.
  3. 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.