Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4123022
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:33:28+00:00 2026-05-20T23:33:28+00:00

We have a system like gift cards balance usage in the checkout page.While customers

  • 0

We have a system like gift cards balance usage in the checkout page.While customers on the checkout page customers can use their Gift card balance amount to buy products.

So i have added a a tab before payment tab in which customers have option to enter the amount o use from their gift card balance amount so when they say proceed am getting the entered value in custom Onepage controller and pass it to Onepage.php(Model class) to reduce the total amount.

This is what am doing on the model class.

public function saveCustomDiscount($discount=0)
{       
    $this->getQuote()->setGrandTotal($this->getQuote()->getGrandTotal() - $discount);
    $this->getQuote()->setBaseGrandTotal($this->getQuote()->getBaseGrandTotal() - $discount);
    $this->getQuote()->save();
    //$this->getQuote()->collectTotals()->save();
    $order = $this->getQuote()->getData();  
    Zend_Debug::dump($order);      
    return array();
}

And am calling this function from the controller Action function were am getting the user input.

Here what ever am passing as discount the total amount and base total is not reducing. Its same as original.

Note :
Before custom order save.

array(51) {
   ---------------
  ["grand_total"] => string(8) "243.7200"
  ["base_grand_total"] => string(8) "243.7200"
  ----------------- 
}

After custom order save.

array(51) {
   ---------------
   ["grand_total"] => float(223.72)
   ["base_grand_total"] => float(223.72)
  ----------------- 
}

The data type is changed from string to float when am doing debug. What i have to do, to reduce the order total from the custom discount. Please help me.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:33:29+00:00Added an answer on May 20, 2026 at 11:33 pm

    Did you set the discountCode?

    i.e.  $quote->setCouponCode(strlen($couponCode) ? $couponCode : '')
                     ->collectTotals()
                     ->save();
    

    Later on, in the Quote, did you apply the discount?

    i.e. $order->setDiscountAmount(Mage::getSingleton('checkout/session')->getQuote()->getSubtotalWithDiscount() - Mage::getSingleton('checkout/session')->getQuote()->getSubtotal());
                $order->setShippingAmount(Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingAmount());
                $order->setSubtotalWithDiscount(Mage::getSingleton('checkout/session')->getQuote()->getSubtotalWithDiscount());
                $order->setGrandTotal(Mage::getSingleton('checkout/session')->getQuote()->getGrandTotal());
    

    etc.

    EDIT:

    I’ve worked with a team to do a WordPress / Magento hybrid and it’s definitely left some learning lessons on me. Magento was used as a purely transactional engine and we had to do this entire checkout process by hand (including creating a custom WP plugin to handle each step in the cart).

    Log this out at the end so we can see what you have (possibly put this in your edited question):

    Mage::log("checkoutprocess: getSubtotal: " . $order->getSubtotal());
                Mage::log("checkoutprocess: getTaxAmount: " . $order->getTaxAmount());
                Mage::log("checkoutprocess: getDiscountAmount: " . $order->getDiscountAmount());
                Mage::log("checkoutprocess: getShippingAmount: " . $order->getShippingAmount());
                Mage::log("checkoutprocess: getGrandTotal: " . $order->getGrandTotal());
    
                Mage::log("checkoutprocess: getBaseSubtotal: " . $order->getBaseSubtotal());
                Mage::log("checkoutprocess: getBaseDiscountAmount: " . $order->getBaseDiscountAmount());
                Mage::log("checkoutprocess: getSubtotalWithDiscount: " . $order->getSubtotalWithDiscount());
                Mage::log("checkoutprocess: getBaseGrandTotal: " . $order->getBaseGrandTotal());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a system.collections.generic.list(of ListBox) I would like to use the collection classes built-in
I'm creating a PHP CMS and have some system pages like a 404 page,
I recently posted this question about codes for a gift-card-like voucher that users can
If I have a tag system like Stackoverflow. I can add tags, save and
Why does .Net not have the System.Float type like System.String , System.Double etc.?
I have a system that runs like this: main.exe runs sub.exe runs sub2.exe and
Essentially, I have a binary voting system Like/Dislike. Thee class is called Like It
We have a system were we would like to store about 100M documents. We
I have a system that will generate messages sporadically, and I would like to
I have a system with roughly a 100 million documents, and I'd like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.