what I want to do is display the product Attributes on the invoice within OpenCart. I'm a PHP beginner, I can do few things. I know the basics of the MVC and OpenCart.
I need to pull the $product['attributes]
for each product in an order and load it into the Controller file for me to use within the order_invoice.tpl
View file.
What I'm thinking of so far is:
'attributes' => $this->model_catalog_product->getProductAttributes($result['product_id']);
adding this to the Controller file for the Order invoice, but I'm unsure where and how, also, if a product has more than one attribute, I'll need to load this into an array.
Then on the order_invoice.tpl
I'll need to echo something along the lines of this
<?php foreach ($order['product'] as $product) { ?>
<?php foreach ($product['attributes'] as $attribute) { ?>
<?php echo $product['attribute']; ?>
<?php } ?> // END FOREACH ATTRIBUTE
<?php } ?> // END FOREACH PRODUCT
Now I know this isn't "aesthetically" the correct way to echo PHP, it should all be between one set of PHP tags, but for a beginner like me its easier to see what I'mm doing and if I do syntax errors.
Can someone help me in how to write this so it works fully?