Version Notes
- Able to edit delivery estimated time text
- Volume dimensions default values
- API credentials validation
- Backup tables
Download this release
Release Info
| Developer | Intelipost |
| Extension | Intelipost |
| Version | 1.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.0.1 to 1.1.0
- app/code/local/Intelipost/Shipping/Block/Import.php +91 -0
- app/code/local/Intelipost/Shipping/Model/Carrier/Intelipost.php +111 -20
- app/code/local/Intelipost/Shipping/Model/Config/Apikey.php +2 -1
- app/code/local/Intelipost/Shipping/Model/Config/Token.php +13 -0
- app/code/local/Intelipost/Shipping/Model/Config/Useraccount.php +13 -0
- app/code/local/Intelipost/Shipping/etc/config.xml +15 -0
- app/code/local/Intelipost/Shipping/etc/system.xml +70 -4
- app/locale/pt_BR/Intelipost_Shipping.csv +43 -31
- package.xml +9 -6
app/code/local/Intelipost/Shipping/Block/Import.php
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Intelipost_Shipping_Block_Import extends Mage_Adminhtml_Block_System_Config_Form_Field
|
| 4 |
+
{
|
| 5 |
+
public function curl_get_contents_git($url)
|
| 6 |
+
{
|
| 7 |
+
$curl = curl_init($url);
|
| 8 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
| 9 |
+
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
|
| 10 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
| 11 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
| 12 |
+
$data = curl_exec($curl);
|
| 13 |
+
curl_close($curl);
|
| 14 |
+
return $data;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
| 18 |
+
{
|
| 19 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 20 |
+
|
| 21 |
+
$app_url = Mage::helper("adminhtml")->getUrl("/system_config/edit/section/carriers", array());
|
| 22 |
+
|
| 23 |
+
if(isset($_GET['valAction']) && trim($_GET['valAction']) != '') {
|
| 24 |
+
|
| 25 |
+
$filename = trim($_GET['valAction']);
|
| 26 |
+
|
| 27 |
+
$filedata = $this->curl_get_contents_git('https://raw.githubusercontent.com/intelipost/fallback-tables/master/'.$filename.'.json');
|
| 28 |
+
|
| 29 |
+
if($filedata != '' && $filedata != 'Not Found') {
|
| 30 |
+
$root_dir_path = Mage::getBaseDir();
|
| 31 |
+
$media_dir_path = $root_dir_path.DIRECTORY_SEPARATOR.'media';
|
| 32 |
+
|
| 33 |
+
$intelipost_dir_path = $media_dir_path.DIRECTORY_SEPARATOR.'intelipost';
|
| 34 |
+
if (!is_dir($intelipost_dir_path)) { mkdir($intelipost_dir_path); }
|
| 35 |
+
|
| 36 |
+
$filepath = $intelipost_dir_path.DIRECTORY_SEPARATOR.$filename.".json";
|
| 37 |
+
$fh = fopen($filepath, 'w') or die("can't open file");
|
| 38 |
+
|
| 39 |
+
fwrite($fh, $filedata);
|
| 40 |
+
fclose($fh);
|
| 41 |
+
|
| 42 |
+
if($filename != 'state_codification') {
|
| 43 |
+
$filedata = $this->curl_get_contents_git('https://raw.githubusercontent.com/intelipost/fallback-tables/master/state_codification.json');
|
| 44 |
+
|
| 45 |
+
$filepath = $intelipost_dir_path.DIRECTORY_SEPARATOR."state_codification.json";
|
| 46 |
+
$fh = fopen($filepath, 'w') or die("can't open file");
|
| 47 |
+
|
| 48 |
+
fwrite($fh, $filedata);
|
| 49 |
+
fclose($fh);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
$message = $this->__('"'.$filename.'" file has been imported successfully.');
|
| 53 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
| 54 |
+
}else{
|
| 55 |
+
$message = $this->__('"'.$filename.'" file have not found in Github fallback repository.');
|
| 56 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
header("location:".$app_url);
|
| 60 |
+
exit;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
echo("<script>
|
| 64 |
+
function importFunction() {
|
| 65 |
+
var nmFile = document.getElementById('carriers_intelipost_table_name').value;
|
| 66 |
+
if(nmFile == ''){
|
| 67 |
+
alert('Please enter a fallback filename.');
|
| 68 |
+
document.getElementById('carriers_intelipost_table_name').focus();
|
| 69 |
+
return false;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
setLocation('".$app_url."?valAction='+nmFile);
|
| 73 |
+
return true;
|
| 74 |
+
}
|
| 75 |
+
</script>");
|
| 76 |
+
|
| 77 |
+
$originalData = $element->getOriginalData();
|
| 78 |
+
$this->setElement($element);
|
| 79 |
+
|
| 80 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
| 81 |
+
->setType('button')
|
| 82 |
+
->setClass('scalable')
|
| 83 |
+
->setLabel(Mage::helper('intelipost')->__($originalData['button_label']))
|
| 84 |
+
->setOnClick("return importFunction()")
|
| 85 |
+
->toHtml();
|
| 86 |
+
|
| 87 |
+
return $html;
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
?>
|
app/code/local/Intelipost/Shipping/Model/Carrier/Intelipost.php
CHANGED
|
@@ -76,7 +76,9 @@ class Intelipost_Shipping_Model_Carrier_Intelipost
|
|
| 76 |
// if notification is disabled we send the request anyways (changed on version 0.0.2)
|
| 77 |
$dimension_check = $this->getConfigData('notification');
|
| 78 |
|
| 79 |
-
$i=0;
|
|
|
|
|
|
|
| 80 |
foreach ($item_list as $item) {
|
| 81 |
$product = $item->getProduct();
|
| 82 |
|
|
@@ -84,11 +86,15 @@ class Intelipost_Shipping_Model_Carrier_Intelipost
|
|
| 84 |
$volume->volume_type = 'BOX';
|
| 85 |
|
| 86 |
if (!$this->isDimensionSet($product)) {
|
| 87 |
-
Mage::log('Product does not have dimensions set', null, 'intelipost.log', true);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
if ($dimension_check) {
|
| 90 |
$this->notifyProductsDimension($item_list);
|
| 91 |
-
return false;
|
| 92 |
}
|
| 93 |
} else {
|
| 94 |
$volume->width = $product->getVolumeLargura();
|
|
@@ -97,31 +103,115 @@ class Intelipost_Shipping_Model_Carrier_Intelipost
|
|
| 97 |
}
|
| 98 |
|
| 99 |
$volume->weight = number_format(floatval($item->getWeight()), 2, ',', '') * $item->getQty();
|
|
|
|
| 100 |
$volume->cost_of_goods = number_format(floatval($item->getPrice()), 2, ',', '') * $item->getQty();
|
| 101 |
|
| 102 |
array_push($quote->volumes, $volume);
|
| 103 |
}
|
| 104 |
-
|
| 105 |
-
|
| 106 |
|
| 107 |
// INTELIPOST QUOTE
|
| 108 |
$responseBody = $this->intelipostRequest($api_url, $api_key, "/quote", $request);
|
| 109 |
$response = json_decode($responseBody);
|
| 110 |
$result = Mage::getModel('shipping/rate_result');
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
return $result;
|
| 127 |
}
|
|
@@ -220,11 +310,12 @@ class Intelipost_Shipping_Model_Carrier_Intelipost
|
|
| 220 |
*/
|
| 221 |
private function intelipostRequest($api_url, $api_key, $entity_action, $request=false)
|
| 222 |
{
|
|
|
|
| 223 |
$s = curl_init();
|
| 224 |
|
| 225 |
-
curl_setopt($s, CURLOPT_TIMEOUT,
|
| 226 |
curl_setopt($s, CURLOPT_URL, $api_url.$entity_action);
|
| 227 |
-
curl_setopt($s, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Accept: application/json", "api_key: $api_key"));
|
| 228 |
curl_setopt($s, CURLOPT_POST, true);
|
| 229 |
curl_setopt($s, CURLOPT_ENCODING , "");
|
| 230 |
curl_setopt($s, CURLOPT_RETURNTRANSFER, 1);
|
| 76 |
// if notification is disabled we send the request anyways (changed on version 0.0.2)
|
| 77 |
$dimension_check = $this->getConfigData('notification');
|
| 78 |
|
| 79 |
+
$i = 0;
|
| 80 |
+
$total_weight = 0;
|
| 81 |
+
|
| 82 |
foreach ($item_list as $item) {
|
| 83 |
$product = $item->getProduct();
|
| 84 |
|
| 86 |
$volume->volume_type = 'BOX';
|
| 87 |
|
| 88 |
if (!$this->isDimensionSet($product)) {
|
| 89 |
+
//Mage::log('Product does not have dimensions set', null, 'intelipost.log', true);
|
| 90 |
+
|
| 91 |
+
$volume->width = $this->getConfigData('largura_padrao'); // putting default config values here if product width is empty
|
| 92 |
+
$volume->height = $this->getConfigData('altura_padrao'); // putting default config values here if product height is empty
|
| 93 |
+
$volume->length = $this->getConfigData('comprimento_padrao'); // putting default config values here if product length is empty
|
| 94 |
|
| 95 |
if ($dimension_check) {
|
| 96 |
$this->notifyProductsDimension($item_list);
|
| 97 |
+
//return false;
|
| 98 |
}
|
| 99 |
} else {
|
| 100 |
$volume->width = $product->getVolumeLargura();
|
| 103 |
}
|
| 104 |
|
| 105 |
$volume->weight = number_format(floatval($item->getWeight()), 2, ',', '') * $item->getQty();
|
| 106 |
+
$total_weight += number_format(floatval($item->getWeight()), 2, ',', '') * $item->getQty();
|
| 107 |
$volume->cost_of_goods = number_format(floatval($item->getPrice()), 2, ',', '') * $item->getQty();
|
| 108 |
|
| 109 |
array_push($quote->volumes, $volume);
|
| 110 |
}
|
| 111 |
+
|
| 112 |
+
$request = json_encode($quote);
|
| 113 |
|
| 114 |
// INTELIPOST QUOTE
|
| 115 |
$responseBody = $this->intelipostRequest($api_url, $api_key, "/quote", $request);
|
| 116 |
$response = json_decode($responseBody);
|
| 117 |
$result = Mage::getModel('shipping/rate_result');
|
| 118 |
|
| 119 |
+
if($response->content->delivery_options) { // if api responds fine
|
| 120 |
+
foreach ($response->content->delivery_options as $deliveryOption) {
|
| 121 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
| 122 |
+
|
| 123 |
+
//$method_deadline = $this->formatDeadline((int)$deliveryOption->delivery_estimate_business_days);
|
| 124 |
+
//$method_description = $deliveryOption->description." ".$method_deadline;
|
| 125 |
+
|
| 126 |
+
$custom_title = $this->getConfigData('customizetitle'); // new way of creating shipping labels point 3
|
| 127 |
+
$method_description = sprintf($custom_title, $deliveryOption->description, (int)$deliveryOption->delivery_estimate_business_days); // new way of creating shipping labels point 3
|
| 128 |
+
|
| 129 |
+
$method->setCarrier ('intelipost');
|
| 130 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
| 131 |
+
$method->setMethod ($deliveryOption->description);
|
| 132 |
+
$method->setMethodTitle ($method_description);
|
| 133 |
+
$method->setPrice ($deliveryOption->final_shipping_cost);
|
| 134 |
+
$method->setCost ($deliveryOption->provider_shipping_cost);
|
| 135 |
+
|
| 136 |
+
$result->append($method);
|
| 137 |
+
}
|
| 138 |
+
}else{ // else if API call fails or reponse in more then 3 seconds
|
| 139 |
+
|
| 140 |
+
$shipping_price = ''; // defining shipping price
|
| 141 |
+
$number_of_days = ''; // defining number_of_days to deliver
|
| 142 |
+
|
| 143 |
+
$root_dir_path = Mage::getBaseDir();
|
| 144 |
+
$media_dir_path = $root_dir_path.DIRECTORY_SEPARATOR.'media';
|
| 145 |
+
|
| 146 |
+
$intelipost_dir_path = $media_dir_path.DIRECTORY_SEPARATOR.'intelipost';
|
| 147 |
+
$filepath = $intelipost_dir_path.DIRECTORY_SEPARATOR."state_codification.json";
|
| 148 |
+
|
| 149 |
+
if (file_exists($filepath)) { // check if file exists locally
|
| 150 |
+
|
| 151 |
+
$c_state = ''; $c_type = ''; // defining empty variables for state and type
|
| 152 |
+
|
| 153 |
+
$intZipCode = (int)$destinationZipCode; // Transform ZIP code from string => numeric
|
| 154 |
+
|
| 155 |
+
$c_weight = $total_weight*1000; // converting total weight of quote into grams
|
| 156 |
+
|
| 157 |
+
$state_codification = json_decode(file_get_contents($filepath)); // load state_codification.json as array
|
| 158 |
+
|
| 159 |
+
$intArray = array(); // Defining a new array for integer values
|
| 160 |
+
foreach($state_codification[0] as $key => $value) {
|
| 161 |
+
$intArray[(int)$key] = $value; // Transform keys of array from string => numeric
|
| 162 |
+
}
|
| 163 |
+
asort($intArray); // Sort the keys of the array ascending
|
| 164 |
+
|
| 165 |
+
foreach($intArray as $key => $value) {
|
| 166 |
+
if(($intZipCode > $key) && ($intZipCode < (int)$value->cep_end)) {
|
| 167 |
+
$c_state = trim($value->state); // assigning value of state here if found
|
| 168 |
+
$c_type = ucfirst(strtolower($value->type)); // assigning value of type here if found
|
| 169 |
+
break;
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
if($c_state != '' && $c_type != '') { // if state and type are found
|
| 174 |
+
|
| 175 |
+
$filepath = $intelipost_dir_path.DIRECTORY_SEPARATOR."esedex.sp.json";
|
| 176 |
+
if (file_exists($filepath)) { // check if file exists locally
|
| 177 |
+
$esedex = json_decode(file_get_contents($filepath)); // Load configured backup table: e.g. esedex.sp.json
|
| 178 |
+
|
| 179 |
+
$number_of_days = $esedex->$c_state->$c_type->delivery_estimate_business_days;
|
| 180 |
+
foreach($esedex->$c_state->$c_type->final_shipping_cost as $key => $value) {
|
| 181 |
+
if(($key > $c_weight) && !isset($last_v)) {
|
| 182 |
+
$shipping_price = $value;
|
| 183 |
+
break;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
if($key > $c_weight) {
|
| 187 |
+
$shipping_price = $last_v;
|
| 188 |
+
break;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
$last_k = $key; // saving -1 key
|
| 192 |
+
$last_v = $value; // saving value for -1 key
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
}
|
| 199 |
+
if($shipping_price != '' && $number_of_days != '') {
|
| 200 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
| 201 |
+
|
| 202 |
+
$custom_title = $this->getConfigData('customizetitle'); // new way of creating shipping labels point 3
|
| 203 |
+
$method_description = sprintf($custom_title, "Entrega", (int)$number_of_days); // new way of creating shipping labels point 3
|
| 204 |
+
|
| 205 |
+
$method->setCarrier ('intelipost');
|
| 206 |
+
$method->setCarrierTitle('Intelipost');
|
| 207 |
+
$method->setMethod ("Entrega");
|
| 208 |
+
$method->setMethodTitle ($method_description);
|
| 209 |
+
$method->setPrice ($shipping_price);
|
| 210 |
+
$method->setCost ($shipping_price);
|
| 211 |
+
|
| 212 |
+
$result->append($method);
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
|
| 216 |
return $result;
|
| 217 |
}
|
| 310 |
*/
|
| 311 |
private function intelipostRequest($api_url, $api_key, $entity_action, $request=false)
|
| 312 |
{
|
| 313 |
+
$mgversion = Mage::getEdition()." ".Mage::getVersion();
|
| 314 |
$s = curl_init();
|
| 315 |
|
| 316 |
+
curl_setopt($s, CURLOPT_TIMEOUT, 3); // maximum time allowed to call API is 3 seconds
|
| 317 |
curl_setopt($s, CURLOPT_URL, $api_url.$entity_action);
|
| 318 |
+
curl_setopt($s, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Accept: application/json", "api_key: $api_key", "platform: Magento $mgversion", "plugin: 1.1.0"));
|
| 319 |
curl_setopt($s, CURLOPT_POST, true);
|
| 320 |
curl_setopt($s, CURLOPT_ENCODING , "");
|
| 321 |
curl_setopt($s, CURLOPT_RETURNTRANSFER, 1);
|
app/code/local/Intelipost/Shipping/Model/Config/Apikey.php
CHANGED
|
@@ -64,11 +64,12 @@ class Intelipost_Shipping_Model_Config_Apikey
|
|
| 64 |
*/
|
| 65 |
private function intelipostRequest($api_url, $api_key, $entity_action, $request=false)
|
| 66 |
{
|
|
|
|
| 67 |
$s = curl_init();
|
| 68 |
|
| 69 |
curl_setopt($s, CURLOPT_TIMEOUT, 5000);
|
| 70 |
curl_setopt($s, CURLOPT_URL, $api_url.$entity_action);
|
| 71 |
-
curl_setopt($s, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Accept: application/json", "api_key: $api_key"));
|
| 72 |
curl_setopt($s, CURLOPT_POST, true);
|
| 73 |
curl_setopt($s, CURLOPT_ENCODING , "");
|
| 74 |
curl_setopt($s, CURLOPT_RETURNTRANSFER, 1);
|
| 64 |
*/
|
| 65 |
private function intelipostRequest($api_url, $api_key, $entity_action, $request=false)
|
| 66 |
{
|
| 67 |
+
$mgversion = Mage::getEdition()." ".Mage::getVersion();
|
| 68 |
$s = curl_init();
|
| 69 |
|
| 70 |
curl_setopt($s, CURLOPT_TIMEOUT, 5000);
|
| 71 |
curl_setopt($s, CURLOPT_URL, $api_url.$entity_action);
|
| 72 |
+
curl_setopt($s, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Accept: application/json", "api_key: $api_key", "platform: $mgversion", "plugin: 1.1.0"));
|
| 73 |
curl_setopt($s, CURLOPT_POST, true);
|
| 74 |
curl_setopt($s, CURLOPT_ENCODING , "");
|
| 75 |
curl_setopt($s, CURLOPT_RETURNTRANSFER, 1);
|
app/code/local/Intelipost/Shipping/Model/Config/Token.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Intelipost_Shipping_Model_Config_Token
|
| 4 |
+
extends Mage_Adminhtml_Model_System_Config_Backend_Encrypted
|
| 5 |
+
{
|
| 6 |
+
|
| 7 |
+
public function save() {
|
| 8 |
+
|
| 9 |
+
$token = $this->getValue();
|
| 10 |
+
parent::save();
|
| 11 |
+
|
| 12 |
+
}
|
| 13 |
+
}
|
app/code/local/Intelipost/Shipping/Model/Config/Useraccount.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Intelipost_Shipping_Model_Config_Useraccount
|
| 4 |
+
extends Mage_Adminhtml_Model_System_Config_Backend_Encrypted
|
| 5 |
+
{
|
| 6 |
+
|
| 7 |
+
public function save() {
|
| 8 |
+
|
| 9 |
+
$useraccount = $this->getValue();
|
| 10 |
+
parent::save();
|
| 11 |
+
|
| 12 |
+
}
|
| 13 |
+
}
|
app/code/local/Intelipost/Shipping/etc/config.xml
CHANGED
|
@@ -13,6 +13,12 @@
|
|
| 13 |
<class>Intelipost_Shipping_Model</class>
|
| 14 |
</intelipost_shipping>
|
| 15 |
</models>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
<helpers>
|
| 18 |
<intelipost>
|
|
@@ -69,11 +75,20 @@
|
|
| 69 |
<default>
|
| 70 |
<carriers>
|
| 71 |
<intelipost>
|
|
|
|
| 72 |
<active>1</active>
|
| 73 |
<model>intelipost_shipping/carrier_intelipost</model>
|
| 74 |
<name>Intelipost</name>
|
| 75 |
<title>Intelipost</title>
|
| 76 |
<notification>1</notification>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
</intelipost>
|
| 78 |
</carriers>
|
| 79 |
</default>
|
| 13 |
<class>Intelipost_Shipping_Model</class>
|
| 14 |
</intelipost_shipping>
|
| 15 |
</models>
|
| 16 |
+
|
| 17 |
+
<blocks>
|
| 18 |
+
<intelipost>
|
| 19 |
+
<class>Intelipost_Shipping_Block</class>
|
| 20 |
+
</intelipost>
|
| 21 |
+
</blocks>
|
| 22 |
|
| 23 |
<helpers>
|
| 24 |
<intelipost>
|
| 75 |
<default>
|
| 76 |
<carriers>
|
| 77 |
<intelipost>
|
| 78 |
+
|
| 79 |
<active>1</active>
|
| 80 |
<model>intelipost_shipping/carrier_intelipost</model>
|
| 81 |
<name>Intelipost</name>
|
| 82 |
<title>Intelipost</title>
|
| 83 |
<notification>1</notification>
|
| 84 |
+
|
| 85 |
+
<altura_padrao>2</altura_padrao>
|
| 86 |
+
<comprimento_padrao>16</comprimento_padrao>
|
| 87 |
+
<largura_padrao>11</largura_padrao>
|
| 88 |
+
|
| 89 |
+
<customizetitle>%s - days to deliver: %d</customizetitle>
|
| 90 |
+
<table_name>esedex.sp</table_name>
|
| 91 |
+
|
| 92 |
</intelipost>
|
| 93 |
</carriers>
|
| 94 |
</default>
|
app/code/local/Intelipost/Shipping/etc/system.xml
CHANGED
|
@@ -22,7 +22,14 @@
|
|
| 22 |
<show_in_website>1</show_in_website>
|
| 23 |
<show_in_store>1</show_in_store>
|
| 24 |
</active>
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
<!--
|
| 27 |
<account translate="label">
|
| 28 |
<label>User Account</label>
|
|
@@ -55,7 +62,7 @@
|
|
| 55 |
<frontend_type>text</frontend_type>
|
| 56 |
<backend_model>intelipost_shipping/config_apiurl</backend_model>
|
| 57 |
<validate>required-entry</validate>
|
| 58 |
-
<sort_order>
|
| 59 |
<show_in_default>1</show_in_default>
|
| 60 |
<show_in_website>1</show_in_website>
|
| 61 |
<show_in_store>1</show_in_store>
|
|
@@ -66,7 +73,7 @@
|
|
| 66 |
<frontend_type>text</frontend_type>
|
| 67 |
<backend_model>intelipost_shipping/config_apikey</backend_model>
|
| 68 |
<validate>required-entry</validate>
|
| 69 |
-
<sort_order>
|
| 70 |
<show_in_default>1</show_in_default>
|
| 71 |
<show_in_website>1</show_in_website>
|
| 72 |
<show_in_store>1</show_in_store>
|
|
@@ -90,7 +97,7 @@
|
|
| 90 |
<frontend_type>text</frontend_type>
|
| 91 |
<!--<validate>validate-zip-international required-entry</validate>-->
|
| 92 |
<validate>required-entry</validate>
|
| 93 |
-
<sort_order>
|
| 94 |
<show_in_default>1</show_in_default>
|
| 95 |
<show_in_website>1</show_in_website>
|
| 96 |
<show_in_store>1</show_in_store>
|
|
@@ -129,6 +136,65 @@
|
|
| 129 |
<show_in_store>1</show_in_store>
|
| 130 |
</webservice_url>
|
| 131 |
-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
</fields>
|
| 133 |
|
| 134 |
</intelipost>
|
| 22 |
<show_in_website>1</show_in_website>
|
| 23 |
<show_in_store>1</show_in_store>
|
| 24 |
</active>
|
| 25 |
+
<title translate="label">
|
| 26 |
+
<label>Carrier Name</label>
|
| 27 |
+
<frontend_type>text</frontend_type>
|
| 28 |
+
<sort_order>2</sort_order>
|
| 29 |
+
<show_in_default>1</show_in_default>
|
| 30 |
+
<show_in_website>1</show_in_website>
|
| 31 |
+
<show_in_store>1</show_in_store>
|
| 32 |
+
</title>
|
| 33 |
<!--
|
| 34 |
<account translate="label">
|
| 35 |
<label>User Account</label>
|
| 62 |
<frontend_type>text</frontend_type>
|
| 63 |
<backend_model>intelipost_shipping/config_apiurl</backend_model>
|
| 64 |
<validate>required-entry</validate>
|
| 65 |
+
<sort_order>3</sort_order>
|
| 66 |
<show_in_default>1</show_in_default>
|
| 67 |
<show_in_website>1</show_in_website>
|
| 68 |
<show_in_store>1</show_in_store>
|
| 73 |
<frontend_type>text</frontend_type>
|
| 74 |
<backend_model>intelipost_shipping/config_apikey</backend_model>
|
| 75 |
<validate>required-entry</validate>
|
| 76 |
+
<sort_order>4</sort_order>
|
| 77 |
<show_in_default>1</show_in_default>
|
| 78 |
<show_in_website>1</show_in_website>
|
| 79 |
<show_in_store>1</show_in_store>
|
| 97 |
<frontend_type>text</frontend_type>
|
| 98 |
<!--<validate>validate-zip-international required-entry</validate>-->
|
| 99 |
<validate>required-entry</validate>
|
| 100 |
+
<sort_order>5</sort_order>
|
| 101 |
<show_in_default>1</show_in_default>
|
| 102 |
<show_in_website>1</show_in_website>
|
| 103 |
<show_in_store>1</show_in_store>
|
| 136 |
<show_in_store>1</show_in_store>
|
| 137 |
</webservice_url>
|
| 138 |
-->
|
| 139 |
+
|
| 140 |
+
<altura_padrao translate="label">
|
| 141 |
+
<label>Standard Height (cm)</label>
|
| 142 |
+
<frontend_type>text</frontend_type>
|
| 143 |
+
<sort_order>50</sort_order>
|
| 144 |
+
<show_in_default>1</show_in_default>
|
| 145 |
+
<show_in_website>1</show_in_website>
|
| 146 |
+
<show_in_store>1</show_in_store>
|
| 147 |
+
<comment><![CDATA[When not configured in the product will be used. <br /> Minimum of 2 cm.]]></comment>
|
| 148 |
+
</altura_padrao>
|
| 149 |
+
<comprimento_padrao translate="label">
|
| 150 |
+
<label>Standard length (cm)</label>
|
| 151 |
+
<frontend_type>text</frontend_type>
|
| 152 |
+
<sort_order>60</sort_order>
|
| 153 |
+
<show_in_default>1</show_in_default>
|
| 154 |
+
<show_in_website>1</show_in_website>
|
| 155 |
+
<show_in_store>1</show_in_store>
|
| 156 |
+
<comment><![CDATA[When not configured in the product will be used. <br /> Minimum of 16 cm.]]></comment>
|
| 157 |
+
</comprimento_padrao>
|
| 158 |
+
<largura_padrao translate="label">
|
| 159 |
+
<label>Standard width (cm)</label>
|
| 160 |
+
<frontend_type>text</frontend_type>
|
| 161 |
+
<sort_order>70</sort_order>
|
| 162 |
+
<show_in_default>1</show_in_default>
|
| 163 |
+
<show_in_website>1</show_in_website>
|
| 164 |
+
<show_in_store>1</show_in_store>
|
| 165 |
+
<comment><![CDATA[When not configured in the product will be used. <br /> Minimum of 11 cm.]]></comment>
|
| 166 |
+
</largura_padrao>
|
| 167 |
+
|
| 168 |
+
<customizetitle translate="label">
|
| 169 |
+
<label>Customize title for shipping methods</label>
|
| 170 |
+
<frontend_type>text</frontend_type>
|
| 171 |
+
<sort_order>80</sort_order>
|
| 172 |
+
<show_in_default>1</show_in_default>
|
| 173 |
+
<show_in_website>1</show_in_website>
|
| 174 |
+
<show_in_store>1</show_in_store>
|
| 175 |
+
<comment><![CDATA["%s" to the name of the service, for example "Courier", "%d" for the number of days.]]></comment>
|
| 176 |
+
</customizetitle>
|
| 177 |
+
|
| 178 |
+
<table_name translate="label">
|
| 179 |
+
<label>Contingency table</label>
|
| 180 |
+
<frontend_type>text</frontend_type>
|
| 181 |
+
<sort_order>90</sort_order>
|
| 182 |
+
<show_in_default>1</show_in_default>
|
| 183 |
+
<show_in_website>1</show_in_website>
|
| 184 |
+
<show_in_store>1</show_in_store>
|
| 185 |
+
<comment><![CDATA[Specifies which contingency table is used in a case of fallia Intelipost of the system. Following tables available: https://github.com/intelipost/fallback-tables (ex = esedex.sp price and term of e-Sedex originating SP)]]></comment>
|
| 186 |
+
</table_name>
|
| 187 |
+
|
| 188 |
+
<import_process translate="button_label">
|
| 189 |
+
<label></label>
|
| 190 |
+
<button_label>Import Process</button_label>
|
| 191 |
+
<frontend_type>button</frontend_type>
|
| 192 |
+
<frontend_model>intelipost/import</frontend_model>
|
| 193 |
+
<sort_order>100</sort_order>
|
| 194 |
+
<show_in_default>1</show_in_default>
|
| 195 |
+
<show_in_website>1</show_in_website>
|
| 196 |
+
<show_in_store>1</show_in_store>
|
| 197 |
+
</import_process>
|
| 198 |
</fields>
|
| 199 |
|
| 200 |
</intelipost>
|
app/locale/pt_BR/Intelipost_Shipping.csv
CHANGED
|
@@ -1,31 +1,43 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
User Account,Usuário
|
| 2 |
+
Postal Code,CEP
|
| 3 |
+
Choose the best fitting category for your products,Escolha a melhor categoria para os seus produtos
|
| 4 |
+
Enable notification,Habilitar notificações
|
| 5 |
+
Enable notification and dimension check,Habilitar notificações e validação de dimensões
|
| 6 |
+
Enable dimension check and notifications,Habilitar validação de dimensões e notificações
|
| 7 |
+
Alcoholic,Bebidas
|
| 8 |
+
Beverages,Líquidos Diversos
|
| 9 |
+
Books and/or graphical material,Livros ou Materiais gráficos
|
| 10 |
+
Clothing,Roupas e vestuários
|
| 11 |
+
Cosmetics,Cosméticos
|
| 12 |
+
Documents,Documentos
|
| 13 |
+
Eletronics,Eletrônicos e informática
|
| 14 |
+
Floriculture,Floricultura
|
| 15 |
+
Food,Alimentos
|
| 16 |
+
Fragile products,Produto Frágil
|
| 17 |
+
High value products,Objetos de alto valor
|
| 18 |
+
Machinery and/or parts,Máquinas ou Peças em geral
|
| 19 |
+
Office supplies and furniture,Móveis ou Objetos de escritório
|
| 20 |
+
Pharmacy,Produto Farmacêutico
|
| 21 |
+
Toys,Brinquedos
|
| 22 |
+
The following products do not have dimension set:,Os seguintes produtos não tem as dimensões definidas:
|
| 23 |
+
<small>Disable these notifications in System > Settings > Carriers > Intelipost</small>,<small>Desabilite as notifações em Sistema > Configuração > Métodos de envio > Intelipost</small>
|
| 24 |
+
Product missing dimensions,Produto sem dimensões
|
| 25 |
+
(same day),(mesmo dia)
|
| 26 |
+
(1 day),(1 dia útil)
|
| 27 |
+
(On acknowledgment),(Sob consulta)
|
| 28 |
+
(%s days),(%s dias úteis)
|
| 29 |
+
User account has the wrong size!,Usuário/Senha não número certo de caracteres!
|
| 30 |
+
Invalid username or password!,Usuário e/ou senha inválidos!
|
| 31 |
+
Could not validate username and password!,Erro ao validar usuário e senha
|
| 32 |
+
Standard Height (cm),Altura Padrão (cm)
|
| 33 |
+
When not configured in the product will be used. <br /> Minimum of 2 cm.,Quando não configurada no produto será usada.<br />Mínimo de 2 cm.
|
| 34 |
+
Standard length (cm),Comprimento Padrão (cm)
|
| 35 |
+
When not configured in the product will be used. <br /> Minimum of 16 cm.,Quando não configurada no produto será usada.<br />Mínimo de 16 cm.
|
| 36 |
+
Standard width (cm),Largura Padrão (cm)
|
| 37 |
+
When not configured in the product will be used. <br /> Minimum of 11 cm.,Quando não configurada no produto será usada.<br />Mínimo de 11 cm.
|
| 38 |
+
Customize title for shipping methods,Mensagem que Exibe o Prazo de Entrega
|
| 39 |
+
"""%s"" to the name of the service, for example ""Courier"", ""%d"" for the number of days.","""%s"" para o nome do serviço, por exemplo ""Sedex"", ""%d"" para o número de dias."
|
| 40 |
+
Contingency table,Tabela de contingência
|
| 41 |
+
Specifies which contingency table is used in a case of fallia Intelipost of the system. Following tables available: https://github.com/intelipost/fallback-tables (ex = esedex.sp price and term of e-Sedex originating SP),Especifica qual tabela de contingência será usada num caso de fallia do sistema da Intelipost. Segue as tabelas disponíveis: https://github.com/intelipost/fallback-tables (e.x. esedex.sp = preço e prazo de e-Sedex com origem SP)
|
| 42 |
+
Import Process,Processo de importação
|
| 43 |
+
Carrier Name,Nome do método de entrega
|
package.xml
CHANGED
|
@@ -1,19 +1,22 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Intelipost</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License Version 2 (GPLv2)</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Intelipost</summary>
|
| 10 |
<description>Extensão para utilizar o serviço de cotação da intelipost.com.br</description>
|
| 11 |
-
<notes
|
| 12 |
-
-
|
|
|
|
|
|
|
|
|
|
| 13 |
<authors><author><name>Intelipost</name><user>intelipost</user><email>it@intelipost.com.br</email></author></authors>
|
| 14 |
-
<date>2014-06-
|
| 15 |
-
<time>
|
| 16 |
-
<contents><target name="magelocal"><dir name="Intelipost"><dir name="Shipping"><dir name="Helper"><file name="Data.php" hash="7523e254d75d8ec6413164bdfc9484ce"/></dir><dir name="Model"><dir name="Carrier"><file name="Category.php" hash="9e3f8a5013f819dc65c9b84848182c8a"/><file name="Intelipost.php" hash="
|
| 17 |
<compatible/>
|
| 18 |
<dependencies><required><php><min>5.3.0</min><max>5.5.0</max></php></required></dependencies>
|
| 19 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Intelipost</name>
|
| 4 |
+
<version>1.1.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License Version 2 (GPLv2)</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Intelipost</summary>
|
| 10 |
<description>Extensão para utilizar o serviço de cotação da intelipost.com.br</description>
|
| 11 |
+
<notes>- Able to edit delivery estimated time text
|
| 12 |
+
- Volume dimensions default values
|
| 13 |
+
- API credentials validation
|
| 14 |
+
- Backup tables
|
| 15 |
+
</notes>
|
| 16 |
<authors><author><name>Intelipost</name><user>intelipost</user><email>it@intelipost.com.br</email></author></authors>
|
| 17 |
+
<date>2014-06-23</date>
|
| 18 |
+
<time>22:10:54</time>
|
| 19 |
+
<contents><target name="magelocal"><dir name="Intelipost"><dir name="Shipping"><dir name="Block"><file name="Import.php" hash="e0d0f1df8063c8e29e81c6ad7838f049"/></dir><dir name="Helper"><file name="Data.php" hash="7523e254d75d8ec6413164bdfc9484ce"/></dir><dir name="Model"><dir name="Carrier"><file name="Category.php" hash="9e3f8a5013f819dc65c9b84848182c8a"/><file name="Intelipost.php" hash="875efdb4ae79d128fd9a8a4dc5af4396"/></dir><dir name="Config"><file name="Apikey.php" hash="dc718c613cae83f0a7fc7f7d3a9ee4fa"/><file name="Apiurl.php" hash="4517960e32a1f0a92a84ce96ff40c6dd"/><file name="Password.php" hash="a3b0f867850520e637ed6d1561047093"/><file name="Token.php" hash="ae2ef4b4527f06c17061d6c984fa0a28"/><file name="Useraccount.php" hash="89a67edacda5169a4f58590e6ac24006"/></dir><dir name="Resource"><file name="EndCustomer.php" hash="a2109babc9b4fc994ccc8bbc3890efe5"/><file name="Invoice.php" hash="f1f792ed019964038769f4950f8c49e3"/><file name="Quote.php" hash="74f2826810d61c8d584ad02a8c12e82d"/><file name="Setup.php" hash="8f10c3277be3454dbf61abb1fb0b06f4"/><file name="ShipmentOrder.php" hash="83c0a94ecd8c9f913a89b3c81798f653"/><file name="Volume.php" hash="0fc8222182fde7557ac85166855a0c4d"/></dir></dir><dir name="etc"><file name="config.xml" hash="68df33ea9de1659f5b2ffea89ea27bc3"/><file name="system.xml" hash="7a06e44375bac2a21bfc6efa9eb617c5"/></dir><dir name="sql"><dir name="intelipost_setup"><file name="mysql4-install-0.0.1.php" hash="7cbddb7bad3e35cba43d14d8e2308900"/></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="pt_BR"><file name="Intelipost_Shipping.csv" hash="686737bb3f684fc434bceeeb88ebaee9"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Intelipost_Shipping.xml" hash="285e60144ae15077910cb9200038adb9"/></dir></target></contents>
|
| 20 |
<compatible/>
|
| 21 |
<dependencies><required><php><min>5.3.0</min><max>5.5.0</max></php></required></dependencies>
|
| 22 |
</package>
|
