K
K
kamisarlapsha2018-10-17 18:56:02
opencart
kamisarlapsha, 2018-10-17 18:56:02

Why is $spec duplicated?

Hey! Made a $special output in the order email, order.php controller.

$product_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product['product_id'] . "'");
foreach ($product_query->rows as $prodquery) { 
     $special = $prodquery['price'];
 }

Next, I added a variable to the products array.
'special' => $special,
And further I deduce in order.tpl Everything works. But if the product does not have this discount, then the value of the previous one is duplicated in special. How can I solve this problem, otherwise I'm already confused. Thanks in advance!
<?php echo $product['special']; ?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question