12

$quote2 = Mage::getSingleton('checkout/session')->getQuote(); $discountTotal = 0; foreach ($quote2->getAllItems() as $item){ $discountTotal += $item->getDiscountAmount(); }


12

This rule doesn't work because Magento 2 doesn't save payment method to quote when you select one. And it also doesn't reload totals when selecting a payment method. And unfortunately, you have to write a custom module to solve the issue. The new module needs only 4 files to be created: app/code/Namespace/ModuleName/etc/frontend/routes.xml <config ...


10

Magento saves each item respective discount on sales_flat_quote_item table at column discount_amount. This Discount Amount is stored incurrent currency. For getting total discount of current session, try the below code $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); $totalDiscount = $totals["discount"]->getValue(); ...


9

If you have object manager then you can go with following example code $price = 100; $sku = '24-WG085'; $discount = ($price - (($price + 1) / 2)); $shoppingCartPriceRule = $this->_objectManager->create('Magento\SalesRule\Model\Rule'); $shoppingCartPriceRule->setName('Add a second for $1 - ' . $sku) ->setDescription('Buy one item at regular price, and ...


9

Simply adding following tag <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> So Vendor/Module/view/frontend/layout/checkout_index_index.xml looks like <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:...


9

Admin panel -> Marketing -> Cart Sales Rules. When you expand the “Conditions” tab, you’ll be able to set when a given discount applies. For example, you can select the cart value option and this way specify that: If the cart value is greater than 50 – the discount should be applied. However, the default options don’t cover all possible situations. ...


9

app/design/frontend/{Vendor}/{theme}/Magento_Checkout/layout/checkout_cart_index.xml <?xml version="1.0"?> <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="cart....


8

Stumbled across this whilst trying to find a solution to a similar issue. Anyway, I resolved my problem and this seemed like the most relevant place to share my solution. Hopefully it will help yourself or someone in a similar Mage 'tax boat': Example - Cart subtotal w/o tax £100 My Cart discount promotion was 30% discount. £100 - 30% = £70 ...


8

Go to Backend , you can see Promotions > Catalog Price Rules > Add New Rule Than enter the information. Under Rule information , status - Active, Website : Main website select customer Groups than under Actions, you can find more information here : http://www.hostknox.com/tutorials/magento/catalog-price-rules http://merch.docs.magento.com/ce/...


7

you had a common problem, some time we not get discount amount by default in magento, please go to this link i hope you will definitely got solution http://www.magentocommerce.com/boards/viewthread/269154/ you may also check this type of problem http://magento.ikantam.com/qa/how-add-discount-total-magento


7

I think this could be because the _calculator is effectively stored as a singleton within the Mage_SalesRule_Model_Quote_Discount class, meaning that the second item to be processed will hit $this->_stopFurtherRules == true and bail. My thought process is to store the ID of the $rule which is OK to be processed, allowing further items to process only this ...


7

for -> Recently Viewed see here for ->Sorting by rating Copy the file app/code/core/Mage/Catalog/Block/Product/List.php to app/code/local/Mage/Catalog/Block/Product/List.php in list.php find for this line $this->_productCollection =$layer->getProductCollection(); which will be in around line no 86 add the following code after that $this->...


7

It sounds like your issue is that your discounts are applying to products that already have the 20% tax added to them. If this is the issue, you can solve it by changing your configuration: Calculation Settings-> Apply Discount on Prices Change Including Tax to Excluding Tax


7

Thanks @R.S. . I found the solution by referring repo created by @R.S. here: https://github.com/magepal/stackexchange/tree/develop/104112 after some minor modifications. sales.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Sales:etc/sales.xsd"> <section name="quote"&...


7

Connect to the backend Go to Promotions > Catalog Price Rules Click Add New Rule Rule Name: 30% off Status: Active Websites : Choose the websites you want to apply the discount for Customer Groups: Choose the customer groups you want to apply the discount for In the Actions tab, under Discount Amount type 30 select apply to the "by percentage of product ...


6

1) For customer account: /V1/carts/mine/coupons/:couponCode I just explain how sale rules work for customer logged a) Set coupon: vendor/magento/module-quote/etc/webapi.xml <route url="/V1/carts/mine/coupons/:couponCode" method="PUT"> <service class="Magento\Quote\Api\CouponManagementInterface" method="set"/> <resources> ...


5

I would suggest to create a new discount type "cashback". This can be done using this observer "adminhtml_block_salesrule_actions_prepareform". Once this option is added then you can apply the discount by overriding process function of Mage_SalesRule_Model_Validator In the process function, you will find switch case as follows switch ($rule->...


5

Yes, there is no corresponding condition in the default magento shopping cart rules. And yes, there are some extensions at the magento connect. Search for "special promotions" or "advanced promotions" for example. Basically, if you want to create a new module you can define a new action, similar to "fixed discount to whole cart" then observe event ...


5

Magento doesn't support updating an order. The workflow would be to cancel one order and to create a new one. In my case, I needed to update the prices of order items because an external system would give us updated prices. We could not cancel the order and create a new one because we needed to stick to one order ID. A quote object does have all the ...


5

This can be done through the standard Magento promotion rules. Go to Promotions->Shopping Cart Price Rules. Fill in the relevant information for your in the first tab. In the conditions tab click on the green plus under the rule that says: If ALL of these conditions are TRUE Select Products Attribute Combination in the drop down menu. This will then add ...


5

Sohel Rana's answer is excellent. To answer Mir's point, here is an example of how DI would be used to bring in the relevant classes in a class context, this is a small tweak to the accepted answer: protected $ruleFactory; protected $productRuleFactory; protected $foundProductRuleFactory; protected $ruleResource; public function __construct( \Magento\...


5

Try this in design/frontend/Vendor_Name/Theme_Name/Magento_Catalog/templates/product/list.phtml <?php $specialprice = $_product->getSpecialPrice(); $specialPriceFromDate = $_product->getSpecialFromDate(); $specialPriceToDate = $_product->getSpecialToDate(); $today = time(); $price = $_product->getPrice(); if($price)...


5

Use Checkout model session to get quote data. /** @var \Magento\Checkout\Model\Session $checkoutSession**/ $this->checkoutSession->getQuote()->setCouponCode($couponCode) ->collectTotals() ->save(); Remember to inject \Magento\Checkout\Model\Session in your constructor. ...


5

I have added this in my custom shipping method, and it works for me. This should be added on your collectrates function inside your module. $s_price = $request->getPackageValueWithDiscount(); $request->setPackageValue($s_price);


4

Product to catalog price rules data is stored in the table catalogrule_product In that table you will find the product_id field that relates back to your product. You should be able to build a query that checks the table for the product in question. Not 100% what your intended functionality would involve, but doing a separate query for each product to ...


4

I solved it myself! Strangely, I had to put the current currency sign before amount. We are using INR (Rs.). So I needed to use "Rs. 2000" instead of "2000". So my condition is changed from (emphasis the difference) If ALL of these conditions are TRUE : Subtotal equals or greater than 2000 to If ALL of these conditions are TRUE :...


4

Hi you can get this details using cart session $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object $subtotal = $totals["subtotal"]->getValue(); //Subtotal value $grandtotal = $totals["grand_total"]->getValue(); //Grandtotal value if(isset($totals['discount']) && $totals['discount']->getValue()) { ...


4

Turns out ... somehow... the cart rule logic in 1.9.0.1 is wrong. You can get a fix here. Worked 100% perfect from start then. https://github.com/husseycoding/cartrulefix So for everyone struggling problems with cart rules in 1.9.0.1 while using "stop further rule processing" -> use this fix!


4

If you check the HTML of the form you'll see it posts to http://domain.com/checkout/cart/couponPost/. Magento works with a router that breaks down the URL in [module]/[controller]/[action] which means you know the class and method that handles the post: Mage_Checkout_CartController::couponPostAction. Now please don't fire up your editor and put the code in ...


4

Surprisingly, this is not possible in the Magento 1.x without an extension or code modification. To add this feature in our module we had to: 1) add a new field max_discount in the table salesrule 2) observe event salesrule_validator_process <salesrule_validator_process> <observers> <amasty_rules_model_observer&...


Only top voted, non community-wiki answers of a minimum length are eligible