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

  • Home
  • SEARCH
  • 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 6187449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:03:35+00:00 2026-05-24T02:03:35+00:00

If I programmaticly add a item to a shopping cart (setting its custom options)

  • 0

If I programmaticly add a item to a shopping cart (setting its custom options) then add another instance of the same item to the cart (with its custom options set to different values), “view cart” lists each item instance on a separate line (good). However, if when adding the items, I programmaticly set one item’s special price (via SetSpecialPrice), both item prices change to that special price.

How do I limit the effects of SetSpecialPrice to only the item instance I call that method on?

Thank you,
Ben

  • 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-05-24T02:03:38+00:00Added an answer on May 24, 2026 at 2:03 am

    To the code you are adding the same ‘item’ to the quote. This could probably be considered a bug.

    You may have to go lower level. What method are you using to add the items to the cart? You may need to emulate what that method does yourself (violating DRY principles) to force it to create a new ‘item.’

    … going to look in the code now.

    Ok, looking at Mage/Sales/Model/Quote.php line 935: public function getItemsByProduct – this is where it determines if the product you are adding already exists. It calls $item->representProduct, which is in Mage/Sales/Model/Quote/Item.php line 301: public function representProduct

    If you override this class in your module/code and replace this method you should be able to add simple code that detects if there is a difference in special price and react accordingly.

    Code snipet:

        $specialPrice = $product->getSpecialPrice();
        $thisSpecialPrice = $itemProduct->getSpecialPrice();
        if((is_null($specialPrice) xor is_null($thisSpecialPrice))||
            (!is_null($specialPrice) && !is_null($thisSpecialPrice && $specialPrice!=$thisSpecialPrice))){
            return false;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to programmaticly add an item to the visitor's shopping cart. In the
Trying to programmatically add options to a SELECT drop down in IE Windows Mobile.
I have a UIViewController with a XIB and want to add programmatically another subview.
how can i add IOperationBehavior programmatically when running on iis ? not on custom
I know the solution must be simple. I want to add list item programmatically
How can I add a menu item inside a sub menu programmatically?
How do I programmatically bind data to a custom item template column for a
How can I add an item to a repeatable property programmatically in c#: let's
I would like to add a UIPageControl item programmatically to my view Controller. The
I wanted to add a DoubleClick handler to an item in a ListBox (assume

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.