Format Special Date
Format Special Date
Hi Brent,
is there a method to set this date in european format ( dd mm yyyy )?
Ois
is there a method to set this date in european format ( dd mm yyyy )?
Ois
Re: Format Special Date
If you want to manually change it, it is product.tpl
Just change the F-d-y to whatever format you want.
Code: Select all
<?php if (($product['special_price'] > '$0.00' ) && date('Y-m-d') >= $product['sale_start_date'] && date('Y-m-d') <= $product['sale_end_date']) { ?><br>
<?php echo "<b>".$text_date."</b><br>"; ?>
<?php echo " ".$text_sale_start.date("F-d-Y",strtotime($product['sale_start_date'])); ?><br>
<?php echo " ".$text_sale_end.date("F-d-Y",strtotime($product['sale_end_date'])); ?><br>
<?php } ?>
Re: Format Special Date
Hi ,
I thinked this , but the language remain in english always
I thinked this , but the language remain in english always
Re: Format Special Date
Let me make some changes using the new date class.
Re: Format Special Date
Meanwhile I made the change .
Re: Format Special Date
In catalog/controller/product.php at line 20, add the $dates initialization.
At about line 218 add the 2 view set lines.
In product.tpl at lines 169 and 170, change these 2 lines to use the sales_start and sales_end variables which not contain language formatted text.
Make sure you have updated the language/Italian/italian.php to reflect the new dates as per the english.
Code: Select all
function index() {
$cart =& $this->locator->get('cart');
$currency =& $this->locator->get('currency');
$dates = $this->locator->get('dates'); //*****
$this->dimension=& $this->locator->get('dimension');
Code: Select all
if($product_info['special_price'] >0 && date('Y-m-d') >= $product_info['sale_start_date'] && date('Y-m-d') <= $product_info['sale_end_date']){
$number_days = intval((strtotime($product_info['sale_end_date']) - time())/86400);
$days_remaining = $language->get('days_remaining', ($number_days ? $number_days : 1));
$view->set('sale_start',$dates->getDate("F-d-Y", strtotime($product_info['sale_start_date']))); //*****
$view->set('sale_end', $dates->getDate("F-d-Y", strtotime($product_info['sale_end_date']))); //*****
}
Code: Select all
<?php if (($product['special_price'] > '$0.00' ) && date('Y-m-d') >= $product['sale_start_date'] && date('Y-m-d') <= $product['sale_end_date']) { ?><br>
<?php echo "<b>".$text_date."</b><br>"; ?>
<?php echo " ".$text_sale_start.$sale_start; ?><br>
<?php echo " ".$text_sale_end.$sale_end; ?><br>
<?php } ?>
Re: Format Special Date
In the product.php, use this instead if you like. It will format as per your language file.
I have also modified the English language file to make dates a more readable format.
Code: Select all
$view->set('sale_start',$dates->getDate($language->get('date_format_short'), strtotime($product_info['sale_start_date'])));
$view->set('sale_end', $dates->getDate($language->get('date_format_short'), strtotime($product_info['sale_end_date'])));
Code: Select all
$_['date_format_short'] = 'F j, Y';
$_['date_format_long'] = 'l, F jS, Y';