VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: Miku on January 12, 2017, 14:21:08 PM

Title: Custom Field Type: Date - Time 00:00
Post by: Miku on January 12, 2017, 14:21:08 PM
Hi,
Like on subject: when I choose the date using native Custom Field Type: Date there's always the same time showing up on the page - 00:00.

So the date info looks as follow:
Thursday, 12 January 2017 00:00

Is that 00:00 intentional?  Or should the field display the time when the action was actually made? Is there any way to get rid of that time?
Title: Re: Custom Field Type: Date - Time 00:00
Post by: Studio 42 on January 14, 2017, 01:12:46 AM
This is Joomla formated
DATE_FORMAT_LC="l, d F Y"
DATE_FORMAT_LC1="l, d F Y"
DATE_FORMAT_LC2="l, d F Y H:i"
DATE_FORMAT_LC3="d F Y"
DATE_FORMAT_LC4="Y-m-d"
DATE_FORMAT_LC5="Y-m-d H:i"
DATE_FORMAT_JS1="y-m-d"

I think that VM use old Joomla value DATE_FORMAT_LC2, and should use DATE_FORMAT_LC3 or DATE_FORMAT_LC1 as default.
You need to enter in the customfield (not in the product edit) value: LC2 or value: LC1
Title: Re: Custom Field Type: Date - Time 00:00
Post by: Miku on January 16, 2017, 09:17:44 AM
Thank you Studio 42 for your reply, but could you please give some hint how to do that?

Quote from: Studio 42 on January 14, 2017, 01:12:46 AM
You need to enter in the customfield (not in the product edit) value: LC2 or value: LC1

There's a datepicker in Custom Field Type: Date.  Searching forum I came across to:

QuoteCOM_VIRTUEMART_DATE_FORMAT_INPUT_JS is for javascript date picker

and

QuoteJoomla's default date format is set in the language file (eg en-GB.ini)   http://forum.joomla.org/viewtopic.php?f=615&t=775861#p2952085

To set VirtueMart's date format you should create language overrides for the strings in (eg) language/en-GB/en-GB.com_virtuemart.ini

Following the info I've tried to make a language override for that string but with no result....

Title: Re: Custom Field Type: Date - Time 00:00
Post by: Studio 42 on January 16, 2017, 14:05:21 PM
This should solve the display in front end, not in the product edit form date picker. Have you try "LC1" as value in the customfield edit form ?
Title: Re: Custom Field Type: Date - Time 00:00
Post by: rakuszj on April 03, 2020, 10:01:13 AM
Change:

administrator\components\com_virtuemart\views\product\tmpl\product_edit_price.php

Original:


<?php echo vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_up'], 'mprices[product_price_publish_up][]'); ?>
and
<?php echo  vmJsApi::jDate ($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_down'], 'mprices[product_price_publish_down][]'); ?>


New:

<input type="datetime-local" style="text-align:right;" name="mprices[product_price_publish_up][]" value="<?php echo str_replace(' '''substr_replace($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_up'], 'T'100)) ?>"/>
and
<input type="datetime-local" style="text-align:right;" name="mprices[product_price_publish_down][]" value="<?php echo str_replace(' '''substr_replace($this->product->allPrices[$this->product->selectedPrice]['product_price_publish_down'], 'T'100)) ?>"/>