Browsing articles tagged with "invoice Archives - Kalpesh Mehta"
Magento get all invoices and shipments of an order
Getting all the invoices of an order:
$order = Mage::getModel('sales/order')->load($orderID); | |
if ($order->hasInvoices()) { | |
$invIncrementIDs = array(); | |
foreach ($order->getInvoiceCollection() as $inv) { | |
$invIncrementIDs[] = $inv->getIncrementId(); | |
//other invoice details... | |
} Mage::log($invIncrementIDs); | |
} |
Getting all the shipments of an order:
$order = Mage::getModel('sales/order')->load($orderID); | |
foreach($order->getShipmentsCollection() as $shipment) | |
{ | |
Mage::log($shipment->getData()); //get each shipment data here... | |
} |
Magento: Add additional product/item attributes in order and invoice emails
Recently I was working with a German client, who wanted to show additional product attribute options in the order and invoice emails due to stricter law for e-commerce in their country. Magento provides basic information in the default email templates, but each store has their unique requirement to show additional information.
I will show you how to add extra product attribute values, along with order item options and custom options in order emails and invoice emails.
Here is the code that should work for order and invoice emails to get additional PRODUCT ATTRIBUTES displayed:
$productId = $_item->getProduct()->getId(); //for order emails | |
//$productId = $_item->getProductId(); //for invoice emails | |
$product = Mage::getModel('catalog/product')->load($productId); | |
$attributes = $product->getAttributes(); | |
//Get a list of all PRODUCT ATTRIBUTES you want to show in this array... | |
$dispAttribs = array('hardrive', 'memory', 'processor'); | |
foreach ($attributes as $attribute) { | |
$attributeCode = $attribute->getAttributeCode(); | |
if(!in_array($attributeCode, $dispAttribs)) continue; | |
$label = $attribute->getFrontend()->getLabel($product); | |
$value = $attribute->getFrontend()->getValue($product); | |
echo "<br /><strong>" . $label . ":</strong> " . $value; | |
} |
Welcome to my Blog
Certifications
Honor
Recognition
Contributions
Categories
- Apache (2)
- ChatGPT (1)
- Domain name (2)
- eCommerce (2)
- htaccess (1)
- Humor (3)
- Instagram API (1)
- jQuery (4)
- JSON (1)
- Linux (10)
- Magento (142)
- Magento admin (58)
- Magento Certification (5)
- Magento error (13)
- Magento frontend (68)
- Magento Imagine (2)
- Magento Interview (5)
- Magento Master (2)
- Magento2 (10)
- Mobile (1)
- MySQL (7)
- OpenAI (1)
- OroCRM (2)
- Performance (2)
- PHP (8)
- Prototype JS (3)
- Security (4)
- Wordpress (3)
- XML (2)
Tag Cloud
500 internal server error admin answers attribute bug category checkbox checkout cookie customer difference domain name EAV error event extension interview invoice jquery linux magento magento2 magento admin magento error magento interview questions magento orm mysql observer order pinterest product products questions redirect register remove script session simplexml to array state status study guide tax url wordpress