HowTo - Change the default behavior of event triggering in the AvailabilityStorage module

Edit on GitHub

By default, events are triggered when product status is changed from available to not available and vice versa. If you want to change this behavior for the events to be triggered when the amount of product changes, follow these steps.

  1. Remove value="0" and operator="===" from the line <parameter name="spy_availability_abstract_quantity" column="quantity" value="0" operator="==="/> in src/Pyz/Zed/Availability/Persistence/Propel/Schema/spy_availability.schema.xml:
<table name="spy_availability_abstract">
        <behavior name="event>
            <parameter name="spy_availability_abstract_quantity" column="quantity"/>
  1. Run the commands:
console propel:schema:copy
console propel:model:build