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 8969453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:35:35+00:00 2026-06-15T17:35:35+00:00

I have to create a (virtual, simple )product and then add to cart both

  • 0

I have to create a (virtual, simple )product and then add to cart both programmatically, i have done this so far. now i have to set custom options when this product add to cart. but nothing happens . here is my code

  $product = Mage::getModel('catalog/product')->load($product_id);

    $cart = Mage::getModel('checkout/cart');
    $cart->init();


    $params = array(
        'product' => $product->getId(), // This would be $product->getId()
        'qty' => 1,
        'options' => array(
            34 => "value",
            35 => "other value",
            53 => "some other value"
        )
    );      



    try {   
        $cart->addProduct($product, new Varien_Object($params));
        Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
        $cart->save();
    }
    catch (Exception $ex) {
        echo $ex->getMessage();
    }
  • 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-15T17:35:36+00:00Added an answer on June 15, 2026 at 5:35 pm

    Here is the code i was come up with success.

    $a_options = array(
        'options' => array(
             'label' => 'Choice',
             'value' => $pkg_selected_products,
        )
    );
    
    $quoteItem->addOption(new Varien_Object(
        array(
            'product' => $quoteItem->getProduct(),
            'code' => 'additional_options',
            'value' => serialize($a_options)
        )
    ));
    
    $quote->addItem($quoteItem);
    $quote->save();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Poco public virtual short UserID { get; set; } [Required]
So for my programming class we have had a project to create a virtual
I have create a vcf file that contains contacts by using this code ContentResolver
I have create my own NSOpenGLView class, right now the data that i want
I have create name range on sheet A so I need to use this
I have the following domain class: public class Product { public virtual Guid Id
I have the following simple class class base { public: int x; base &set(int
I have a simple class called Applicant. I'm trying to add a template controller
I have done a simple experiment to test MongoDB's performance and disk usage. I
I have a pretty simple problem, but right now can't seem to see the

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.