djcaseanova Posted March 20, 2015 Share Posted March 20, 2015 Is there a way I can add a calculated formula so that it would show the PayPal fee deduction on the order summary page? I keep track of my items in quickbooks and it's a hassle having to go back and forth between cubecart and paypal to gather everything I need to insert into my bookkeeping. Anyone?? Much appreciated! Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 20, 2015 Share Posted March 20, 2015 I can help getting whatever you need to display on whatever page you want, but I don't do PayPal, so I wouldn't know what to start with. Quote Link to comment Share on other sites More sharing options...
djcaseanova Posted March 21, 2015 Author Share Posted March 21, 2015 Basically I need it to display a math function. paypal takes .30 per transaction plus 2.5% of total. So I need to figure out how to get the math done and displayed so when I print out the packing slips in the admin order thing for my records its there. I'll get exact figures tomorrow. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 21, 2015 Share Posted March 21, 2015 For now, in the admin template file orders.index.php, make this edit: Find near line 181: <fieldset class="other"><legend>{$LANG.orders.title_shipping}</legend> <div><label>{$LANG.orders.shipping_date}</label><span>{$OVERVIEW_SUMMARY.ship_date}</span></div> <div><label>{$LANG.orders.shipping_method}</label><span>{$OVERVIEW_SUMMARY.ship_method}</span></div> <div><label>{$LANG.orders.shipping_tracking}</label><span>{$OVERVIEW_SUMMARY.ship_tracking}</span></div> <div><label>{$LANG.orders.gateway_name}</label><span>{$OVERVIEW_SUMMARY.gateway}</span></div> Add AFTER: {* NEW *} <div><label>Gateway Charges (est.)</label><span>{$OVERVIEW_SUMMARY.total} * 0.025 + 0.30</span></div> {* NEW *} This will display 2.5% of the total, plus 0.30. If you are happy with how this works, then a similar edit to the template file orders.print.php will be next. Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted March 21, 2015 Share Posted March 21, 2015 Basically I need it to display a math function. paypal takes .30 per transaction plus 2.5% of total. So I need to figure out how to get the math done and displayed so when I print out the packing slips in the admin order thing for my records its there. I'll get exact figures tomorrow. Would it not be better to get the PayPal gateway to return the fees taken (it may already - havent checked) and then display the actual figure - the information is certainly available. More useful to others and more accurate especially if the percentage or fixed charge ever changes Ian Quote Link to comment Share on other sites More sharing options...
ayz1 Posted March 21, 2015 Share Posted March 21, 2015 You could export your orders into a spreadsheet and calculate them all in one go. Depending on how many orders you have it could save time that way. Quote Link to comment Share on other sites More sharing options...
djcaseanova Posted March 21, 2015 Author Share Posted March 21, 2015 For now, in the admin template file orders.index.php, make this edit: Find near line 181: <fieldset class="other"><legend>{$LANG.orders.title_shipping}</legend> <div><label>{$LANG.orders.shipping_date}</label><span>{$OVERVIEW_SUMMARY.ship_date}</span></div> <div><label>{$LANG.orders.shipping_method}</label><span>{$OVERVIEW_SUMMARY.ship_method}</span></div> <div><label>{$LANG.orders.shipping_tracking}</label><span>{$OVERVIEW_SUMMARY.ship_tracking}</span></div> <div><label>{$LANG.orders.gateway_name}</label><span>{$OVERVIEW_SUMMARY.gateway}</span></div> Add AFTER: {* NEW *} <div><label>Gateway Charges (est.)</label><span>{$OVERVIEW_SUMMARY.total} * 0.025 + 0.30</span></div> {* NEW *} This will display 2.5% of the total, plus 0.30. If you are happy with how this works, then a similar edit to the template file orders.print.php will be next. It's a good first attempt. The math equation did not work. It's showing the total and the math equation, not the actual calculation. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 21, 2015 Share Posted March 21, 2015 Yup, first attempt. The suggested equation: <span>{$OVERVIEW_SUMMARY.total} * 0.025 + 0.30</span> Now suggest: <span>{$OVERVIEW_SUMMARY.total * 0.025 + 0.30}</span> Quote Link to comment Share on other sites More sharing options...
djcaseanova Posted March 21, 2015 Author Share Posted March 21, 2015 Yup, first attempt. The suggested equation: <span>{$OVERVIEW_SUMMARY.total} * 0.025 + 0.30</span> Now suggest: <span>{$OVERVIEW_SUMMARY.total * 0.025 + 0.30}</span> Didn't work. This time, the display says 0.3 for the total. Which is incorrect. The fee for this total I am working with should read $2.19 Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 21, 2015 Share Posted March 21, 2015 That's weird. It's like $OVERVIEW_SUMMARY.total is zero. More testing. Quote Link to comment Share on other sites More sharing options...
djcaseanova Posted March 21, 2015 Author Share Posted March 21, 2015 I attached a pic just in case it helps.... It's a screenshot of the display. I don't know enough about programming equations and functions to help much. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 21, 2015 Share Posted March 21, 2015 That's because the programmers decided to send $OVERVIEW_SUMMARY.total as a "currency formatted" string (boo!), which then needs to have any non-numeric character stripped off in order for it to be used in a math equation. But, luckily, there is also $SUMMARY.total which is a non-formatted string, and which can easily be used in an equation. So, try: <span>{$SUMMARY.total * 0.025 + 0.30}</span> in the equation. Unfortunately, the programmers did not give to the templates the currency symbols. So, you can hard-code a $ or leave it as a raw number. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 21, 2015 Share Posted March 21, 2015 This makes a nice, formatted output:<span>{TAX::getInstance()->priceFormat($SUMMARY.total * 0.025 + 0.30, true, true)}</span> Quote Link to comment Share on other sites More sharing options...
djcaseanova Posted March 21, 2015 Author Share Posted March 21, 2015 Perfecto! That did the job and looks nice. BUT.... It's not working on the orders.print.ph, it's showing $0.30 Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 21, 2015 Share Posted March 21, 2015 It could either be that you didn't adjust for the name of the variable in this template:$order.total instead of $SUMMARY.total, or$order.total is a string and we don't have a non-formatted value as a substitute. Testing... Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 21, 2015 Share Posted March 21, 2015 $order.total is a currency formatted string and we don't have a non-formatted substitute. Let me try to get Smarty coding to do what a private function in the Tax class does. Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 21, 2015 Share Posted March 21, 2015 Ok:Find: <div><label>{$LANG.orders.gateway_name}</label><span>{$order.gateway}</span></div> Add AFTER: <div><label>Gateway Charges (est.)</label><span>{TAX::getInstance()->priceFormat($order.total|regex_replace:"/[^0-9.]/":"" * 0.025 + 0.30)}</span></div> Quote Link to comment Share on other sites More sharing options...
djcaseanova Posted March 22, 2015 Author Share Posted March 22, 2015 That got it! Thanks so much... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.