I am using the call
$_order->getBaseGrandTotal();
to get the order total to send to the payment gateway.
The problem is the result always comes out at 4 decimal places, e.g. 18.0000.
I have no sales tax and 5 for shipping. I could do a round on the result but I am worried this might create inconsistencies in what the payment and what is stored in magenta.
I have seen some wild fixes for this on the internet but there but be a simple solution in the backend config.
To avoid the problem I used php number_format function
$baseGrandTotal = number_format($_order->getBaseGrandTotal(),2);
Related
I want to add the following shipping methods:
A price for sending an item:
to the home country
to the home country (priority)
to the EU
to the EU (priority)
to every other country
to every other country (priority)
As far as I know that can't be done out of the box with magento 2.
I also tried looking for a free extension to do that, but couldn't find any. Because I don't want to pay for one, I'd love to add that functionality with code on my own, so my question is:
Which files do I have to tamper in Magento 2, to add the logic from above (in a future proof way)?
Thanks
ps: If there's a free extension I didn't find, please let me know
ps2: The shipping company prices I'll be using all depend on weight btw, so I may need to add a formula in my code as well
We are using Magento version 1.9.2.3. We have a cart price rules setup based on user's group and product's custom attribute. It sometimes doesn't work. And I am not sure the reason if it. I can't really replicate the issue as it is on and off type of issue.
Users are complaining about it for not getting discounts and i can verify it form their order but if i manually add same order for the specific user then i see the discount.
Has any one experienced this issue. I will really appreciate your help on this
Thanks.
Catalog price rules Need Cron jobs. install this extension and check whether cron is working or not.
if it is working check your Default Store Timezone is matching your server timezone.
credits : #Alexei Yerofeyev
if both timings are same, than Yes, this is a bug in Magento (or some logic beyond my understanding). we had the same problem. When Magento displays products on frontend, it checks if there are catalog rules for this date. And the date used for this check is your local, so in our case it was GMT+5. However, when catalog rules are being applied, it uses GMT date. So that means that we were't able to apply rules until 5 AM.
The problem is in Mage_CatalogRule_Model_Action_Index_Refresh::execute() function. You will have to rewrite this function/class either in your extension, or via the local version of the file.
we replaced line 121:
$timestamp = $coreDate->gmtTimestamp('Today');
with this line:
$timestamp = Mage::app()->getLocale()->date(null, null, null, true)->get(Zend_Date::TIMESTAMP);
After that it worked for us.
if that also didt worked for you, than
using AOE scheduler extension, change catalogrule_apply_all cron expression from 0 1 * * * to 30 */6 * * * and it may work for you.
if possible check the order time that didt applied discount and you may need to find what is exact timings that price rules are not working. Temparary fix is clicking "Apply catalog rules " button again when it was not working.
In one shop we had this issue where sometimes the catalog price rules would not work but most of the time it worked fine (even on the same day or within the same hour for the same product!). It was very hard to reproduce as the catelogrule prices were correct (database table filled with correct dates and product ids and correct prices).
We already made use of an extra extension to make sure the rules were applied everyday and still faced the problem...
But after some weeks we found a pattern: it turns out this only happens when an order is made through the backend/admin. There is a little known bug in Magento that is nicely described in this blog:
http://www.techytalk.info/catalog-price-rules-not-applied-creating-order-magento-admin/
hope it helps someone!
My payment processor confirms that my clients paid the correct amount, while magento (in admin order info) "says" that the order still has a totalDue of 1 cent.
I really want to see how this GETTER: Mage_Sales_Model_Order::getTotalPaid() looks like, but I can not find the implementation.
I do not have a running installation atm, but i assume that totalPaid is just a standard attribute that's retrieved by magentos magic accessor in Varien_Object (__call).
There is no explicit set or get for that kind of variable.
The data is set in Mage_Sales_Model_Order_Invoice::pay(); and/or Mage_Sales_Model_Order_Payment::pay()
The error come from the creation of the invoice, a rounding issue due to tax configuration (tax on quote total instead of tax on each product row).
How could we alert a magento site admin about each abandoned cart immediately after it is abandoned?
Is it a default feature in Magento EE?
No it is not a default feature in Magento EE.
You ask how a site admin could be alerted of an event that is somewhat of a grey area.
Assuming that an abandon cart is defined by the following criteria (which in fact is not the definition but may be applicable to you)
A registered user (ignore guest users for sake of sanity here) has products in cart.
This user does not complete the checkout and leaves the store-front
A period of time goes by (eg 1 day) with no adjustments on the cart items
Assuming this situation is your abandoned cart scenario i could suggest the following :
1.) I would use the Magento Quote Object (this is the object that is converted to an order after a successful checkout.)
looking at the quote object there already seems like there are enough fields to be able to monitor when the quote was created, when it was updated, when it was converted and whether it was converted or not. If the object does not contain the data fields you need there is no reason why you could not extend it. See a sample snapshot :
My (naive) suggestion would be to set up a scheduled job, to run at the same frequency at which you define your "abandoned cart" scenairio (or any frequency for that matter).
The job could do something like the following :
1.) Instantiate a collection of quotes.
2.) Filter out quote's that have been converted
3.) Filter out quote's that have been created recently (less than the critria above)
4.) Filter out quote's that have been modified within the same time-frame criteria
at this point you should have a list of all quote's that have been created, perhaps been updated but not converted for the last 24hours (depending on your criteria of course).
If you get to this point, well then the rest is straight forward.
Extract the information you need from the quotes (id's names, numbers, emails etc), compile your report and email to the administrator.
it the best idea i can think of for now! i have not done this in practice...
Ofcourse you can set-up funnels and goals with Google Analytic to give you extensive information on your customers, including abandoned carts, but that doesn't answer your question.
I'm using magento 1.7, and one of the payment options is Paypal (UK) express checkout.
The problem is that I don't want paypal to send out emails with any tax breakdown on, is there a more straightforward way of solving this (at the Magento or Paypal end) rather than hacking the core module to pass sub+tax as sub and 0 as tax?
I can see that a lot of the fields are mapped in Model/Api/Nvp.php, but can't immediately see where I'd modify these values.
As far as I investigated, there is no easy configurable way to prevent taxes to be submitted to Paypal.
But indeed there is a core hack if you don't mind that only the total amount is submitted (no line items, no taxes).
Go to System/Config/Paypal and set Transfer Cart Line Items to No.
In your code go to function _validate() in class Mage_Paypal_Model_Cart.
At the end of this function add the following lines:
$this->_areItemsValid = false;
$this->_areTotalsValid = false;
Of course it is nicer to to rewrite this class in your app/code/local folder.