-1

This is opencart 1.5.5.1.1 - Have this errors:

PHP Notice: Undefined index: date_added in /home/u546774105/public_html/projects/all-converse/catalog/view/theme/theme1/template/product/category.tpl on line 88
PHP Notice: Undefined offset: 1 in catalog/view/theme/theme1/template/product/category.tpl on line 6
PHP Notice: Undefined offset: 2 in catalog/view/theme/theme1/template/product/category.tpl on line 6
PHP Warning: mktime() expects parameter 6 to be long, string given in catalog/view/theme/theme1/template/product/category.tpl on line 6

This is line 1-8

<?php
$latest_products_days = 7; 
function showNew($date, $latest_products_days) {
    $arr = explode(" ", $date);
    $arrdate = explode("-", $arr[0]);
    $timestamp = (mktime(0, 0, 0, $arrdate[1],  $arrdate[2],  $arrdate[0]));
    $difference = floor((time() - $timestamp)/86400);
    if ($difference < $latest_products_days) return true; else return false;
}
?>

This is line 88

<?php
      if (showNew($product['date_added'], $latest_products_days)) echo '<div class="new">&nbsp;</div>'; ?><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
      <?php } ?>
M. Eriksson
  • 13,450
  • 4
  • 29
  • 40
  • 2
    Possible duplicate of [PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"](https://stackoverflow.com/questions/4261133/php-notice-undefined-variable-notice-undefined-index-and-notice-undef) – BenRoob Jul 24 '17 at 15:12

1 Answers1

0

i solved it: variable $product['date_added'] wasnot undefined in catalog/controller/category.php I add 'date_added' => $result['date_added'],to this array $this->data['products'][] = array(