Skip to content

Commit

Permalink
Fixed catalog review
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCartpenter committed Jan 20, 2024
1 parent a6f3666 commit e1daab8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
16 changes: 8 additions & 8 deletions upload/catalog/model/catalog/review.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ class ModelCatalogReview extends Model {
/**
* addReview
*
* @param int $product_id
* @param array $data
* @param int $product_id
* @param array<string, mixed> $data
*
* @return void
*
* @throws \Exception
*
* @return void
*/
public function addReview(int $product_id, array $data): void {
$this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int)$this->customer->getId() . "', product_id = '" . (int)$product_id . "', text = '" . $this->db->escape($data['text']) . "', rating = '" . (int)$data['rating'] . "', date_added = NOW(), `date_modified` = NOW()");

$review_id = $this->db->getLastId();

if (in_array('review', (array)$this->config->get('config_mail_alert'))) {
Expand All @@ -32,10 +32,10 @@ public function addReview(int $product_id, array $data): void {

$message = $this->language->get('text_waiting') . "\n";
$message .= sprintf($this->language->get('text_product'), html_entity_decode($product_info['name'], ENT_QUOTES, 'UTF-8')) . "\n";
$message .= sprintf($this->language->get('text_reviewer'), html_entity_decode($name, ENT_QUOTES, 'UTF-8')) . "\n";
$message .= sprintf($this->language->get('text_rating'), $rating) . "\n";
$message .= sprintf($this->language->get('text_reviewer'), html_entity_decode($data['name'], ENT_QUOTES, 'UTF-8')) . "\n";
$message .= sprintf($this->language->get('text_rating'), $data['rating']) . "\n";
$message .= $this->language->get('text_review') . "\n";
$message .= html_entity_decode($text, ENT_QUOTES, 'UTF-8') . "\n\n";
$message .= html_entity_decode($data['text'], ENT_QUOTES, 'UTF-8') . "\n\n";

if ($this->config->get('config_mail_engine')) {
$mail_option = [
Expand Down
10 changes: 6 additions & 4 deletions upload/catalog/model/extension/payment/sagepay_direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,17 +385,19 @@ public function cronPayment(): array {
$this->load->model('account/order');

$i = 0;
$subscriptions = $this->getProfiles();

$cron_data = [];

$subscriptions = $this->getProfiles();

foreach ($subscriptions as $subscription) {
$order_subscription = $this->getSubscriptionOrder($subscription['subscription_id']);

$today = new \DateTime('now');
$unlimited = new \DateTime('0000-00-00');
$next_payment = new \DateTime($subscription_order['next_payment']);
$trial_end = new \DateTime($subscription_order['trial_end']);
$subscription_end = new \DateTime($subscription_order['subscription_end']);
$next_payment = new \DateTime($order_subscription['next_payment']);
$trial_end = new \DateTime($order_subscription['trial_end']);
$subscription_end = new \DateTime($order_subscription['subscription_end']);

$order_info = $this->model_account_order->getOrder($subscription['order_id']);

Expand Down
4 changes: 2 additions & 2 deletions upload/catalog/model/extension/payment/sagepay_server.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function subscriptionPayment(array $item, string $vendor_tx_code): void {
$this->addSubscriptionOrder($item['subscription']['order_id'], $response_data, $subscription_id, date_format($trial_end, 'Y-m-d H:i:s'), date_format($subscription_end, 'Y-m-d H:i:s'));

$transaction = [
'order_id' => $subscription_info['order_id'],
'order_id' => $item['subscription']['order_id'],
'description' => $response_data['Status'],
'amount' => $price,
'payment_method' => $order_info['payment_method'],
Expand All @@ -288,7 +288,7 @@ public function subscriptionPayment(array $item, string $vendor_tx_code): void {

$this->model_checkout_subscription->editSubscription($subscription_id, $item['subscription']);
} else {
$this->addSubscriptionTransaction($subscription_info['subscription_id'], $response_data, $transaction, 4);
$this->addSubscriptionTransaction($subscription_id, $response_data, $transaction, 4);
}
}
}
Expand Down

0 comments on commit e1daab8

Please sign in to comment.