I'm needing to save an additional parameter when the customer click in "addToCart". In the product page I added a box with some data to fill. When the customer click on "addToCart" these data should be saved in a column created in sales_flat_quote_item called "passengers_data". But I can't save in my custom column.
I've created a Event to catch the custom parameters. Here is my config.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<modules>
<DevXIII_CpfPlus>
<version>0.1.0</version>
</DevXIII_CpfPlus>
</modules>
<global>
<models>
<cpfplus>
<class>DevXIII_CpfPlus_Model</class>
</cpfplus>
</models>
<events>
<checkout_cart_add_product_complete>
<observers>
<cpfplus>
<type>singleton</type>
<class>cpfplus/observer</class>
<method>convertPassengers</method>
</cpfplus>
</observers>
</checkout_cart_add_product_complete>
</events>
<resources>
<cpfplus_setup>
<setup>
<module>DevXIII_CpfPlus</module>
<class>DevXIII_CpfPlus_Model_Resource_Setup</class>
</setup>
<connection>
<use>directory_setup</use>
</connection>
</cpfplus_setup>
</resources>
</global>
<frontend>
<!-- Begin: Sobrescrevendo o controller do checkout -->
<routers>
<checkout>
<args>
<modules>
<DevXIII_CpfPlus before="Mage_Checkout">DevXIII_CpfPlus</DevXIII_CpfPlus>
</modules>
</args>
</checkout>
</routers>
<!-- End: Sobrescrevendo o controller do checkout -->
<layout>
<updates>
<cpfplus>
<file>cpfplus.xml</file>
</cpfplus>
</updates>
</layout>
</frontend>
</config>
And here is my Model/Observer.php:
<?php
class DevXIII_CpfPlus_Model_Observer
{
public function convertPassengers( $observer )
{
$item = $observer->getQuoteItem();
$product = $observer->getProduct();
$params = $observer->getRequest()->getParams();
}
}
The idea is save these data to display for each product saved in order, but I don't know how I can do this.
Thanks!!!
setPassengerData()
on the quote item. Then the question remains if you have the right event. I think this is dispatched aftersave()
, but I may be mistaken.