Version Notes
Initial version
Download this release
Release Info
Developer | Mukesh Chapagain |
Extension | Chapagain_AssociatedProductPriceInCart |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
app/code/community/Chapagain/AssociatedProductPriceInCart/Model/Observer.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chapagain_AssociatedProductPriceInCart_Model_Observer
|
4 |
+
{
|
5 |
+
public function updateCartPrice(Varien_Event_Observer $observer)
|
6 |
+
{
|
7 |
+
$event = $observer->getEvent();
|
8 |
+
$quoteItem = $event->getQuoteItem();
|
9 |
+
//$product = $item->getProduct();
|
10 |
+
|
11 |
+
if ($option = $quoteItem->getOptionByCode('simple_product')) {
|
12 |
+
$simpleProductId = $option->getProduct()->getId();
|
13 |
+
$simpleProduct = Mage::getModel('catalog/product')->load($simpleProductId);
|
14 |
+
$simpleProductPrice = $simpleProduct->getFinalPrice();
|
15 |
+
|
16 |
+
$quoteItem->setOriginalCustomPrice($simpleProductPrice);
|
17 |
+
|
18 |
+
// No need to save quote item object in observer.
|
19 |
+
// It will save the object automatically, as it is being passed by reference.
|
20 |
+
|
21 |
+
//$quoteItem->save();
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Chapagain/AssociatedProductPriceInCart/etc/config.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Chapagain_AssociatedProductPriceInCart>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Chapagain_AssociatedProductPriceInCart>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<events>
|
10 |
+
<sales_quote_add_item>
|
11 |
+
<observers>
|
12 |
+
<associatedproductpriceincart_observer>
|
13 |
+
<type>singleton</type>
|
14 |
+
<class>Chapagain_AssociatedProductPriceInCart_Model_Observer</class>
|
15 |
+
<method>updateCartPrice</method>
|
16 |
+
</associatedproductpriceincart_observer>
|
17 |
+
</observers>
|
18 |
+
</sales_quote_add_item>
|
19 |
+
</events>
|
20 |
+
</frontend>
|
21 |
+
</config>
|
app/etc/modules/Chapagain_AssociatedProductPriceInCart.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Chapagain_AssociatedProductPriceInCart>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Chapagain_AssociatedProductPriceInCart>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package><name>Chapagain_AssociatedProductPriceInCart</name><version>0.1.0</version><stability>stable</stability><license>OSL v3.0</license><channel>community</channel><extends></extends><summary>An extension to use the associated product's price in shopping cart instead of the configurable product's price.</summary><description>This extension updates the configurable product's price to that of its associated product price when the configurable product is added to cart. So, the updated price (i.e. price of the associated product) is seen in the shopping cart.
|
3 |
+
|
4 |
+
No extra configuration settings is to be made. Just install the module in your Magento shop and the module will work on the fly.
|
5 |
+
|
6 |
+
Please note:
|
7 |
+
|
8 |
+
- You need to refresh cache after installing the module (System -> Cache Management)
|
9 |
+
- You need to disable compilation if it is enabled (System -> Tools -> Compilation)</description><notes>Initial version</notes><authors><author><name>Mukesh Chapagain</name><user>chapagain</user><email>mukesh.chapagain@gmail.com</email></author></authors><date>2017-02-22</date><time>4:15:55</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Chapagain_AssociatedProductPriceInCart.xml" hash="5fd4266614d3e3b77ac1156d5a8c4122"/></dir></dir><dir name="code"><dir name="community"><dir name="Chapagain"><dir name="AssociatedProductPriceInCart"><dir name="Model"><file name="Observer.php" hash="2905abdcb7580594571f012a8d3c9fa7"/></dir><dir name="etc"><file name="config.xml" hash="ae39765b3528d6691e77599b9b4113b7"/></dir></dir></dir></dir></dir></dir></target></contents></package>
|