News:

Support the VirtueMart project and become a member

Main Menu

Multilangual Shop! Problem with create-date in database

Started by rado85, September 04, 2013, 20:25:12 PM

Previous topic - Next topic

rado85

Hi, i wrote before about this iritaiting problem. but now i know much more.

I have multi language store where is problem with latest products module.

i found out that when i translate product it stop displaying in latest products. Even when i sort category by date it is on last position!

The reason of that is - in the moment i translate product in database in table virtuemart_products "created_on" is 0000000;00000;0;0;0. When i manually set date it is ok.

Can you tell me how to fix this problem ?

rado85

Now i updated Joomla 2.5.14 and VM 2.20C.

I Makes translation for product -> Save (save succesfull info) and... nothing hapen. The translations doesn`t save. when i chose language again there is info "No translation for this product" Something is wrong with database ...

Maxim Pishnyak

You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

rvbgnu

Hi,
I have the same problem here with a multilangual shop.
creation date OK when cloning product, I have the alert message about the other language does not exist. BUT the creation_date is changed to '0000-00-00 00:00:00' when I save the product translation!!

Joomla 2.5.16
VM 2.0.24
Default back-end template.

Any idea?
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! Stripe.com payment plugin for VirtueMart 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart

Peter Pillen

#4
Think I found it

file: administrator\components\com_virtuemart\helpers\vmtable.php

in the function setLoggableFieldsForStore() @ line382


search for...

//If nothing is there, dont update it
$this->created_on = null;


This line is written there three times in this function and replace them with

unset($this->created_on);

Because the comment line says "If nothing is there, dont update it" but saying $this->created_on = null to achieve that, does not eliminate the variable ... it just changes it into "0000-00-00 00:00:00". In that function the're still a couple more lines like that.

rvbgnu

Hi P2 Peter,

Well done Man! It is fixed!! Thank you!

However, I have only found two instances of
$this->created_on = null;

and I have also changed, to keep code consistency
$this->created_by = null;
to
unset($this->created_by);

So NOW I have, at last, correct "Latest products" displayed!

It is time to commit this to the Core code VM Devs ;-) and maybe this way to eliminate a variable, for other variables, is used in somewhere else in the code and cause trouble... I will let the experts check for it.

So Peter, I owe you one (beer)  ;)
Sláinte!
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! Stripe.com payment plugin for VirtueMart 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart

Peter Pillen

I'm not sure if this would cause problems for other variables because it just incorrect to say $this->created_on = null,  because null is an accepted value for that field.

QuoteHowever, I have only found two instances of $this->created_on = null

Tip: If you're coding and only found two instances ... always tell the others they're three of them. You never know you missed one yourself  ;D

* whoop ... just lost my free beer now *

rvbgnu

... or because you started with a few pints before me, so you see "three instead of two"...  :P

More seriously, not only your pint is still on, but you might have another one coming, once I have tested your fix for this annoying and long lasting bug
http://forum.virtuemart.net/index.php?topic=96784.msg408999#msg408999
[/END of cross posting]
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! Stripe.com payment plugin for VirtueMart 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart

Peter Pillen

Aha! Not many people responded on that one, but at this moment that fix also works pretty well (needs further improvement though). But lets stay on the subject of this topic ... two beers you were saying?  :)

rvbgnu

(yes, if you come over to Ireland, let me know... or maybe we should find another way, it may not happen, and I do not promise something I could not keep 8)

BUT there is a side effect AFTER this fix: the next modification to a product with a null *created_on* date field (0000-00-00 00:00:00) will set it to the current modification timestamp. There after, the *created_on* will not change, according to my few tests (on a copy of a live and real shop).
SO we are better adding some date on the field sooner than later, even with the same for all. Otherwise, every modified product with a null creation date will be seen among "latest products"...

Working on a SQL for PhpMyadmin to do this
Best Regards, Hervé Boinnard - Irish Time (GMT)
Joomla! multilingual website and online business made easy - https://www.puma-it.ie

3D Secure v1 (3DS1) & Strong Customer Authentication (SCA)! Stripe.com payment plugin for VirtueMart 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/stripe-for-virtuemart
Authipay (AIB Merchant Services) for VirtueMart 2 & 3: https://www.puma-it.ie/en/joomla-and-virtuemart-extensions/authipay-aib-merchant-services-for-virtuemart

Peter Pillen

Due to time-shortage I wasn't able to test this code completely, but I suspected something like that. Nothing checks if a product already had a good timestamp. But I will look into it later on.