Pls can anyone help me with information on how to show date available on product page & category page, it's urgently needed, i will really appreciate if someone can help me, i've tried some code lines from a source http://www.opencartaz.com/opencart/-sol ... lable.html who tested it on version 1.5.1 but didn't work on mine, i'm using opencart version 1.5.6 here is the information below..... copied from http://www.opencartaz.com/opencart/-sol ... lable.html
[SOLVED] [1.5] Show date available Opencart
Please LogIn to Reply!
Post By: guest | 01-16-2013 07:57 Reply
Question
I am using OC 1.5.1. I want to show date available on product page. Below is my method to show date available:1. In file product.php at catalog/controller/product/product.php i am add code
Code: Select all
$this->data['text_date_available'] = $this->language->get('text_date_available');
and
Code: Select all
'date_available' => $result['date_available'],
2. In file product.tpl i am add code
Code: Select all
<span><?php echo $text_date_available; ?></span> <?php echo $product_info['date_available']; ?><br />
3. in file product at catalog/languange/english/product/product.php i am add code
Code: Select all
$_['text_date_available'] = 'Date Available:';
The result is that:Date Available: 2009-02-03Can anyone help me how to show date available in format month date, year (February 3, 2009) ?
Answers
Try this in your No. 2
Code: Select all
<span><?php echo $text_date_available; ?></span> <?php echo date("F j, Y", strtotime($product_info['date_available'])); ?><br />
Work fine. Thank you.
I'm trying to do this on my site but I'd like the date available to only display if I've set something in it. Otherwise the field will not appear at all. It seems like it defaults to todays date if you don't put another one into the field, so I am pretty sure I need a check to see if the date is > NOW but not sure where to put it or the syntax Thanks!
Code: Select all
<?php if(strtotime($product['date_available']) > (time()+86400)){ ?> <span><?php echo $text_date_available; ?></span> <?php echo date("F j, Y", strtotime($product_info['date_available'])); ?><br /> <?php } ?>
Change 86400 to the number of seconds after NOW you would like it to be shown.86400 = 60secs X 60mins x 24hours (i.e. 1 day)
Not following. Perhaps I didn't explain well. Some of my products are Out of stock and have an ETA. I want to put in the ETA in the available date so that if there is an available date set, it will display the ETA field. If not, it won't show it (most of my items are in stock or other status not needing the ETA date). Or perhaps if my status is x,y or z it shows it, otherwise it doesn't. Right now, all products show the ETA and if I do not enter something in the field, it defaults to being the date I entered that product in the cart, which isn't an ETA. Hope that makes more sense
I JUST NEED A BETTER INFORMATION ON HOW TO GO ABOUT THIS, CAUSE THE STEPS ABOVE DIDN'T WORK ON VERSION 1.5.6, THANKS IN ADVANCE TO ANY HELPER......
Who is online
Users browsing this forum: Amazon [Bot] and 4 guests