Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1. #11
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    184
    Plugin Contributions
    6

    Default Re: Shipping Surcharge [Support Thread]

    Your second problem is due to the fact there is no tax applied but module try to calculate it anyway. Suppressing this line won't work if you want to apply some tax on the surcharge, which is probably the case if you already applied some tax everywhere else.
    You can modify code as follow:
    PHP Code:
              if ($charge_it) {
                
    $tax_address zen_get_tax_locations();
                
    $tax zen_get_tax_rate(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_TAX_CLASS$tax_address['country_id'], $tax_address['zone_id']);

    // calculate from flat fee or percentage
                
    if (substr(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT, -1) == '%') {
                  
    $shipping_surcharge = ($order->info['subtotal'] * ((float)MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT/100));
                } else {
                  
    $shipping_surcharge MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT;
                }
                
    $order->info['total'] += $shipping_surcharge;

                if (
    $tax 0) {
                    
    $tax_description zen_get_tax_description(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_TAX_CLASS$tax_address['country_id'], $tax_address['zone_id']);

                    
    $order->info['tax'] += zen_calculate_tax($shipping_surcharge$tax);
                    
    $order->info['tax_groups'][$tax_description] += zen_calculate_tax($shipping_surcharge$tax);
                    
    $order->info['total'] += zen_calculate_tax($shipping_surcharge$tax);
                    if (
    DISPLAY_PRICE_WITH_TAX == 'true') {
                      
    $shipping_surcharge += zen_calculate_tax($shipping_surcharge$tax);
                    }
                }

                
    $this->output[] = array('title' => $this->title ':',
                                        
    'text' => $currencies->format($shipping_surchargetrue$order->info['currency'], $order->info['currency_value']),
                                        
    'value' => $shipping_surcharge);
              } 

  2. #12
    Join Date
    Apr 2019
    Posts
    290
    Plugin Contributions
    0

    Default Re: Shipping Surcharge [Support Thread]

    Quote Originally Posted by pilou2 View Post
    Your second problem is due to the fact there is no tax applied but module try to calculate it anyway. Suppressing this line won't work if you want to apply some tax on the surcharge, which is probably the case if you already applied some tax everywhere else.
    You can modify code as follow:
    PHP Code:
              if ($charge_it) {
                
    $tax_address zen_get_tax_locations();
                
    $tax zen_get_tax_rate(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_TAX_CLASS$tax_address['country_id'], $tax_address['zone_id']);

    // calculate from flat fee or percentage
                
    if (substr(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT, -1) == '%') {
                  
    $shipping_surcharge = ($order->info['subtotal'] * ((float)MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT/100));
                } else {
                  
    $shipping_surcharge MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT;
                }
                
    $order->info['total'] += $shipping_surcharge;

                if (
    $tax 0) {
                    
    $tax_description zen_get_tax_description(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_TAX_CLASS$tax_address['country_id'], $tax_address['zone_id']);

                    
    $order->info['tax'] += zen_calculate_tax($shipping_surcharge$tax);
                    
    $order->info['tax_groups'][$tax_description] += zen_calculate_tax($shipping_surcharge$tax);
                    
    $order->info['total'] += zen_calculate_tax($shipping_surcharge$tax);
                    if (
    DISPLAY_PRICE_WITH_TAX == 'true') {
                      
    $shipping_surcharge += zen_calculate_tax($shipping_surcharge$tax);
                    }
                }

                
    $this->output[] = array('title' => $this->title ':',
                                        
    'text' => $currencies->format($shipping_surchargetrue$order->info['currency'], $order->info['currency_value']),
                                        
    'value' => $shipping_surcharge);
              } 
    It works! Thanks for your tip!

  3. #13
    Join Date
    Apr 2019
    Posts
    290
    Plugin Contributions
    0

    Default Re: Shipping Surcharge [Support Thread]

    Another issue, but it is not critical to me.

    Under the order-total, there is an option under this surcharge plug-in: Charge a Shipping Surcharge. By default, it is set to true. I checked my checkout page, and the surcharge only applied to the sub-total number. Shipping is not included. But anyway, I don't plan to apply surcharge on the shipping.

    If I set this option to false, surcharge option is missing under the OPC checkout page. If I select different shipping options, the following warning is generated.

    PHP Code:
    [19-Apr-2025 11:30:15 America/New_YorkPHP Fatal errorUncaught TypeErrorcount(): Argument #1 ($value) must be of type Countable|array, null given in /includes/classes/order_total.php:143
    Stack trace:
    #0 /includes/classes/ajax/zcAjaxOnePageCheckout.php(428): order_total->output()
    #1 /includes/classes/ajax/zcAjaxOnePageCheckout.php(92): zcAjaxOnePageCheckout->createOrderTotalHtml()
    #2 /ajax.php(92): zcAjaxOnePageCheckout->updateShippingSelection()
    #3 {main}
    thrown in /includes/classes/order_total.php on line 143

    [19-Apr-2025 11:30:15 America/New_YorkRequest URI: /ajax.php?act=ajaxOnePageCheckout&method=updateShippingSelectionIP addressxxxx
    --> PHP Fatal errorUncaught TypeErrorcount(): Argument #1 ($value) must be of type Countable|array, null given in /includes/classes/order_total.php:143
    Stack trace:
    #0 /includes/classes/ajax/zcAjaxOnePageCheckout.php(428): order_total->output()
    #1 /includes/classes/ajax/zcAjaxOnePageCheckout.php(92): zcAjaxOnePageCheckout->createOrderTotalHtml()
    #2 /ajax.php(92): zcAjaxOnePageCheckout->updateShippingSelection()
    #3 {main}
    thrown in /includes/classes/order_total.php on line 143. 
    Line 143 in order_total.php is the following in my code:

    PHP Code:
     $size count($GLOBALS[$class]->output); 

  4. #14
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    184
    Plugin Contributions
    6

    Default Re: Shipping Surcharge [Support Thread]

    The option you set to false is the one that activates the shipping surcharge... Which is why it does not appear anymore in checkout page. I know some other modules have an option to include shipping fee in calcuation at this place, but this one does not. There are few weird things in this module, if I have time, I might rewrite it.

    Your log is an OPC problem, I have seen the same here, but there was no answer due to a lack of information from poster.

  5. #15
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    184
    Plugin Contributions
    6

    Default Re: Shipping Surcharge [Support Thread]

    I submitted an updated version in plugins section here. It should be available in few days.

    The OPC log above might be link to the fact the module was always activated even when calculation is de-activated by the option 'Charge a Shipping Surcharge'.

  6. #16
    Join Date
    Apr 2019
    Posts
    290
    Plugin Contributions
    0

    Default Re: Shipping Surcharge [Support Thread]

    Thanks for your help and contribution! I will try the new plug-in when it is available and let you know.

    This plug-in will benefit many sellers under the current tariff condition...

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v157 USPS Shipping Module [Support Thread]
    By lat9 in forum Addon Shipping Modules
    Replies: 439
    Last Post: 20 Feb 2025, 03:33 PM
  2. Shipping Rates in Cart [support thread]
    By Steven300 in forum Addon Shipping Modules
    Replies: 95
    Last Post: 12 May 2023, 02:39 AM
  3. Add Shipping Telephone Support Thread
    By JTheed in forum Addon Admin Tools
    Replies: 31
    Last Post: 4 Sep 2018, 11:14 AM
  4. Free Shipping Rules addon [Support Thread]
    By numinix in forum Addon Shipping Modules
    Replies: 36
    Last Post: 2 Dec 2016, 01:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR