Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Shipping Cost

 
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 02-16-2018, 05:46 AM
 
gzervas1976 gzervas1976 is offline
    
Join Date: Feb 2018
Posts: 1
 

Default Shipping Cost

Hello,

is it possible to get the shipping cost of an order in the #checkoutSuccess# ?

I get the total cost like this {{ this.order.getOrderNumber() }} how I can get the shipping cost?

Thank you

I use the X-Cart Business 5.3.4.5
__________________
Xcart 4.9
Xcart 5
Reply With Quote
  #2  
Old 02-19-2018, 07:38 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Shipping Cost

The shipping cost is just an extra sum stored for the order along with other sums like taxes, handling fees and so on. For each such a sum there is a database row, but there is no ready-made method that would distinct between the rows and return the shipping cost only.

However, it is possible to get the shipping cost from a custom module. Here is the code that the PayPal module uses to pass that value to PayPal servers:
PHP Code:
protected function getShippingCost($order)
    {
        
$result null;

        
$shippingModifier $order->getModifier(\XLite\Model\Base\Surcharge::TYPE_SHIPPING'SHIPPING');

        if (
$shippingModifier && $shippingModifier->canApply()) {
            
/** @var \XLite\Model\Currency $currency */
            
$currency $order->getCurrency();

            
$result $currency->roundValue(
                
$order->getSurchargeSumByType(\XLite\Model\Base\Surcharge::TYPE_SHIPPING)
            );
        }

        return 
$result;
    } 

So, first of all you should find what widget class provides methods to the template where you want the shipping cost to be displayed.
Then you "decorate" that class from your custom module, add the above method and call this method from your custom template.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:08 PM.

   

 
X-Cart forums © 2001-2020