Magento – Custom price passed through module when add to cart but not when “edit” item function

cartprice

I have a simple module that obtains a custom price for an item when added to cart. The code for the module is below. My issue is that the custom price is not passed to cart when the "edit" function is used in cart. For example: as a user, I navigate to my shopping cart that has a few items and I click "edit" next to one of those items. I am redirected to the item page so that I can change options and/or quantity. I select "add to cart" and the custom price is not passed to the cart. It works fine under a normal add to cart situation, but not with "edit". Any changes I can make to the module to make the custom price pass to the module with the "edit" function? Add another event to config perhaps?

config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>    
    <modules>
        <Caitlinhavener_Dynamicprice>
            <version>0.1.0</version>
        </Caitlinhavener_Dynamicprice>
    </modules>
    <global>
        <models>
            <chdispatcher>
                <class>Caitlinhavener_Dynamicprice_Model</class>
            </chdispatcher>
        </models>

            <events>
                <checkout_cart_product_add_after>
                    <observers>
                        <modify_to_custom_price>
                            <class>Caitlinhavener_Dynamicprice_Model_Observer</class>
                            <method>modifyPrice</method>
                        </modify_to_custom_price>
                    </observers>
                </checkout_cart_product_add_after>
            </events>
    </global>
</config>

Observer.php:

<?php
class Caitlinhavener_Dynamicprice_Model_Observer
{
    public function modifyPrice(Varien_Event_Observer $obs)
    {
        // Get the quote item
        $item = $obs->getQuoteItem();

        // Ensure we have the parent item, if it has one
        $item = ( $item->getParentItem() ? $item->getParentItem() : $item );

        // Load the custom price
        $price=$_POST['customPrice'] or exit ("This price variable post doesn't work");

        // Set the custom price
        $item->setCustomPrice($price);
        $item->setOriginalCustomPrice($price);
        // Enable super mode on the product.
        $item->getProduct()->setIsSuperMode(true);
    }
}
?>

Best Answer

Using the event sales_quote_add_item instead of checkout_cart_product_add_after solved my issue!