public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null) { if (Module::isInstalled('agilesellershipping') and Module::isInstalled('agilemultipleseller')) { return $this->getPackageShippingCost(null, $use_tax); } else { return parent::getTotalShippingCost($delivery_option, $use_tax, $default_country); } }
public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null) { include_once dirname(__FILE__) . '/../../modules/gointerpay/gointerpay.php'; $interpay = new GoInterpay(); if (!$interpay->active || Context::getContext()->cookie->interpay_country_code == 'US') { return parent::getTotalShippingCost($delivery_option, $use_tax, $default_country); } else { $interpay_order = Db::getInstance()->getRow(' SELECT orderId, shipping_orig FROM ' . _DB_PREFIX_ . 'gointerpay_order_id WHERE id_cart = ' . (int) $this->id); if ($interpay_order && isset($interpay_order['orderId']) && !empty($interpay_order['orderId'])) { return (double) $interpay_order['shipping_orig']; } else { return 0; } } }
/** * @brief Calculate the shipping cost. * * Override it in order to calculate and add the correct tax amount. * * @note This method is only called in PrestaShop > 1.5 * @see Cart::getOrderShippingCost() for PrestaShop < 1.5 * * @param Array $delivery_option Delivery options * @param boolean $use_tax Do we want the taxes? * @param Country $default_country Default country (1.5 only) * * @return float Price of the shipping. */ public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null) { include_once _PS_ROOT_DIR_ . '/modules/avalaratax/avalaratax.php'; /* Instanciate the Avalara module and check if active */ $avalara = new AvalaraTax(); if (!$avalara->active) { return parent::getTotalShippingCost($delivery_option, $use_tax, $default_country); } /* Retrieve the original carrier fee tax excluded */ $tax_excluded_cost = parent::getTotalShippingCost($delivery_option, false, $default_country); /* If we want price without tax or if this carrier is tax free, return this price */ if (!(int) $this->{Configuration::get('PS_TAX_ADDRESS_TYPE')} || !$use_tax) { return $tax_excluded_cost; } /* If there is no cache or cache expired, we regenerate it */ if (CacheTools::checkCarrierCache($this)) { $region = Db::getInstance()->getValue(' SELECT s.`iso_code` FROM ' . _DB_PREFIX_ . 'address a LEFT JOIN ' . _DB_PREFIX_ . 'state s ON (s.`id_state` = a.`id_state`) WHERE a.`id_address` = ' . (int) $this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); CacheTools::updateCarrierTax($avalara, $this, $this->{Configuration::get('PS_TAX_ADDRESS_TYPE')}, $region); } /* If we do already know it, then return it */ return $tax_excluded_cost + (double) CacheTools::getCarrierTaxAmount($this); }