Price date restrictions applied when editing product

  • Posts: 306
  • Thank you received: 42
  • Hikamarket Multivendor Hikashop Business
5 years 10 months ago #302509

-- HikaShop version -- : 4.0.1
-- HikaMarket version -- : 3.0.0
-- Joomla version -- : 3.9.1
-- PHP version -- : 7.1.24 & 7.2.1.3
-- Error-message(debug-mod must be tuned on) -- : None

Hi

When editing a product from the front-end, date restrictions are added to the price on save.

To reproduce:
- In the front-end open an existing product for editing
- Click Apply or Save
The restriction start and end dates are filled with 1970-01-01 02:00 but were previously blank.

I have reproduced it with a clean install of Joomla, HikaShop and HikaMarket. (doesn't happpen on th demo site though!)

We noticed this after moving the site to a new server and updating HikaShop & Hikamarket with fresh downloads.

Server info:
Database Type mysql
Database Version 10.2.19-MariaDB-log-cll-lve
Database Collation utf8_general_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.1.25
Web Server LiteSpeed
WebServer to PHP Interface litespeed
Joomla! Version Joomla! 3.9.1 Stable [ Amani ] 27-November-2018 15:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0

Before saving


After saving


This effectively removes the price so the product is listed as Free.

UPDATE
There is no problem when editing in the back-end admin.
The problem seems to be server related. I fired up my old server and cannot reproduce the problem there.

regards
Trevor

Attachments:
Last edit: 5 years 10 months ago by trevsmiff. Reason: Added update re server related.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
5 years 10 months ago #302510

Hello,

I cannot reproduce the issue on my two test websites.

Please note that your instructions are not complete/right since you do not mention to edit a price. But since there is one flow in the description I can't know if it's the only one.

I would suggest you to perform a test with the default Joomla template and be sure that you do not have issue with the automatic validation of fields using some JS. Because a script might be the source of that issue (it could force the datefield to select a value when the form is submitted).

And please perform simple tests like verifying if the issue is also there when you click on the "OK" button and not on the "Apply"/"Save".
Since we cannot reproduce the issue ; we need to understand it and find a way to see/reproduce it.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 306
  • Thank you received: 42
  • Hikamarket Multivendor Hikashop Business
5 years 10 months ago #302528

Hi Jerome

I have set up a test site in a sub-domain on the same server as the live site and installed Joomla, HikaShop and HikaMarket - nothing else. The template is the default Protostar. Hikashop is installed with the sample products.

Test1:
- I log in as admin on the front-end and click on the pencil icon to edit one of the products - Brown Shoes
- There is one price and no restrictions.
- Click 'Save' without changing any of the fields
- The product page is displayed and the price is 'Free'
- Edit the product
- The price now has a start and end date restriction of '1970-01-01 01:00'
- Clear out the restriction dates and click OK
- The price is refreshed without restrictions
- Click Save
- The product page is displayed with the price showing correctly

Test 2:
- Edit another product from the front-end
- Product has one price and no restrictions
- Click 'Apply' without changing any of the fields
- The page refreshes with the start and end date restriction of '1970-01-01 01:00'

Test 3:
- Edit another product from the front-end
- Product has one price and no restrictions
- Click Back
- The product is displayed with the price

Looking at the server settings I notice that there are quite a few php and pearl functions that have been disabled compared to the old server but I wouldn't know which to enable. I could send you a list if it would help or would yo like a super-user login?

Best regards
Trevor

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
5 years 10 months ago #302583

Hello,

Yes, an account in order to see the issue directly in your website would be interesting.
Please use the "contact us" form with a link (url) to that forum thread so the support team will know what to do with the credentials.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 306
  • Thank you received: 42
  • Hikamarket Multivendor Hikashop Business
5 years 10 months ago #302584

Login details have been sent.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
5 years 10 months ago #302627

Hello,

The issue is regarding the configuration of the timezone of your server.
When the timestamp is not set, the value in the database is "0".

That value is sent to the function "hikashop_getTime" ; which convert a date into a timestamp.
But when you give it a timestamp, you should get the same value in return. In your case it gave you the timestamp plus one hour.

It is also why when you re-save a product, the dates increase.
First time : "1970-01-01 01:00"
Second time : "1970-01-01 02:00"
Etc...

Please note that it is also visible in HikaShop and for all date fields that you can edit.

Even if I add a patch into HikaMarket to avoid the save of the date when the value is "0" ; you would still have your timezone configuration problem and the increase of the date each time you save the product.

So you can edit the HikaMarket product class and replace

$product->prices[$k]->price_start_date = isset($value['price_start_date']) ? hikamarket::getTime($value['price_start_date']) : '';
$product->prices[$k]->price_end_date = isset($value['price_end_date']) ? hikamarket::getTime($value['price_end_date']) : '';
By
$product->prices[$k]->price_start_date = !empty($value['price_start_date']) ? hikamarket::getTime($value['price_start_date']) : '';
$product->prices[$k]->price_end_date = !empty($value['price_end_date']) ? hikamarket::getTime($value['price_end_date']) : '';
But it would just hide the problem in your case.

Best regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 306
  • Thank you received: 42
  • Hikamarket Multivendor Hikashop Business
5 years 10 months ago #302629

Hi Jerome

Thanks for spotting that, I will get inn touch with the hosting company.

Best regards
Trevor

Please Log in or Create an account to join the conversation.

  • Posts: 306
  • Thank you received: 42
  • Hikamarket Multivendor Hikashop Business
5 years 10 months ago #302631

I have managed to do a quick fix by adding the following line to .htaccess

php_value date.timezone ""
The value was "Europe/Paris"

regards
Trevor

The following user(s) said Thank You: Jerome

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.081 seconds
Powered by Kunena Forum