Version Notes
Start selling internationally. Get bulk discounted DHL Express rates, displayed in real-time to your customers
Download this release
Release Info
| Developer | Cedcoss |
| Extension | InXpress |
| Version | 0.1.4 |
| Comparing to | |
| See all releases | |
Code changes from version 0.1.3 to 0.1.4
app/code/local/Cedcoss/Inxpress/Model/Carrier/Inxpress.php
CHANGED
|
@@ -10,7 +10,8 @@ class Cedcoss_Inxpress_Model_Carrier_Inxpress extends Mage_Shipping_Model_Carrie
|
|
| 10 |
if (!$this->getConfigFlag('active')) {
|
| 11 |
return false;
|
| 12 |
}
|
| 13 |
-
|
|
|
|
| 14 |
$shippingPrice=0;
|
| 15 |
if ($request->getAllItems())
|
| 16 |
{
|
|
@@ -22,19 +23,72 @@ class Cedcoss_Inxpress_Model_Carrier_Inxpress extends Mage_Shipping_Model_Carrie
|
|
| 22 |
}
|
| 23 |
else
|
| 24 |
{
|
| 25 |
-
$resource = Mage::getSingleton('core/resource');
|
| 26 |
-
$readConnection = $resource->getConnection('core_read');
|
| 27 |
$dimweight = Mage::getModel('inxpress/variant')->getCollection()->addFieldToFilter('product_id',$item->getProduct()->getId())->getData();
|
| 28 |
if(!empty($dimweight))
|
| 29 |
{
|
| 30 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
else
|
| 33 |
{
|
| 34 |
-
$weight=$item->getProduct()->getWeight();
|
| 35 |
}
|
|
|
|
|
|
|
|
|
|
| 36 |
$code='';
|
| 37 |
-
|
| 38 |
|
| 39 |
$code='P';
|
| 40 |
}
|
|
@@ -42,40 +96,18 @@ class Cedcoss_Inxpress_Model_Carrier_Inxpress extends Mage_Shipping_Model_Carrie
|
|
| 42 |
{
|
| 43 |
$code='X';
|
| 44 |
}
|
| 45 |
-
|
| 46 |
-
{
|
| 47 |
-
$price=$this->calcRate(Mage::getStoreConfig('carriers/inxpress/account'),$code,$request->getDestCountryId(),$weight,$dimweight[0]['length'],$dimweight[0]['width'],$dimweight[0]['height'],$request->getDestPostcode(),$item->getProduct()->getWeight());
|
| 48 |
-
}
|
| 49 |
-
else
|
| 50 |
-
{
|
| 51 |
-
$price=$this->calcRate(Mage::getStoreConfig('carriers/inxpress/account'),$code,$request->getDestCountryId(),$weight,0,0,0,$request->getDestPostcode(),$item->getProduct()->getWeight());
|
| 52 |
-
}
|
| 53 |
-
if($price)
|
| 54 |
-
{
|
| 55 |
-
if((isset($variable))&&($variable!=''))
|
| 56 |
-
{
|
| 57 |
-
if($variable>=$item->getQty())
|
| 58 |
-
{
|
| 59 |
-
$shippingPrice=($shippingPrice+$price['price']);
|
| 60 |
-
}
|
| 61 |
-
else if($variable<$item->getQty())
|
| 62 |
-
{
|
| 63 |
-
$qty=ceil(($item->getQty())/$variable);
|
| 64 |
-
$shippingPrice=($shippingPrice+$price['price'])*$qty;
|
| 65 |
-
}
|
| 66 |
-
}
|
| 67 |
-
else
|
| 68 |
-
{
|
| 69 |
-
$shippingPrice=($shippingPrice+$price['price'])*$item->getQty();
|
| 70 |
-
}
|
| 71 |
-
}
|
| 72 |
-
else
|
| 73 |
-
{
|
| 74 |
-
|
| 75 |
-
return false;
|
| 76 |
-
}
|
| 77 |
}
|
| 78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
$result = Mage::getModel('shipping/rate_result');
|
| 81 |
$shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
|
|
@@ -107,16 +139,11 @@ class Cedcoss_Inxpress_Model_Carrier_Inxpress extends Mage_Shipping_Model_Carrie
|
|
| 107 |
}
|
| 108 |
|
| 109 |
|
| 110 |
-
public function calcRate($account,$code,$country,$weight,$
|
| 111 |
{
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
}
|
| 116 |
-
else
|
| 117 |
-
{
|
| 118 |
-
$url = Mage::getStoreConfig('carriers/inxpress/gateway_url').'?acc='.$account.'&dst='.$country.'&prd='.$code.'&wgt='.$weight.'&pst='.$zip.'&pcs='.$length.'|'.$width.'|'.$height.'|'.$pro_weight;
|
| 119 |
-
}
|
| 120 |
|
| 121 |
|
| 122 |
$ch = curl_init();
|
| 10 |
if (!$this->getConfigFlag('active')) {
|
| 11 |
return false;
|
| 12 |
}
|
| 13 |
+
$final_lbh = '';
|
| 14 |
+
$weight=0;
|
| 15 |
$shippingPrice=0;
|
| 16 |
if ($request->getAllItems())
|
| 17 |
{
|
| 23 |
}
|
| 24 |
else
|
| 25 |
{
|
|
|
|
|
|
|
| 26 |
$dimweight = Mage::getModel('inxpress/variant')->getCollection()->addFieldToFilter('product_id',$item->getProduct()->getId())->getData();
|
| 27 |
if(!empty($dimweight))
|
| 28 |
{
|
| 29 |
+
$variable=$dimweight[0]['variable'];
|
| 30 |
+
if(($variable!=''&&$variable!=0))
|
| 31 |
+
{
|
| 32 |
+
if($variable>=$item->getQty())
|
| 33 |
+
{
|
| 34 |
+
if($dimweight[0]['dim_weight'] > $item->getProduct()->getWeight())
|
| 35 |
+
{
|
| 36 |
+
$final_lbh.=$dimweight[0]['length'].'|'.$dimweight[0]['width'].'|'.$dimweight[0]['height'].'|'.$item->getProduct()->getWeight().';';
|
| 37 |
+
$weight=$weight+$dimweight[0]['dim_weight'];
|
| 38 |
+
}
|
| 39 |
+
else
|
| 40 |
+
{
|
| 41 |
+
$final_lbh.=$dimweight[0]['length'].'|'.$dimweight[0]['width'].'|'.$dimweight[0]['height'].'|'.$item->getProduct()->getWeight().';';
|
| 42 |
+
$weight=$weight+$item->getProduct()->getWeight();
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
else if($variable<$item->getQty())
|
| 46 |
+
{
|
| 47 |
+
$qty=ceil(($item->getQty())/$variable);
|
| 48 |
+
$prod_weight=$item->getProduct()->getWeight()*$qty;
|
| 49 |
+
$prod_dim_weight=$dimweight[0]['dim_weight']*$qty;
|
| 50 |
+
if($prod_dim_weight > $prod_weight)
|
| 51 |
+
{
|
| 52 |
+
$final_lbh.=$dimweight[0]['length'].'|'.$dimweight[0]['width'].'|'.$dimweight[0]['height'].'|'.$prod_weight.';';
|
| 53 |
+
$weight=$weight+$prod_dim_weight;
|
| 54 |
+
}
|
| 55 |
+
else
|
| 56 |
+
{
|
| 57 |
+
$final_lbh.=$dimweight[0]['length'].'|'.$dimweight[0]['width'].'|'.$dimweight[0]['height'].'|'.$prod_weight.';';
|
| 58 |
+
$weight=$weight+($item->getProduct()->getWeight()*$qty);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
else
|
| 64 |
+
{
|
| 65 |
+
|
| 66 |
+
$prod_weight=$item->getProduct()->getWeight()*$item->getQty();
|
| 67 |
+
$prod_dim_weight=$dimweight[0]['dim_weight']*$item->getQty();
|
| 68 |
+
if($prod_dim_weight > $prod_weight)
|
| 69 |
+
{
|
| 70 |
+
$final_lbh.=$dimweight[0]['length'].'|'.$dimweight[0]['width'].'|'.$dimweight[0]['height'].'|'.$prod_weight.';';
|
| 71 |
+
$weight=$weight+$prod_dim_weight;
|
| 72 |
+
}
|
| 73 |
+
else
|
| 74 |
+
{
|
| 75 |
+
$final_lbh.=$dimweight[0]['length'].'|'.$dimweight[0]['width'].'|'.$dimweight[0]['height'].'|'.$prod_weight.';';
|
| 76 |
+
$weight=$weight+($item->getProduct()->getWeight()*$item->getQty());
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
|
| 82 |
}
|
| 83 |
else
|
| 84 |
{
|
| 85 |
+
$weight=$weight+($item->getProduct()->getWeight()*$item->getQty());
|
| 86 |
}
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
|
| 90 |
$code='';
|
| 91 |
+
if($weight>0.5) {
|
| 92 |
|
| 93 |
$code='P';
|
| 94 |
}
|
| 96 |
{
|
| 97 |
$code='X';
|
| 98 |
}
|
| 99 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
}
|
| 101 |
}
|
| 102 |
+
$price=$this->calcRate(Mage::getStoreConfig('carriers/inxpress/account'),$code,$request->getDestCountryId(),$weight,$final_lbh,$request->getDestPostcode());
|
| 103 |
+
if($price)
|
| 104 |
+
{
|
| 105 |
+
$shippingPrice=$price['price'];
|
| 106 |
+
}
|
| 107 |
+
else
|
| 108 |
+
{
|
| 109 |
+
return false;
|
| 110 |
+
}
|
| 111 |
}
|
| 112 |
$result = Mage::getModel('shipping/rate_result');
|
| 113 |
$shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
|
| 139 |
}
|
| 140 |
|
| 141 |
|
| 142 |
+
public function calcRate($account,$code,$country,$weight,$dimension,$zip)
|
| 143 |
{
|
| 144 |
+
$dimension = rtrim($dimension, ';');
|
| 145 |
+
$url = Mage::getStoreConfig('carriers/inxpress/gateway_url').'?acc='.$account.'&dst='.$country.'&prd='.$code.'&wgt='.$weight.'&pst='.$zip.'&pcs='.$dimension;
|
| 146 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
|
| 149 |
$ch = curl_init();
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>InXpress</name>
|
| 4 |
-
<version>0.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>0.3osl</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -20,9 +20,9 @@ As the largest small business solution of DHL Express, we are an authorized rese
|
|
| 20 |
</description>
|
| 21 |
<notes>Start selling internationally. Get bulk discounted DHL Express rates, displayed in real-time to your customers</notes>
|
| 22 |
<authors><author><name>Cedcoss</name><user>Cedcoss</user><email>developer@cedcoss.com</email></author></authors>
|
| 23 |
-
<date>2014-08-
|
| 24 |
-
<time>
|
| 25 |
-
<contents><target name="magelocal"><dir name="Cedcoss"><dir name="Inxpress"><dir name="Block"><dir name="Adminhtml"><dir name="Bundle"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Attributes.php" hash="e357b4ecb18315fda2c47e8030012e5e"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Attributes.php" hash="4b35e1ff0c375a66c1285ede3d038418"/><file name="Variant.php" hash="91d23debf200dadd80e146ecfd26b4fc"/></dir></dir></dir></dir><file name="Csvimport.php" hash="1bc5779bfce7d8d1129ca6dfb752b5a8"/><dir name="Dhl"><dir name="Edit"><file name="Form.php" hash="1e2c5798c4bd2d61032c9e1608574f2e"/><dir name="Tab"><file name="General.php" hash="7253685240f6d7bc4baf19708b4cc862"/></dir><file name="Tabs.php" hash="b40f6379e3f57a2f98c815d2a7244d3f"/></dir><file name="Edit.php" hash="d88689fc94b81d615a4f64b537b26257"/><file name="Grid.php" hash="879c4707e10eff48b36285796a64f2d0"/></dir><file name="Dhl.php" hash="339a84506adaec2025a8f68306bcdd30"/><dir name="Inxpress"><dir name="Edit"><file name="Form.php" hash="bcb5b83c72fde8d0709b7ac90490e71c"/><dir name="Tab"><file name="General.php" hash="85e9cac1678a06ea9ed2046e683e5469"/></dir><file name="Tabs.php" hash="37abefbd4ad54f6d05d21a2a3a9a48a4"/></dir><file name="Edit.php" hash="6a0abed926a0bfb013a5d3391df2b79c"/><file name="Grid.php" hash="57b14c1199df3ca0616f5b85677c740b"/></dir><file name="Inxpress.php" hash="1718c828a6d840e302ef9818fba73fd1"/><file name="Variant.php" hash="d249a67a9b93505d0ced3022dbb27646"/></dir></dir><dir name="Helper"><file name="Data.php" hash="02786dd8930932a9627eb5ac600ddb73"/></dir><dir name="Model"><dir name="Carrier"><file name="Inxpress.php" hash="
|
| 26 |
<compatible/>
|
| 27 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
| 28 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>InXpress</name>
|
| 4 |
+
<version>0.1.4</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>0.3osl</license>
|
| 7 |
<channel>community</channel>
|
| 20 |
</description>
|
| 21 |
<notes>Start selling internationally. Get bulk discounted DHL Express rates, displayed in real-time to your customers</notes>
|
| 22 |
<authors><author><name>Cedcoss</name><user>Cedcoss</user><email>developer@cedcoss.com</email></author></authors>
|
| 23 |
+
<date>2014-08-20</date>
|
| 24 |
+
<time>07:55:47</time>
|
| 25 |
+
<contents><target name="magelocal"><dir name="Cedcoss"><dir name="Inxpress"><dir name="Block"><dir name="Adminhtml"><dir name="Bundle"><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Attributes.php" hash="e357b4ecb18315fda2c47e8030012e5e"/></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Attributes.php" hash="4b35e1ff0c375a66c1285ede3d038418"/><file name="Variant.php" hash="91d23debf200dadd80e146ecfd26b4fc"/></dir></dir></dir></dir><file name="Csvimport.php" hash="1bc5779bfce7d8d1129ca6dfb752b5a8"/><dir name="Dhl"><dir name="Edit"><file name="Form.php" hash="1e2c5798c4bd2d61032c9e1608574f2e"/><dir name="Tab"><file name="General.php" hash="7253685240f6d7bc4baf19708b4cc862"/></dir><file name="Tabs.php" hash="b40f6379e3f57a2f98c815d2a7244d3f"/></dir><file name="Edit.php" hash="d88689fc94b81d615a4f64b537b26257"/><file name="Grid.php" hash="879c4707e10eff48b36285796a64f2d0"/></dir><file name="Dhl.php" hash="339a84506adaec2025a8f68306bcdd30"/><dir name="Inxpress"><dir name="Edit"><file name="Form.php" hash="bcb5b83c72fde8d0709b7ac90490e71c"/><dir name="Tab"><file name="General.php" hash="85e9cac1678a06ea9ed2046e683e5469"/></dir><file name="Tabs.php" hash="37abefbd4ad54f6d05d21a2a3a9a48a4"/></dir><file name="Edit.php" hash="6a0abed926a0bfb013a5d3391df2b79c"/><file name="Grid.php" hash="57b14c1199df3ca0616f5b85677c740b"/></dir><file name="Inxpress.php" hash="1718c828a6d840e302ef9818fba73fd1"/><file name="Variant.php" hash="d249a67a9b93505d0ced3022dbb27646"/></dir></dir><dir name="Helper"><file name="Data.php" hash="02786dd8930932a9627eb5ac600ddb73"/></dir><dir name="Model"><dir name="Carrier"><file name="Inxpress.php" hash="b86c897da4e90812a032a74c7f8cbacd"/><file name="Unitofmeasure.php" hash="89c1dd33c6342763606ec340b4f0fc4a"/></dir><file name="Dhl.php" hash="e493deb72b63f843d4d84145f188814a"/><file name="Inxpress.php" hash="c00b406b60986a41713219995929fe35"/><dir name="Mysql4"><dir name="Dhl"><file name="Collection.php" hash="beb11157339512591be47cad496d33d7"/></dir><file name="Dhl.php" hash="cfa31c7a528bd9cd67dbb9f04403f161"/><dir name="Inxpress"><file name="Collection.php" hash="fac10a23aad024cd73ea5ec0f618a488"/></dir><file name="Inxpress.php" hash="7b61c380c27488dc8cd885f58fe541ed"/><file name="Setup.php" hash="1d62889c7eb878fab5538068a659ff5b"/><dir name="Variant"><file name="Collection.php" hash="7a8a248004f2b4e8091b78fa96441136"/></dir><file name="Variant.php" hash="ea8dd752cc63e970ebec9bd927f7da8b"/></dir><file name="Variant.php" hash="a9a343e2fbcf3e26db9146864a7c1a51"/></dir><dir name="controllers"><file name="ActivateController.php" hash="48d1702edd21f9be61fa25c2d6b656fb"/><dir name="Adminhtml"><file name="DhlController.php" hash="5a32c5356ec2949306dd6044fa6e1e82"/><file name="IndexController.php" hash="150de793c305b376a765107a52c0b1e9"/></dir></dir><dir name="etc"><file name="config.xml" hash="87440471684e3b5576c54fca94342256"/><file name="system.xml" hash="3ac3ec9482377ec350a0bce82fb42660"/></dir><dir name="sql"><dir name="inxpress_setup"><file name="mysql4-install-0.1.0.php" hash="afb6f67e348dfb0b7b8e58e4c6058710"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="8c1df72fcc864599d11ef9f3060c3d8a"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="b6f63e3a963950de3bf48545b0c94151"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cedcoss_Inxpress.xml" hash="ce41d55e28a410c66676332f84947239"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="inxpress.xml" hash="dc9466cb8a17ef0ebfba4fec8780420e"/></dir><dir name="template"><dir name="inxpress"><file name="csvimport.phtml" hash="2b6a7f335c898186f6a09e7f0dd223df"/><file name="popup.phtml" hash="b5d6e69a5632a5fb90f3e1257fe5cb84"/><file name="productedit.phtml" hash="318a4c20dc39574917d589650b8b6d79"/><file name="variant.phtml" hash="394d70580bd33d9af5ac28ff948b0bf6"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="skin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="inxpress"><dir name="css"><file name="blank.gif" hash="325472601571f31e1bf00674c368d335"/><file name="fancybox_buttons.png" hash="b448080f8615e664b7788c7003803b59"/><file name="fancybox_loading.gif" hash="328cc0f6c78211485058d460e80f4fa8"/><file name="fancybox_loading@2x.gif" hash="f92938639fa894a0e8ded1c3368abe98"/><file name="fancybox_overlay.png" hash="77aeaa52715b898b73c74d68c630330e"/><file name="fancybox_sprite.png" hash="783d4031fe50c3d83c960911e1fbc705"/><file name="fancybox_sprite@2x.png" hash="ed9970ce22242421e66ff150aa97fe5f"/><file name="jquery.fancybox-buttons.css" hash="cac75538c2e3ddfadef839feaca8e356"/><file name="jquery.fancybox-thumbs.css" hash="52ddd84a9f42c1d4cd86d518a7f7e8bc"/><file name="jquery.fancybox.css" hash="6c55951ce1e3115711f63f99b7501f3a"/><file name="styles.css" hash="1c0e23e8c009f75795c4c1096f719e67"/></dir><dir name="images"><file name="gif-load-main.GIF" hash="8fd2f94e2bd93d7106461b08555d27db"/><file name="gif-load.GIF" hash="f4d3de48e22dcdca0ba54d609698828f"/></dir><dir name="js"><file name="jquery-1.10.1.min.js" hash="9b3af8c24f81421aa0bba99aa7b432ca"/><file name="jquery.fancybox-buttons.js" hash="be5c05db2dd0dc4574ede921f5161f83"/><file name="jquery.fancybox-media.js" hash="2788a541e052cb7926b7bde4058f87c1"/><file name="jquery.fancybox-thumbs.js" hash="e26ea36bf8046c223492f1641f9c476e"/><file name="jquery.fancybox.js" hash="e3367a65909f850774a2a54bdbfc821a"/><file name="jquery.fancybox.pack.js" hash="9e53f886fa07fc87b67a0b0b9412a943"/></dir></dir></dir></dir></dir></dir></target></contents>
|
| 26 |
<compatible/>
|
| 27 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
| 28 |
</package>
|
