1

I'm quite new in magento, I work version 1.6.2.0.
I'm trying to add my own Custom Shipping Method module and I have few problems. My magento has already custom checkout module - Threestep checkout, what I'm trying to do is save additional shipping info which I choose in 3rd step (Payment and Shipping) (something like Store Pickup place) to Quote, and then in Review retrive Quote data and save it to Order.
I'm using Events to do this:
checkout_controller_onepage_save_shipping_method to save data to Quote
checkout_type_onepage_save_order to save data to Order
The problem is that Quote and Order doesn't have any free place where i can save my data, so I created installer for my module:

$installer = $this;
$installer->startSetup();
$packboxName = array(
    'type'              => 'varchar',
    'backend'           => '',
    'frontend'          => '',
    'label'             => 'packboxname',
    'input'             => '',
    'class'             => '',
    'source'            => '',
    'global'            => 1,
    'visible'           => true,
    'required'          => false,
    'user_defined'      => false,
    'default'           => '',
    'searchable'        => false,
    'filterable'        => false,
    'comparable'        => false,
    'visible_on_front'  => false,
    'visible_in_advanced_search' => false,
    'unique'            => false
);
$installer->addAttribute('order', "packboxname", $packboxName);
$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'packboxname', 'varchar(255) DEFAULT NULL');
$installer->addAttribute('quote', "packboxname", $packboxName);
$installer->getConnection()->addColumn($installer->getTable('sales/quote'), 'packboxname', 'varchar(255) DEFAULT NULL');

$installer->endSetup();


And i got a error saying that

$installer->addAttribute('quote'

has wrong Entity Id. So I checked DB, table: eav_entity_type and there wasn't any 'quote' type (hopefully there was a 'order') I didn't really know what I should do so, I tried to google something, I found tutorial and modified my installer.

$installer->addEntityType('quote', array(
        'entity_model'    => 'sales/quote',
        'table'           =>'sales/quote',
    ));

Now it's working I have additional place where I can save my info, but my friend told me that I shouldn't use addEntityType, Is there any other way to achive what I need?

migu
  • 11
  • 1
  • 3

1 Answers1

0

I think perhaps what you're looking for can be found in this answer: https://stackoverflow.com/a/4389786/823549

An important point made in that answer is the event fired, sales_convert_quote_to_order - this will get fired when the quote is being converted to an order, and will happen regardless of what your other checkout module does. This answer is also useful as you can see the details of your custom column in the orders grid page.

Community
  • 1
  • 1
1000Nettles
  • 2,314
  • 3
  • 22
  • 31