iworks/omnibus

Lowest historical price not calculated properly

Opened this issue · 1 comments

Hi, small bug report extracted from one of my production stores and reproduced locally.

Steps to reproduce:

  1. Plugin version 2.3.9, plugin is set to display lowest price from last 30 days. Clock set to 02.08.2023 or later.

  2. Clear meatdata for test product (replace X with test product id)

SELECT * FROM wp_postmeta WHERE post_id = X AND meta_key LIKE '%iwo%'

  1. Import meatdata sample for test product (replace X with test product id)

INSERT INTO wp_postmeta (meta_id, post_id, meta_key, meta_value) VALUES
(4785319, X, '_iwo_price_lowest', 'a:3:{s:5:"price";s:4:"1936";s:9:"timestamp";i:1675908204;s:4:"type";s:9:"autosaved";}'),
(4827751, X, '_iwo_price_lowest', 'a:4:{s:5:"price";s:4:"2200";s:9:"timestamp";i:1678204781;s:13:"price_regular";s:4:"2200";s:10:"price_sale";s:0:"";}'),
(4827752, X, '_iwo_last_price_drop_timestamp', '1679567887'),
(4829297, X, '_iwo_price_lowest', 'a:2:{s:5:"price";s:4:"1936";s:9:"timestamp";i:1678324509;}'),
(4833070, X, '_iwo_price_lowest', 'a:4:{s:5:"price";s:4:"2200";s:9:"timestamp";i:1678377930;s:13:"price_regular";s:4:"2200";s:10:"price_sale";s:0:"";}'),
(4835450, X, '_iwo_price_lowest', 'a:2:{s:5:"price";s:4:"1936";s:9:"timestamp";i:1678496983;}'),
(4853549, X, '_iwo_price_lowest', 'a:4:{s:5:"price";s:4:"2200";s:9:"timestamp";i:1679567887;s:13:"price_regular";s:4:"2200";s:10:"price_sale";s:0:"";}');

Expected behaviour

Plugin calculates lowest price to 2200

Current behaviour:

Plugin calculates lowest price to 1936
Commenting out line
https://github.com/iworks/omnibus/blob/main/includes/iworks/omnibus/class-iworks-omnibus-integration.php#L243C4-L243C4 fixes the problem

@maciej-laskowski hi - is this issue still a problem?