diff --git a/upload/catalog/model/catalog/review.php b/upload/catalog/model/catalog/review.php index ddab6c971..3e4b182ee 100644 --- a/upload/catalog/model/catalog/review.php +++ b/upload/catalog/model/catalog/review.php @@ -8,16 +8,16 @@ class ModelCatalogReview extends Model { /** * addReview * - * @param int $product_id - * @param array $data + * @param int $product_id + * @param array $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'))) { @@ -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 = [ diff --git a/upload/catalog/model/extension/payment/sagepay_direct.php b/upload/catalog/model/extension/payment/sagepay_direct.php index 8104cda6c..96207be82 100644 --- a/upload/catalog/model/extension/payment/sagepay_direct.php +++ b/upload/catalog/model/extension/payment/sagepay_direct.php @@ -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']); diff --git a/upload/catalog/model/extension/payment/sagepay_server.php b/upload/catalog/model/extension/payment/sagepay_server.php index 564625191..8a7208bdf 100644 --- a/upload/catalog/model/extension/payment/sagepay_server.php +++ b/upload/catalog/model/extension/payment/sagepay_server.php @@ -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'], @@ -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); } } }