woothemes/woocommerce — pull request #3181 by franticpsyx (2013-05-15 12:55:10+00:00)
Title: Add Product Title Preambles in template files.

Title preambles may be used by extensions to add information before product titles. This is only useful in cases where the position of the Product Meta (after the product title + variation data) is inappropriate.

The Composite Products extension - https://trello.com/card/composite-products/4eea190569963dd4135c83f3/321 - is a good example. Each Composite Product has a number of Properties mapped to possible product choices. When a product chosen for a property gets added to the cart, there needs to be some way to quickly convey this information right before the title of the product.

Example: A "Computer" (Composite Product) is added to the cart and
"Product X" is the chosen option for a "Mainboard" property. With a preamble filter in place, it is possible to add a formatted "Computer Mainboard: "
string before the product title, where 'Computer' is the name of the
parent product/collection and 'Mainboard' is the property that this product corresponds
to.

Example 2: http://www.somewherewarm.net/PreamblesEx.jpg ( Title 1/2/3 = Property Preambles of the 'BTO' Composite Product. The products are listed right below, as usual, with their corresponding quantities. )

Discussion:

Since the title filters may be used to add this information, adding more filters may be considered as overkill.

However, what's important here is that Preambles should be added outside any html anchor tags that surround titles and should ideally be in their own html span or div tags, depending on the information that needs to be added.

In this sense, review-orders.php, email-order-items.php and order-details.php may not need to be touched, since the Product Titles are either output without any html around them, or the html tags around the title are passed in the hook, as part of the title.

However, in the case of cart.php, the existing title filter is inside the html anchor tags. This means that the preamble info would be wrapped in an anchor tag, which does not make sense.

Also, if the title filters are used to add preambles and other extensions filter the title when preamble info has been added, there may be issues.

So, in the end, the pull request does not touch/use the title filters at all.

Thoughts? Ideas? What would be the best and safest way to add this information, without wrapping them in title anchors and without risking filter scope mixups?