Answer the question
In order to leave comments, you need to log in
How to fix option selection?
Hello, I wrote a script that should send a message to the admin that the remainder of the options is less than 1, but for some reason the message is not sent, maybe someone knows what could be wrong in the code or why the letter does not arrive?
The code is marked in the order.php model
$option_gry = $this->db->query("SELECT quantity, name FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE product_option_value_id = '" . (int)$option['product_option_value_id'] . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
if ($option_gry->row['quantity'] < 1) {
$this->load->model('setting/store');
$text = 'Warning!'."\n\n"; $text .= 'Product option stock reached 0'."\n\n";
$text .= 'Product option name:'.$option_gry->row['name']."\n";
$text .= 'Product name:'.$qry->row['name']."\n";
$text .= 'Product model:'.$qry->row['model']."\n";
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setFrom($this->config->get('config_email'));
$mail->setTo($this->config->get('config_email'));
$mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
$mail->setSubject('Out of stock on: '. $qry->row['name']);
$mail->setText($text);
$mail->send();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question