You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: optional integration to compare item prices with supermarkets (Argentina only) #4807
Hi! I run Lista Inteligente, a free price-comparison app in Argentina. It compares supermarket prices published daily through the government's official price program (Precios Claros / SEPA) with prices from neighborhood stores. Many small stores here use OSPOS.
I'd like to contribute a small, optional feature before writing a PR, and wanted to ask whether it would be welcome:
A "Compare with supermarkets" button in Items, shown only when the store is configured for Argentina (currency_code = ARS or an America/Argentina timezone). Nothing changes for anyone else.
On first use it asks for explicit consent, then sends only barcode, item name and final retail price of active items. No costs, stock, customers or sales.
It opens a page with the store's prices compared against supermarkets in their province. Publishing them in the app is a separate, opt-in step.
Self-contained: one controller method, one helper, a button in items/manage, and language strings (es, en).
It's already working on 3.4.3 in a test install. Would you consider merging something like this, perhaps behind a config switch? Happy to adapt it to your conventions.
Hi it might be a useful additionele but best to add it as a plugin as it does not really belong to the core functionality. The plugin PR is mostly ready and will be merged once we pushed out a last minor release with fixes in master. #4407 check documentation in the PR on how to setup the plugin structure
Thanks! I checked out #4255. I see the events are defined in
app/Config/Events.php with placeholders, and the Plugins config tab
currently has MailChimp built in. Two questions so I build it the right way:
How should a plugin register its listener for events like item_change? Is
there a discovery mechanism planned (e.g. scanning
app/Controllers/Plugins), or should plugins add their call in Events.php
for now?
How should a plugin add its own section to the Plugins config tab?
My plugin would listen to item_change to keep prices up to date, and have a
settings section with an on/off switch and a "Compare now" button.
El mar, 10 nov 2026, 04:46, jekkos ***@***.***> escribió:
@jekkos I checked the plugin framework for @hernanmardel.
The relevant PR is #4407. It is still open and replaces the design discussed in #4255, which is closed without a merge. The details below describe the current #4407 revision and may change before merge.
Event listener
Put the plugin in app/Plugins/PriceComparePlugin/, with its main class in PriceComparePlugin.php. PluginManager discovers that directory and calls registerEvents() when the plugin is enabled. Do not add a plugin-specific listener to app/Config/Events.php.
The callback receives an array of item IDs and an optional $pluginData array. It can query the item model for the fields it needs.
item_saved fires after a successful item form save or CSV import. It does not fire in Items::postBulkUpdate() in the inspected revision. If bulk price changes must sync immediately, the framework needs an event for that path too. See the item controller.
Settings and “Compare now”
#4407 uses a Plugins management menu, rather than adding a section to the old Plugins config tab.
Implement getConfigView() and return the path to the plugin’s Views/config.php, without the .php extension. The Mailchimp plugin shows the pattern.
Post settings to plugins/saveConfig/<pluginId>. The controller calls saveSettings(). BasePlugin provides settings storage.
The management menu already has an enable/disable control. If a separate sync switch is needed, use a separate setting rather than the framework’s enabled key.
For “Compare now”, use a plugin controller and a POST route, following the Mailchimp route and controller example. Protect the action with authorization and CSRF checks. The README and manager comments differ on route auto-discovery, so verify route loading against the final merged framework.
Keep the proposed explicit consent check before either an automatic sync or “Compare now” sends data. Send only the agreed barcode, item name, and final retail price of active items. Keep publication as a separate opt-in.
The plugin README has the full structure and examples.
Actually, I went ahead and built it already, following the structure in #4407: https://github.com/hernanmardel/ospos-lista-inteligente
Self-contained in app/Plugins/ListaInteligentePlugin/, no core files touched.
Office module page with explicit consent and a "Compare with supermarkets" button (POST, CSRF-protected).
Optional automatic updates on item_saved, off by default.
Only for Argentina (currency ARS or Argentine timezone); sends only barcode, name and final retail price.
The server side is live and tested. The plugin itself is syntax-checked but not yet run on the #4407 branch, since it isn't released yet. Any early feedback is welcome, and I'll test it as soon as #4407 is merged.
Activity
jekkos commentedon Nov 10, 2026
Hi it might be a useful additionele but best to add it as a plugin as it does not really belong to the core functionality. The plugin PR is mostly ready and will be merged once we pushed out a last minor release with fixes in master. #4407 check documentation in the PR on how to setup the plugin structure
hernanmardel commentedon Nov 10, 2026
jekkos commentedon Nov 11, 2026
@CodeRabbit can you dit this up from the conversation
coderabbitai commentedon Nov 11, 2026
Analysis chain
Script executed:
Length of output: 26826
Script executed:
Length of output: 115496
Script executed:
Length of output: 65125
@jekkosI checked the plugin framework for@hernanmardel.The relevant PR is
#4407. It is still open and replaces the design discussed in#4255, which is closed without a merge. The details below describe the current#4407revision and may change before merge.Event listener
Put the plugin in
app/Plugins/PriceComparePlugin/, with its main class inPriceComparePlugin.php.PluginManagerdiscovers that directory and callsregisterEvents()when the plugin is enabled. Do not add a plugin-specific listener toapp/Config/Events.php.The event is
item_saved, notitem_change:The callback receives an array of item IDs and an optional
$pluginDataarray. It can query the item model for the fields it needs.item_savedfires after a successful item form save or CSV import. It does not fire inItems::postBulkUpdate()in the inspected revision. If bulk price changes must sync immediately, the framework needs an event for that path too. See the item controller.Settings and “Compare now”
#4407uses a Plugins management menu, rather than adding a section to the old Plugins config tab.getConfigView()and return the path to the plugin’sViews/config.php, without the.phpextension. The Mailchimp plugin shows the pattern.plugins/saveConfig/<pluginId>. The controller callssaveSettings().BasePluginprovides settings storage.enabledkey.Keep the proposed explicit consent check before either an automatic sync or “Compare now” sends data. Send only the agreed barcode, item name, and final retail price of active items. Keep publication as a separate opt-in.
The plugin README has the full structure and examples.
You are interacting with an AI system.
hernanmardel commentedon Nov 11, 2026
Thanks for the detailed pointers! I'll wait for #4407 to be merged and then build it as a plugin following that structure.
hernanmardel commentedon Nov 11, 2026
Actually, I went ahead and built it already, following the structure in #4407: https://github.com/hernanmardel/ospos-lista-inteligente
Self-contained in app/Plugins/ListaInteligentePlugin/, no core files touched.
Office module page with explicit consent and a "Compare with supermarkets" button (POST, CSRF-protected).
Optional automatic updates on item_saved, off by default.
Only for Argentina (currency ARS or Argentine timezone); sends only barcode, name and final retail price.
The server side is live and tested. The plugin itself is syntax-checked but not yet run on the #4407 branch, since it isn't released yet. Any early feedback is welcome, and I'll test it as soon as #4407 is merged.