Hello!!
in 2.3.0.2 in guest checkout
https://neobeauty.gr
All Guests has 6820 default rewardpoints.
Just put something in cart and go checkout
https://neobeauty.gr/index.php?route=checkout/checkout
where can i delete these points?
While there might be an extension for this, one quick way to restrict this feature would be by editing your catalog/model/checkout/order.php file.
Find all instances of:
replace with:
This should rectify the issue by preventing future rewards being added when a guest is using checkout.
For the points that were already added on the database, create a database backup. Then, create a new PHP file in your root admin folder of your fileserver named: reward_guest_remove.php . Then, paste in the following content:
Then, on your browser's admin folder, launch the reward_guest_remove.php file. This should resolved the issue. Once all updated, remove the PHP file from your fileserver.
Update: OC v1.5x API example can be found on this post: viewtopic.php?f=20&t=206911#p734188
Find all instances of:
Code: Select all
reward = '" . (int)$product['reward'] . "'"
Code: Select all
reward = '" . (!isset($this->session->data['guest']) ? (int)$product['reward'] . "'" : '')
For the points that were already added on the database, create a database backup. Then, create a new PHP file in your root admin folder of your fileserver named: reward_guest_remove.php . Then, paste in the following content:
Code: Select all
<?php
if (file_exists('./config.php')) {
require_once('./config.php');
}
function library($class) {
$file = DIR_SYSTEM . 'library/' . str_replace('\\', '/', strtolower($class)) . '.php';
if (is_file($file)) {
include_once($file);
return true;
} else {
return false;
}
}
spl_autoload_register('library');
spl_autoload_extensions('.php');
class import {
public $db;
public function __construct() {
$this->db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
}
}
$db = new import();
$query = $db->query("SELECT `op`.`order_product_id` FROM `" . DB_PREFIX . "order` `o` INNER JOIN `" . DB_PREFIX . "order_product` `op` ON (`op`.`order_id` = `o`.`order_id`) WHERE `o`.`customer_id` = '0' AND LENGTH(TRIM(`op`.`reward`)) > 0");
if ($query->num_rows) {
foreach ($query->rows as $result) {
$db->query("UPDATE `" . DB_PREFIX . "order_product` SET `reward` = '' WHERE `order_product_id` = '" . (int)$result['order_product_id'] . "'");
}
}
Update: OC v1.5x API example can be found on this post: viewtopic.php?f=20&t=206911#p734188
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Who is online
Users browsing this forum: No registered users and 5 guests