Data leaves the Content Management System and enters a feed in a controlled process. There are four points where your custom modifier can hook the feed generation process. This post discusses the second of those four points and the differences.
PActionAfterLoad is the second hook. It occurs once for each product immediately after that product has been loaded and converted. All attributes exist within the item and may be inspected and/or modified. Setting the valid attribute to false at this time will cause the item not to appear in the feed.
A simple example:
Mapped via Advanced Commands:
setAttributeDefault special_price as none PChangePrice
Note: This attribute was not mapped into the feed. getValue() has no return value so if it was mapped, the result would always be “none”.
Note: At this stage of the feed generation process, the raw database values are not yet formatted. Price and weight, depending on your CMS settings, are numerical values which can be freely inspected. If you want to know what attributes are available, generate the ProductListXML feed. This feed will dump all attributes out in their unmapped forms.
Note: At this point, description is still a property and not an attribute. You can access it via: $item->description_long and $item->description_short. In some future version of Cart Product Feed, description will load as an attribute. For future compatibility, you should not modify the description here. Instead, use the PActionBeforeFeed hook to edit the description.