Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
You could set a limit of x weeks or months and then compare the product date-added to that or you can do it individual by storing the last visit-date in a cookie and compare the products date-added/updated to that.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Not exactly. The most recent products can also be on the date and time rather than quantity-based during a time interval period.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Yes, sorry that's what I meant, the most recently added products, but x of them are displayed. E.g. the most recent 10 to be added.straightlight wrote: ↑Thu Mar 26, 2020 6:31 pmNot exactly. The most recent products can also be on the date and time rather than quantity-based during a time interval period.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Correct.paulfeakins wrote: ↑Thu Mar 26, 2020 6:38 pmYes, sorry that's what I meant, the most recently added products, but x of them are displayed. E.g. the most recent 10 to be added.straightlight wrote: ↑Thu Mar 26, 2020 6:31 pmNot exactly. The most recent products can also be on the date and time rather than quantity-based during a time interval period.
Tested in v3.0.3.2 release. In catalog/controller/extension/module/latest.php file,
find:
Code: Select all
if ($results) {
Code: Select all
$i = 1;
Code: Select all
$data['products'][] = array(
Code: Select all
if ($this->config->get('config_product_new')) {
$new_date = new DateTime(date('Y-m-d H:i:s', strtotime($result['date_added'])));
$current_date = new DateTime(date('Y-m-d H:i:s', time()));
$new_interval = $new_date->diff($current_date)->days;
}
Code: Select all
'rating' => $rating,
Code: Select all
'new' => ($this->config->get('config_product_new') && $this->config->get('config_product_new_limit') > 0 && $i <= $this->config->get('config_product_new_limit') && $new_interval > 0 && $new_interval <= $this->config->get('config_product_new_day') ? true : false),
Code: Select all
}
return $this->load->view('extension/module/latest', $data);
Code: Select all
++$i;
find:
Code: Select all
if (isset($this->error['encryption'])) {
$data['error_encryption'] = $this->error['encryption'];
} else {
$data['error_encryption'] = '';
}
Code: Select all
if (isset($this->error['product_new_limit'])) {
$data['error_product_new_limit'] = $this->error['product_new_limit'];
} else {
$data['error_product_new_limit'] = '';
}
if (isset($this->error['product_new_day'])) {
$data['error_product_new_day'] = $this->error['product_new_day'];
} else {
$data['error_product_new_day'] = '';
}
Code: Select all
if (isset($this->request->post['config_error_filename'])) {
$data['config_error_filename'] = $this->request->post['config_error_filename'];
} else {
$data['config_error_filename'] = $this->config->get('config_error_filename');
}
Code: Select all
if (isset($this->request->post['config_product_new'])) {
$data['config_product_new'] = $this->request->post['config_product_new'];
} else {
$data['config_product_new'] = $this->config->get('config_product_new');
}
if (isset($this->request->post['config_product_new_limit'])) {
$data['config_product_new_limit'] = $this->request->post['config_product_new_limit'];
} else {
$data['config_product_new_limit'] = $this->config->get('config_product_new_limit');
}
if (isset($this->request->post['config_product_new_day'])) {
$data['config_product_new_day'] = $this->request->post['config_product_new_day'];
} else {
$data['config_product_new_day'] = $this->config->get('config_product_new_day');
}
Code: Select all
if ($this->error && !isset($this->error['warning'])) {
Code: Select all
if (isset($this->request->post['config_product_new']) && $this->request->post['config_product_new']) {
if (!isset($this->request->post['config_product_new_limit']) || !filter_var($this->request->post['config_product_new_limit'], FILTER_VALIDATE_INT) || utf8_strlen($this->request->post['config_product_new_limit']) < 1) {
$this->error['product_new_limit'] = $this->language->get('error_product_new_limit');
}
if (!isset($this->request->post['config_product_new_day']) || !filter_var($this->request->post['config_product_new_day'], FILTER_VALIDATE_INT) || utf8_strlen($this->request->post['config_product_new_day']) < 1) {
$this->error['product_new_day'] = $this->language->get('error_product_new_day');
}
}
Code: Select all
$_['entry_error_filename'] = 'Error Log Filename';
Code: Select all
$_['entry_product_new'] = 'Show New Products';
$_['entry_product_new_limit'] = 'New Products Limit';
$_['entry_product_new_day'] = 'New Products in Days';
Code: Select all
$_['help_compression'] = 'GZIP for more efficient transfer to requesting clients. Compression level must be between 0 - 9.';
Code: Select all
$_['help_product_new'] = 'Shows new products by limited time';
$_['help_product_new_limit'] = 'Set new products limit';
$_['help_product_new_day'] = 'Set new product mount of days';
Code: Select all
$_['error_product_new_limit'] = 'The product new limit option must be, at least, set to 1!';
$_['error_product_new_day'] = 'The product new day option must be, at least, set to 1!';
Code: Select all
</fieldset>
</div>
<div class="tab-pane" id="tab-image">
Code: Select all
<div class="form-group">
<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="{{ help_product_new }}">{{ entry_product_new }}</span></label>
<div class="col-sm-10">
<label class="radio-inline"> {% if config_product_new %}
<input type="radio" name="config_product_new" value="1" checked="checked" />
{{ text_yes }}
{% else %}
<input type="radio" name="config_product_new" value="1" />
{{ text_yes }}
{% endif %} </label>
<label class="radio-inline"> {% if not config_product_new %}
<input type="radio" name="config_product_new" value="0" checked="checked" />
{{ text_no }}
{% else %}
<input type="radio" name="config_product_new" value="0" />
{{ text_no }}
{% endif %} </label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-product-new-limit"><span data-toggle="tooltip" title="{{ help_product_new_limit }}">{{ entry_product_new_limit }}</span></label>
<div class="col-sm-10">
<input type="text" name="config_product_new_limit" value="{{ config_product_new_limit }}" placeholder="{{ entry_product_new_limit }}" id="input-product-new-limit" class="form-control" />
{% if error_product_new_limit %}
<div class="text-danger">{{ error_product_new_limit }}</div>
{% endif %}
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-product-new-day"><span data-toggle="tooltip" title="{{ help_product_new_day }}">{{ entry_product_new_day }}</span></label>
<div class="col-sm-10">
<input type="text" name="config_product_new_day" value="{{ config_product_new_day }}" placeholder="{{ entry_product_new_day }}" id="input-product-new-day" class="form-control" />
{% if error_product_new_day %}
<div class="text-danger">{{ error_product_new_day }}</div>
{% endif %}
</div>
</div>
Then, in your catalog/view/theme/<your_theme>/template/extension/module/latest.twig file, between the:
Code: Select all
{% for product in products %}
Code: Select all
{% endfor %}
Code: Select all
{% if product.new %}
...
{% endif %}
Then, follow this FAQ: viewtopic.php?f=134&t=215776#p718325 .
Lastly, go to your OC admin - > systems - > settings - > add / edit settings - > data tab. Then, enable the new products, set your limit and day interval. This should resolved the issue.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Code: Select all
$i = 0;
Code: Select all
$i = 1;
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 12 guests