If you want to build this yourself you would have to start out with building your own extension. There are a couple of nice tutorials on that here and here but it comes down to having an extension with a config.xml
, perhaps a Data helper
and Models
.
The config.xml would look something like this:
<?xml version="1.0"?>
<config>
<modules>
<[Namespace]_[Module]>
<version>1.0.0</version>
</[Namespace]_[Module]>
</modules>
<global>
<models>
<[module]>
<class>[Namespace]_[Module]_Model</class>
</[module]>
</models>
<helpers>
<[module]>
<class>[Namespace]_[Module]_Helper</class>
</[module]>
</helpers>
</global>
</config>
Now moving on to actually kicking into action when a shipment is created. For this Magento offers Events
. A nice tutorial on events can be found here. We just need to find the right event that triggers when the Shipment is created. We can use the Magento 1.7 event cheatsheet for that. sales_order_shipment_save_after
should do the trick for you.
Lets start by adding your observer to the config.xml INSIDE the global
tag.
<events>
<sales_order_shipment_save_after>
<observers>
<[module]_shipping_observer>
<type>singleton</type>
<class>[Namespace]_[Module]_Model_Observer</class>
<method>sendList</method>
</[module]_shipping_observer>
</observers>
</sales_order_shipment_save_after>
</events>
This tells Magento to fire class [Namespace]_[Module]_Model_Observer
, method sendList
when the event is triggered.
Now we can add the final piece, the Observer Model. Create a file in the Model
directory called Observer.php
and insert the following code.
<?php
class [Namespace]_[Module]_Model_Observer extends Mage_Core_Model_Abstract
{
public function sendList($observer)
{
$shipment = $observer->getEvent()->getShipment();
$order = $shipment->getOrder();
[...]
retrieve items and send email
[...]
}
}
Now you have your basic observer. You will need to add code to retrieve the items of a shipment, probably something along the lines of $products = Mage::getResourceModel('sales/order_item_collection')->setOrderFilter($orderid);
and I suggest using this tutorial or this tutoral on how to send the email.