Jump to content

ADMIN: Add PayPal fees to order summary page


djcaseanova

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>
 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...