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

Custom Pricing from outside of Magento
 
rteague612
Member
 
Avatar
Total Posts:  48
Joined:  2008-07-29
 

I posted this in the how do I section, but got no help so I thought I would try here.

Ok, in our custom magento app, we are integrating with our erp, the pricing a customer gets is fed via web service from our erp.  This is necessary because different customers will have different pricing based on contract.  The regular price from the data base is fine because I show their actual pricing as a special price.  So since my “special price” is not part of the product or item object, it isn’t inherently fed to the checkout portion of the order process.  How can I make my special price… the price retrieved from my erp, the ubiquitous final price that gets passed to the cart and ultimately to the order process.  any help would be appreciated.

Thanks

--
Richard

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ryan Sun _Kuafu
Guru
 
Total Posts:  317
Joined:  2008-11-14
FL
 

rewrite Mage_Catalog_Model_Product_Type_Price

 
Magento Community Magento Community
Magento Community
Magento Community
 
rteague612
Member
 
Avatar
Total Posts:  48
Joined:  2008-07-29
 

Finally got to check this post and will try.  Thanks!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
rteague612
Member
 
Avatar
Total Posts:  48
Joined:  2008-07-29
 

That worked like a charm!!!  Thank you so much.  One last question, If I needed to change how an order number is generated, where would I find that?

Thanks in advance

--
Richard

 
Magento Community Magento Community
Magento Community
Magento Community
 
cbsteven
Member
 
Total Posts:  73
Joined:  2008-07-25
 

Did you have to do an entire rewrite of a PHP module, or was it an easy addition?

 
Magento Community Magento Community
Magento Community
Magento Community
 
rteague612
Member
 
Avatar
Total Posts:  48
Joined:  2008-07-29
 

It was an extremely easy addition:

I created a module for pricing and created its config.xml:

<config>
   <
modules>
      <
Company_CompanyPricing>
         <
version>1.0.0</version>
         <
depends><!-- no dependencies --></depends>
      </
Company_CompanyPricing>
   </
modules>
   <global>
      <
models>
          <
catalog>
         <
rewrite>
             <
product_type_price>Company_CompanyPricing_Model_Price</product_type_price>
         </
rewrite>
        </
catalog>
      </
models>
   </global>
</
config>

then added the model class:

class Company_CompanyPricing_Model_Price extends Mage_Catalog_Model_Product_Type_Price
{

    
function getPrice($product{
                   
        
//Stuff you want the function to do 
          
}

}

then made sure that my module was active in my companyName_all.xml file and voila!

 
Magento Community Magento Community
Magento Community
Magento Community
 
fear4me
Jr. Member
 
Total Posts:  18
Joined:  2008-07-08
 

I got this already working using a similar override code. Now I get the price from out of our ERP-software shown with our product. However… I have to fill a regular price during import in the database for a product. Using the function getPrice the base-price is loaded, but the base-price what is in the Magento-database is used for the SpecialPrice (see attachment). Also the price

Any idea what to disable in Magento or which extra function to override?

Image Attachments
magento_screenshot.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top