OpenCart 🇺🇦

Схема

public mixed getLatestProducts ( $limit )

Аргументы

Аргумент Возможный тип Описание
$limit

Описание

Метод пока еще не документирован.

Исходный код

if ($this->customer->isLogged()) {
	$customer_group_id = $this->customer->getCustomerGroupId();
} else {
	$customer_group_id = $this->config->get('config_customer_group_id');
}	

$product_data = $this->cache->get('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $customer_group_id . '.' . (int)$limit);

if (!$product_data) { 
	$query = $this->db->query("SELECT p.product_id FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY p.date_added DESC LIMIT " . (int)$limit);

	foreach ($query->rows as $result) {
		$product_data[$result['product_id']] = $this->getProduct($result['product_id']);
	}

	$this->cache->set('product.latest.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'). '.' . $customer_group_id . '.' . (int)$limit, $product_data);
}

return $product_data;