We are using the MPN field in the products table to store a product denomination and I want to display this on the customer's invoice next to the quantity ordered.
I've edited the order_invoice.tpl file and was hoping I could just <?php echo $product['mpn']; ?> but it doesn't appear that the MPN is saved to the product array. What do I need to add what file in order to send the MPN value to the invoice?
Thanks
Unfortunately, MPN is not stored in the oc_order_product table
Therefore you would have to capture mpn at the point of the order being added to the database
Quite a bit of work involved and would most likely require a commercial support request via our commercial support forum
Therefore you would have to capture mpn at the point of the order being added to the database
Quite a bit of work involved and would most likely require a commercial support request via our commercial support forum
I've done that and it works. Not the most elegant solution but it does the job and is less hassle than having to modify controller files.
If anyone else needs to do the same thing just add the following query under this line:
foreach ($order['product'] as $product) {
Then you can echo mpn after the quantity.
You will need to add your own database connection script to connect to the database. Unless someone can tell me how to user the current Opencart connection?
If anyone else needs to do the same thing just add the following query under this line:
foreach ($order['product'] as $product) {
Code: Select all
$query = "SELECT mpn FROM oc_product WHERE model = '" . $product['model'] . "'";
$result = mysqli_query($dbh,$query);
echo mysqli_error($dbh);
while ($row = $result->fetch_assoc())
{
$mpn = $row['mpn'];
}
mysqli_close($con);
Code: Select all
<td class="text-right"><?php echo $product['quantity'] . " " . $mpn; ?></td>
You could just create a new model function in the admin/model/sale/order.php file, then call that function in your controller.
Who is online
Users browsing this forum: No registered users and 46 guests