Try the Demo

Magento Forum

   
Change product price when product click on Add To Cart Button for simple product
 
Jignesh Chauhan
Sr. Member
 
Total Posts:  170
Joined:  2009-12-23
 

Hello everyone,

I am working on jewelry site and i have created custom product view page.

Please have a look at below page.

http://luxerings4less.com/engagement/viv-39.html

On this page i have done customization currently i have added ajax feature to update the product price.

case 1 : suppose i am on the product view page and i have selected metal type as 18K White gold and AJAX request will send and actual product price after that if i will select the custom option then price of product is not updated properly.

So some one can please let me know what should i do in this case to work site in normal way.

Thanks,
Jignesh

 Signature 

Thanks and Regards,
Jignesh Chauhan
Skype : er.jignesh.chauhan

 
Magento Community Magento Community
Magento Community
Magento Community
 
dipen_vichhi
Jr. Member
 
Total Posts:  21
Joined:  2011-07-28
 

Hello JigneshBhai,

Below is the solution for you problem.

Use the following event in you config.xml
<events>
<checkout_cart_product_add_after>
<observers>
<provide name>
<type>singleton</type>
<class>Test_Testing_Model_Cart_Observer</class>
<method>calculateAddToCart</method>
</provide name>
</observers>
</checkout_cart_product_add_after>
</events>

and create the observer for this with the following content.

public function calculateAddToCart($observer){
$customPrice = Mage::getSingleton(’core/session’)->getCustomPriceCalcuation(); // Provide you price i have set with session
$p = $observer->getQuoteItem();
$p->setCustomPrice($customPrice)->setOriginalCustomPrice($customPrice);
}

 Signature 

Thanks,
Dipen Vichhi,
Email:

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