Skip to content

Commit

Permalink
Add description and estimated time delivery to checkout rates (#34)
Browse files Browse the repository at this point in the history
* Update to version 2.4.1. Add description and estimated time delivery to checkout rates

---------

Co-authored-by: mjourneault <mjourneault@gmail.com>
Co-authored-by: mjourneault-novatize <76133439+mjourneault-novatize@users.noreply.github.com>
Co-authored-by: o.boulahsen <o.boulahsen@novatize.com>
Co-authored-by: Ricky Rivera <9152+ricky@users.noreply.github.com>
  • Loading branch information
5 people authored May 17, 2023
1 parent ce49b66 commit 51d6fd5
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 4 deletions.
31 changes: 29 additions & 2 deletions Api/Model/Carrier/Shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,41 @@ protected function _createShippingMethod ($shipStationMethod)
$method->setCarrier($this->_code);
$method->setCarrierTitle($this->getConfigData('title'));
$method->setMethod($shipStationMethod->code);
$method->setMethodTitle($shipStationMethod->display_name);
$method->setMethodDescription($shipStationMethod->display_name);
$method->setMethodTitle($this->formatShippingMethodTitle($shipStationMethod));
$method->setMethodDescription($shipStationMethod->description ?? '');
$shippingCost = (float)$shipStationMethod->cost->amount;
$method->setPrice($shippingCost);
$method->setCost($shippingCost);
return $method;
}

/**
* @param $shipStationMethod
* @return string
*/
protected function formatShippingMethodTitle($shipStationMethod)
{
$displayName = $shipStationMethod->display_name;
if(isset($shipStationMethod->min_transit_days) || isset($shipStationMethod->max_transit_days)){
$displayName .= ", ";
if(isset($shipStationMethod->min_transit_days) && isset($shipStationMethod->max_transit_days)){
$displayName .= sprintf("%s - %s", $shipStationMethod->min_transit_days, $shipStationMethod->max_transit_days);
}else{
if(isset($shipStationMethod->min_transit_days)){
$displayName .= sprintf("min %s", $shipStationMethod->min_transit_days);
}
if(isset($shipStationMethod->max_transit_days)){
$displayName .= sprintf("max %s", $shipStationMethod->max_transit_days);
}
}
$displayName .= " estimated transit days";
}
if(isset($shipStationMethod->description)){
$displayName .= ', ' . $shipStationMethod->description;
}
return $displayName;
}

/**
* Returns an object formatted for a ShipStation rates request
*
Expand Down
2 changes: 1 addition & 1 deletion Api/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "auctane/api",
"description": "ShipStation is a web-based shipping solution that is integrated with the Magento API for retrieving order information and updating shipping details.",
"version": "2.4.0",
"version": "2.4.1",
"type": "magento2-module",
"license": [
"OSL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion Api/etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Auctane_Api" setup_version="2.4.0">
<module name="Auctane_Api" setup_version="2.4.1">
</module>
</config>
1 change: 1 addition & 0 deletions Api/i18n/de_DE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
"The ShipStation Shipping Rates plugin has been installed but not configured. Please log in to ShipStation and configure Magento from there. This message can be removed by disabling ShipStation in the Shipping Methods configuration.","Das ShipStation Shipping Rates-Plugin wurde installiert, aber nicht konfiguriert. Bitte loggen Sie sich bei ShipStation ein und konfigurieren Sie Magento von dort aus. Diese Nachricht kann durch Deaktivieren von ShipStation in der Versandmethodenkonfiguration entfernt werden."
"Order '%1' does not exist","Auftrag '%1' existiert nicht"
"Shipment can not be created for Order : %1","Sendung kann nicht erstellt werden für Bestellung: %1"
"estimated transit days","geschätzte Transittage"
1 change: 1 addition & 0 deletions Api/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
"The ShipStation Shipping Rates plugin has been installed but not configured. Please log in to ShipStation and configure Magento from there. This message can be removed by disabling ShipStation in the Shipping Methods configuration.","The ShipStation Shipping Rates plugin has been installed but not configured. Please log in to ShipStation and configure Magento from there. This message can be removed by disabling ShipStation in the Shipping Methods configuration."
"Order '%1' does not exist","Order '%1' does not exist"
"Shipment can not be created for Order : %1","Shipment can not be created for Order : %1"
"estimated transit days","estimated transit days"
1 change: 1 addition & 0 deletions Api/i18n/es_MX.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
"The ShipStation Shipping Rates plugin has been installed but not configured. Please log in to ShipStation and configure Magento from there. This message can be removed by disabling ShipStation in the Shipping Methods configuration.","El complemento de tarifas de envío de ShipStation se ha instalado pero no se ha configurado. Inicie sesión en ShipStation y configure Magento desde allí. Este mensaje se puede eliminar desactivando ShipStation en la configuración de Métodos de envío."
"Order '%1' does not exist","El pedido '% 1' no existe"
"Shipment can not be created for Order : %1","No se puede crear el envío para el pedido:% 1"
"estimated transit days","días de tránsito estimados"
1 change: 1 addition & 0 deletions Api/i18n/fr_CA.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
"The ShipStation Shipping Rates plugin has been installed but not configured. Please log in to ShipStation and configure Magento from there. This message can be removed by disabling ShipStation in the Shipping Methods configuration.","Le module ShipStation Shippinh Rates est installé mais n'est pas configuré. Veuillez configurer Magento à partir du panneau d'administration de ShipStation. Pour retirer ce message veuillez désactiver ShipStation dans les méthodes de livraison."
"Order '%1' does not exist","La commande '%1' n'existe pas."
"Shipment can not be created for Order : %1","L'expédition n'a pu être créée pour la commande : %1"
"estimated transit days","jours de transit estimés"
1 change: 1 addition & 0 deletions Api/i18n/fr_FR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
"The ShipStation Shipping Rates plugin has been installed but not configured. Please log in to ShipStation and configure Magento from there. This message can be removed by disabling ShipStation in the Shipping Methods configuration.",""
"Order '%1' does not exist","La commande '%1' n'existe pas."
"Shipment can not be created for Order : %1","L'expédition n'a pu être créée pour la commande : %1"
"estimated transit days","jours de transit estimés"

0 comments on commit 51d6fd5

Please sign in to comment.