Module FedEx pour proposer le suivi du colis par FedEx + l'envoi d'un mail avec l'URL de suivi.
This commit is contained in:
@@ -13,16 +13,16 @@ use Thelia\Module\Exception\DeliveryException;
|
||||
|
||||
class FedEx extends AbstractDeliveryModule
|
||||
{
|
||||
const DOMAIN_NAME = 'fedex';
|
||||
|
||||
protected $request;
|
||||
protected $dispatcher;
|
||||
const TRACKING_URL = 'tracking_url';
|
||||
|
||||
const TRACKING_URL_PARAMETER = 'tracking_url';
|
||||
const DEFAULT_TRACKING_URL = "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=";
|
||||
private static $prices = null;
|
||||
|
||||
const JSON_PRICE_RESOURCE = "/Config/prices.json";
|
||||
|
||||
const DOMAIN_NAME = 'fedex';
|
||||
|
||||
public static function getPrices()
|
||||
{
|
||||
if (null === self::$prices) {
|
||||
@@ -34,7 +34,7 @@ class FedEx extends AbstractDeliveryModule
|
||||
|
||||
public function postActivation(ConnectionInterface $con = null)
|
||||
{
|
||||
self::setConfigValue(FedExConfigValue::TRACKING_URL, "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=");
|
||||
self::setConfigValue(FedEx::TRACKING_URL_PARAMETER, FedEx::DEFAULT_TRACKING_URL);
|
||||
|
||||
$database = new Database($con);
|
||||
$database->insertSql(null, array(__DIR__ . '/Config/thelia.sql'));
|
||||
@@ -43,10 +43,6 @@ class FedEx extends AbstractDeliveryModule
|
||||
|
||||
public function isValidDelivery(Country $country, State $state = null)
|
||||
{
|
||||
if (0 == self::getConfigValue(FedExConfigValue::ENABLED, 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null !== $area = $this->getAreaForCountry($country, $state)) {
|
||||
$areaId = $area->getId();
|
||||
|
||||
@@ -144,20 +140,4 @@ class FedEx extends AbstractDeliveryModule
|
||||
return $postage;
|
||||
}
|
||||
|
||||
public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
|
||||
{
|
||||
$uploadDir = __DIR__ . '/Config/prices.json';
|
||||
|
||||
// $database = new Database($con);
|
||||
// $tableExists = $database->execute("SHOW TABLES LIKE 'FedEx_freeshipping'")->rowCount();
|
||||
// if (FedEx::getConfigValue(FedExConfigValue::FREE_SHIPPING, null) == null && $tableExists) {
|
||||
// $result = $database->execute('SELECT active FROM FedEx_freeshipping WHERE id=1')->fetch()["active"];
|
||||
// FedEx::setConfigValue(FedExConfigValue::FREE_SHIPPING, $result);
|
||||
// $database->execute("DROP TABLE `FedEx_freeshipping`");
|
||||
// }
|
||||
|
||||
if (is_readable($uploadDir) && FedEx::getConfigValue(FedExConfigValue::PRICES, null) == null) {
|
||||
FedEx::setConfigValue(FedExConfigValue::PRICES, file_get_contents($uploadDir));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user