Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Help: need to set a custom price on an instance of a product as it goes into the cart. 
 
chris1234p
Jr. Member
 
Total Posts:  3
Joined:  2010-11-03
 

Hello all,

I have a client whom uses magento to much success for their normal shop. A while back they had a developer code a tiny hack that allows people to “place offers” on items that are marked as “outlet store”. The code that was added just shoots off a quick email to the store admins that says user xyz has placed offer 123 on product zyx, and then the rest of the transaction takes place offline.

They now want an upgrade that allows for a “minimum buyout price” to be set per outlet product, and if a user “offers” more than the minimum buyout price, it will go right into their cart for checkout, and it will assume the price that was “offered”. I was able to setup the custom attribute for minimum buyout price, and got 99% of everything working, however I cannot for the life of me figure out how to override the price on that particular item instance as it goes into the cart.

I have located about ~5 files in the magento core directory structure that look like they are the place I want to edit, but didn’t have any luck. Does anyone have any insight?

The site is currently using Magento ver. 1.4.1.0

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Shahid Sarvani
Member
 
Avatar
Total Posts:  63
Joined:  2009-08-05
 

Check on the following file and locate the function “getOriginalPrice”, this is where you can modify the code:

Here is file reference:

app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php
 
Magento Community Magento Community
Magento Community
Magento Community
 
chris1234p
Jr. Member
 
Total Posts:  3
Joined:  2010-11-03
 

Thanks for the pointer Shahid. I will take a look soon!

 
Magento Community Magento Community
Magento Community
Magento Community
 
chris1234p
Jr. Member
 
Total Posts:  3
Joined:  2010-11-03
 

Does anyone have any additional ideas on how to go about this? I tried overriding everything in that page to try to return a fixed amount for testing purposes, but even with all the functions overridden to return like 500 dollars even, I can still place items into my cart and the price is the price defined in the backend.

I am looking for a way to override a price on an item as it goes into the cart.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top