Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:42:53+00:00 2026-06-05T22:42:53+00:00

I need to extend the Magento shopping cart to include an extra step for

  • 0

I need to extend the Magento shopping cart to include an extra step for a store locator. I understand that I need to overwrite the core OnePage controller (Mage_Checkout_OnepageController) and blocks (Mage_Checkout_Block_Onepage) but what needs to be done with regards to keeping track of the extra information (e.g. user’s selected options from my custom step).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:42:54+00:00Added an answer on June 5, 2026 at 10:42 pm

    There are a number of steps required here to get the whole solution.

    Firstly, create a new module. Use the ModuleCreator if you wish.

    Then, write a setup script in your module to add the new fields to Magento’s attribute structure, e.g. :

     $setup = new Mage_Sales_Model_Mysql4_Setup('core_setup');
     $setup->startSetup();
    
     $setup->addAttribute('quote', 'my_attribute', array('type' => 'varchar', 'visible' => false, 'required' => false));
     $setup->addAttribute('order', 'my_attribute', array('type' => 'varchar', 'visible' => false, 'required' => false));
     $setup->addAttribute('invoice', 'my_attribute', array('type' => 'varchar', 'visible' => false, 'required' => false));
    $setup->addAttribute('creditmemo', 'my_attribute', array('type' => 'varchar', 'visible' => false, 'required' => false));
    

    Note the use of the Mage_Sales_Model_Mysql4_Setup to add the fields to the relevant sales_flat_quote and sales_flat_order tables.

    Now, insert the following values in your module’s config.xml file:

    <global>
    
        <fieldsets>
            <sales_convert_quote>
                <my_attribute>
                    <to_order>*</to_order>
                </my_attribute>
            </sales_convert_quote>
            <sales_convert_order>
                <my_attribute>
                    <to_cm>*</to_cm>
                    <to_invoice>*</to_invoice>
                </my_attribute>
            </sales_convert_order>
        </fieldsets>
    

    That will instruct Magento to copy the values of your custom field from quote to order to invoice and credit_memo, etc.

    Then in your custom block/controller code, you will be able to use Magento’s magic getters and setters to persist the values.

    $oQuote = Mage::getSingleton('checkout/session')->getQuote();
    $oQuote->setMyAttribute('some_value');
    $oQuote->save();
    

    You should see the new column and value saved in sales_flat_quote. Then once the customer completes checkout, the same value should be saved in sales_flat_order.

    Note that the above code can be extended to work for quote_item and order_item by just changing quote to quote_item etc, however, if you wish to save attribute values that have been set on your products, then some extra work is required.

    Insert a new block of XML into your config.xml (again inside the global node):

       <sales>
            <quote>
                <item>
                    <product_attributes>
                        <my_attribute />
                    </product_attributes>
                </item>
            </quote>
        </sales>
    

    Where my_attribute is the attribute code on the product model. That will make the my_attribute available on the linked product, so you can access it via

    $oQuoteItem->getProduct()->getMyAttribute()
    

    without needing to perform a full Mage::getModel('catalog/product')->load($oQuoteItem->getProductId()). This is much more efficient.

    Then, you will need an observer to copy the values from the product object to the quote_item object. So, declare your observer in the config.xml:

        <events>
            <sales_quote_item_set_product>
                <observers>
                    <quoteitem_set_custom_data>
                        <type>singleton</type>
                        <class>mymodule/observer</class>
                        <method>setCustomDataOnQuoteItem</method>
                    </quoteitem_set_custom_data>
                </observers>
            </sales_quote_item_set_product>
        <events>
    

    and write code in your observer class like this:

    public function setCustomDataOnQuoteItem($oObserver){
        $oProduct = $oObserver->getProduct();
        $oQuoteItem = $oObserver->getQuoteItem();
        foreach(array('my_attribute') as $vAttributeCode){
            $oQuoteItem->setData($vAttributeCode,$oProduct->getData($vAttributeCode));
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to put some extra information into to the standard javadoc hover, that
I have a mission critical Perl-CGI server-side application that I need to extend or
I need to create a configuration section, that is able to store key-value pairs
I need to extend the TreeNode class such that I can add custom properties
I need to extend a class, which is encapsulated in a closure. This base
Hi I need to extend the CListControl class in C++/MFC, which will add several
I have a college project where I need to extend an existing spreadsheet application
I need to iteratively extend a weka ARFF file with SparseInstance objects. Each time
Basically what I need is to do something like this App.CommentView = Backbone.View.extend({ className:
I have the capability to extend a class at compile time, but I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.