Magento 1, special_to_date one day wrong (timezone issue?)


magento 1 site, latest version .16 of algolia module

Autocomplete and search results are showing full price of item, although date range for special_to_date is correct for date of store timezone.

If I set the product date one day forward (so from 6th to 7th) the correct special price display.
The store date is the 6th.

The data in algolia index looks correct.

Any thoughts or ideas on what could be wrong appreciated.

Further on this:
in template, outputting

{{price.USD.default}} / {{price.USD.default_formated}}

The ‘default’ value is correct, and the default_formatted is the full price

so, even though the underlaying data for formatted is correct, using the _formatted tag in template is changing this to the full price (so does not seem to be using the price directly from the data)

so, where would this processing be happening?

Is there a way I can force that not to do whatever it is doing when _formated is used, and just use the given data value?

So, to solve (for now) I found that if I inject a custom formatted price value into the price array, which uses the exact same value generated as the built in _formated value, and use that, the correct price is showing.

for that I created a patch (since a live site is completely wrong), and apply that during composer install of the algolia package.

*** ./app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php	2019-12-07 23:34:44.783175824 +0000
--- /tmp/Producthelper.php	2019-12-07 22:53:40.483026103 +0000
*** 538,543 ****
--- 538,544 ----
                  $customData[$field][$currency_code]['default'] = $price;
                  $customData[$field][$currency_code]['default_formated'] = $this->formatPrice($price, false, $currency_code);
+                 $customData[$field][$currency_code]['default_formated_custom'] = $this->formatPrice($price, false, $currency_code);
                  $special_price = (double) $taxHelper->getPrice($product, $product->getFinalPrice(), $with_tax, null, null, null, $product->getStore(), null);
                  $special_price = $directoryHelper->currencyConvert($special_price, $baseCurrencyCode, $currency_code);
*** 605,610 ****
--- 606,616 ----
+                     );
+                     $customData[$field][$currency_code]['default_formated_custom'] = $this->formatPrice(
+                         $special_price,
+                         false,
+                         $currency_code
1 Like

Hi @AlgoliaforMagento,

Thanks for writing in and also sharing your patch. To the extent you believe you are experiencing a bug in the extension (rather than a feature request), please do not hesitate to open an issue in the GitHub repo: