Version Notes
* added support for custom cart templates
* added support for disabling PostPal for selected products
Download this release
Release Info
| Developer | PostPal |
| Extension | PostPal_Shipping |
| Version | 0.1.4 |
| Comparing to | |
| See all releases | |
Code changes from version 0.1.3 to 0.1.4
app/code/community/PostPal/Shipping/Model/Carrier.php
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
<?php
|
| 2 |
* @author Jana Vassiljeva <jana@artmarka.com>
|
| 3 |
*/
|
| 4 |
protected $_code = 'postpal_shipping';
|
| 5 |
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
| 6 |
{
|
| 7 |
$result = Mage::getModel('shipping/rate_result');
|
| 8 |
/* @var $result Mage_Shipping_Model_Rate_Result */
|
| 9 |
$result->append($this->_getStandardShippingRate());
|
| 10 |
return $result;
|
| 11 |
}
|
| 12 |
public function isTrackingAvailable()
|
| 13 |
{
|
| 14 |
return true;
|
| 15 |
}
|
| 16 |
protected function _getStandardShippingRate()
|
| 17 |
{
|
| 18 |
$rate = Mage::getModel('shipping/rate_result_method');
|
| 19 |
/* @var $rate Mage_Shipping_Model_Rate_Result_Method */
|
| 20 |
$rate->setCarrier($this->_code);
|
| 21 |
/**
|
| 22 |
* getConfigData(config_key) returns the configuration value for the
|
| 23 |
* carriers/[carrier_code]/[config_key]
|
| 24 |
*/
|
| 25 |
$rate->setCarrierTitle($this->getConfigData('title'));
|
| 26 |
$rate->setMethod('fixed');
|
| 27 |
$result = Mage::getModel('postpal_shipping/api')->getDeliveryArrivalEstimation();
|
| 28 |
if (empty($result) || $result->status == false)
|
| 29 |
return false;
|
| 30 |
$formatedTime = date('d.m.Y H:i', strtotime($result->estimate));
|
| 31 |
$rate->setMethodTitle($this->getConfigData('name'). ' ('. Mage::helper('postpal')->__('ETA: '). ' ' . $formatedTime . ') ');
|
| 32 |
$rate->setPrice($this->getConfigData('default_price'));
|
| 33 |
$rate->setCost(0);
|
| 34 |
return $rate;
|
| 35 |
}
|
| 36 |
public function getAllowedMethods() {
|
| 37 |
return array();
|
| 38 |
}
|
|
|
|
| 39 |
* @author Jana Vassiljeva <jana@artmarka.com>
|
| 40 |
*/
|
| 41 |
protected $_code = 'postpal_shipping';
|
| 42 |
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
| 43 |
{
|
| 44 |
$result = Mage::getModel('shipping/rate_result');
|
| 45 |
/* @var $result Mage_Shipping_Model_Rate_Result */
|
| 46 |
if(!$this->_isAvailable($request))
|
| 47 |
return $result;
|
| 48 |
$result->append($this->_getStandardShippingRate());
|
| 49 |
return $result;
|
| 50 |
}
|
| 51 |
public function isTrackingAvailable()
|
| 52 |
{
|
| 53 |
return true;
|
| 54 |
}
|
| 55 |
protected function _getStandardShippingRate()
|
| 56 |
{
|
| 57 |
$rate = Mage::getModel('shipping/rate_result_method');
|
| 58 |
/* @var $rate Mage_Shipping_Model_Rate_Result_Method */
|
| 59 |
$rate->setCarrier($this->_code);
|
| 60 |
/**
|
| 61 |
* getConfigData(config_key) returns the configuration value for the
|
| 62 |
* carriers/[carrier_code]/[config_key]
|
| 63 |
*/
|
| 64 |
$rate->setCarrierTitle($this->getConfigData('title'));
|
| 65 |
$rate->setMethod('fixed');
|
| 66 |
$result = Mage::getModel('postpal_shipping/api')->getDeliveryArrivalEstimation();
|
| 67 |
if (empty($result) || $result->status == false)
|
| 68 |
return false;
|
| 69 |
$formatedTime = date('d.m.Y H:i', strtotime($result->estimate));
|
| 70 |
$rate->setMethodTitle($this->getConfigData('name'). ' ('. Mage::helper('postpal')->__('ETA: '). ' ' . $formatedTime . ') ');
|
| 71 |
$rate->setPrice($this->getConfigData('default_price'));
|
| 72 |
$rate->setCost(0);
|
| 73 |
return $rate;
|
| 74 |
}
|
| 75 |
protected function _isAvailable(Mage_Shipping_Model_Rate_Request $request) {
|
| 76 |
$productItem = true;
|
| 77 |
if ($this->getConfigData('checkitems') == 1) {
|
| 78 |
$productItem = true;
|
| 79 |
if ($request->getAllItems()) {
|
| 80 |
foreach ($request->getAllItems() as $item) {
|
| 81 |
$custom = Mage::getModel('catalog/product')->load($item->getProduct()->getId());
|
| 82 |
$notAvailableByPostPal = $custom->getData('nopostpal'); // Product attribute nopostpal
|
| 83 |
if ($notAvailableByPostPal) {
|
| 84 |
$productItem = false;
|
| 85 |
break;
|
| 86 |
}
|
| 87 |
}
|
| 88 |
}
|
| 89 |
}
|
| 90 |
if (!$productItem)
|
| 91 |
return false;
|
| 92 |
return true;
|
| 93 |
}
|
| 94 |
public function getAllowedMethods() {
|
| 95 |
return array();
|
| 96 |
}
|
|
|
|
| 1 |
* @author Jana Vassiljeva <jana@artmarka.com>
|
| 2 |
*/
|
| 3 |
protected $_code = 'postpal_shipping';
|
| 4 |
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
| 5 |
{
|
| 6 |
$result = Mage::getModel('shipping/rate_result');
|
| 7 |
/* @var $result Mage_Shipping_Model_Rate_Result */
|
| 8 |
$result->append($this->_getStandardShippingRate());
|
| 9 |
return $result;
|
| 10 |
}
|
| 11 |
public function isTrackingAvailable()
|
| 12 |
{
|
| 13 |
return true;
|
| 14 |
}
|
| 15 |
protected function _getStandardShippingRate()
|
| 16 |
{
|
| 17 |
$rate = Mage::getModel('shipping/rate_result_method');
|
| 18 |
/* @var $rate Mage_Shipping_Model_Rate_Result_Method */
|
| 19 |
$rate->setCarrier($this->_code);
|
| 20 |
/**
|
| 21 |
* getConfigData(config_key) returns the configuration value for the
|
| 22 |
* carriers/[carrier_code]/[config_key]
|
| 23 |
*/
|
| 24 |
$rate->setCarrierTitle($this->getConfigData('title'));
|
| 25 |
$rate->setMethod('fixed');
|
| 26 |
$result = Mage::getModel('postpal_shipping/api')->getDeliveryArrivalEstimation();
|
| 27 |
if (empty($result) || $result->status == false)
|
| 28 |
return false;
|
| 29 |
$formatedTime = date('d.m.Y H:i', strtotime($result->estimate));
|
| 30 |
$rate->setMethodTitle($this->getConfigData('name'). ' ('. Mage::helper('postpal')->__('ETA: '). ' ' . $formatedTime . ') ');
|
| 31 |
$rate->setPrice($this->getConfigData('default_price'));
|
| 32 |
$rate->setCost(0);
|
| 33 |
return $rate;
|
| 34 |
}
|
| 35 |
public function getAllowedMethods() {
|
| 36 |
return array();
|
| 37 |
}
|
| 38 |
+
<?php
|
| 39 |
* @author Jana Vassiljeva <jana@artmarka.com>
|
| 40 |
*/
|
| 41 |
protected $_code = 'postpal_shipping';
|
| 42 |
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
| 43 |
{
|
| 44 |
$result = Mage::getModel('shipping/rate_result');
|
| 45 |
/* @var $result Mage_Shipping_Model_Rate_Result */
|
| 46 |
if(!$this->_isAvailable($request))
|
| 47 |
return $result;
|
| 48 |
$result->append($this->_getStandardShippingRate());
|
| 49 |
return $result;
|
| 50 |
}
|
| 51 |
public function isTrackingAvailable()
|
| 52 |
{
|
| 53 |
return true;
|
| 54 |
}
|
| 55 |
protected function _getStandardShippingRate()
|
| 56 |
{
|
| 57 |
$rate = Mage::getModel('shipping/rate_result_method');
|
| 58 |
/* @var $rate Mage_Shipping_Model_Rate_Result_Method */
|
| 59 |
$rate->setCarrier($this->_code);
|
| 60 |
/**
|
| 61 |
* getConfigData(config_key) returns the configuration value for the
|
| 62 |
* carriers/[carrier_code]/[config_key]
|
| 63 |
*/
|
| 64 |
$rate->setCarrierTitle($this->getConfigData('title'));
|
| 65 |
$rate->setMethod('fixed');
|
| 66 |
$result = Mage::getModel('postpal_shipping/api')->getDeliveryArrivalEstimation();
|
| 67 |
if (empty($result) || $result->status == false)
|
| 68 |
return false;
|
| 69 |
$formatedTime = date('d.m.Y H:i', strtotime($result->estimate));
|
| 70 |
$rate->setMethodTitle($this->getConfigData('name'). ' ('. Mage::helper('postpal')->__('ETA: '). ' ' . $formatedTime . ') ');
|
| 71 |
$rate->setPrice($this->getConfigData('default_price'));
|
| 72 |
$rate->setCost(0);
|
| 73 |
return $rate;
|
| 74 |
}
|
| 75 |
protected function _isAvailable(Mage_Shipping_Model_Rate_Request $request) {
|
| 76 |
$productItem = true;
|
| 77 |
if ($this->getConfigData('checkitems') == 1) {
|
| 78 |
$productItem = true;
|
| 79 |
if ($request->getAllItems()) {
|
| 80 |
foreach ($request->getAllItems() as $item) {
|
| 81 |
$custom = Mage::getModel('catalog/product')->load($item->getProduct()->getId());
|
| 82 |
$notAvailableByPostPal = $custom->getData('nopostpal'); // Product attribute nopostpal
|
| 83 |
if ($notAvailableByPostPal) {
|
| 84 |
$productItem = false;
|
| 85 |
break;
|
| 86 |
}
|
| 87 |
}
|
| 88 |
}
|
| 89 |
}
|
| 90 |
if (!$productItem)
|
| 91 |
return false;
|
| 92 |
return true;
|
| 93 |
}
|
| 94 |
public function getAllowedMethods() {
|
| 95 |
return array();
|
| 96 |
}
|
app/code/community/PostPal/Shipping/etc/config.xml
CHANGED
|
@@ -74,7 +74,7 @@
|
|
| 74 |
<name>Kiirkuller</name>
|
| 75 |
<sort_order>1</sort_order>
|
| 76 |
<sallowspecific>0</sallowspecific>
|
| 77 |
-
<api_url>https
|
| 78 |
<track_url>https://my.postpal.ee/track</track_url>
|
| 79 |
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
| 80 |
<showmethod>1</showmethod>
|
| 74 |
<name>Kiirkuller</name>
|
| 75 |
<sort_order>1</sort_order>
|
| 76 |
<sallowspecific>0</sallowspecific>
|
| 77 |
+
<api_url>https//my.postpal.ee/api/shop/v1</api_url>
|
| 78 |
<track_url>https://my.postpal.ee/track</track_url>
|
| 79 |
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
| 80 |
<showmethod>1</showmethod>
|
app/design/frontend/base/default/layout/postpal/shipping.xml
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<layout version="0.1.0">
|
| 3 |
-
|
|
|
|
| 4 |
<reference name="head">
|
| 5 |
<action method="addCss"><stylesheet>postpal/css/postpal.css</stylesheet></action>
|
| 6 |
</reference>
|
| 7 |
-
<reference name="
|
| 8 |
-
<block type="
|
| 9 |
</reference>
|
| 10 |
-
</
|
| 11 |
|
| 12 |
</layout>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<layout version="0.1.0">
|
| 3 |
+
|
| 4 |
+
<default>
|
| 5 |
<reference name="head">
|
| 6 |
<action method="addCss"><stylesheet>postpal/css/postpal.css</stylesheet></action>
|
| 7 |
</reference>
|
| 8 |
+
<reference name="footer">
|
| 9 |
+
<block type="core/template" name="extra_js" as="extra_js" template="postpal/extras.phtml"/>
|
| 10 |
</reference>
|
| 11 |
+
</default>
|
| 12 |
|
| 13 |
</layout>
|
package.xml
CHANGED
|
@@ -1,18 +1,19 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>PostPal_Shipping</name>
|
| 4 |
-
<version>0.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>PostPal shipping extension</summary>
|
| 10 |
<description>This extension adds PostPal on-demand courier service to your shopping cart.</description>
|
| 11 |
-
<notes
|
|
|
|
| 12 |
<authors><author><name>PostPal</name><user>PostPal</user><email>hello@postpal.ee</email></author></authors>
|
| 13 |
-
<date>2016-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="postpal"><dir name="css"><file name="postpal.css" hash="5b3f0d0cce5377aa5bf6978865d0061b"/></dir><dir name="img"><file name="postpal_logo.png" hash="fc3f0bbb0d70f229321bcdd31eaa7549"/></dir><dir name="js"><file name="opcheckout_postpal.js" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.3.0</min><max>7.0.0</max></php><extension><name>json</name><min/><max/></extension></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>PostPal_Shipping</name>
|
| 4 |
+
<version>0.1.4</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>PostPal shipping extension</summary>
|
| 10 |
<description>This extension adds PostPal on-demand courier service to your shopping cart.</description>
|
| 11 |
+
<notes>* added support for custom cart templates
|
| 12 |
+
* added support for disabling PostPal for selected products</notes>
|
| 13 |
<authors><author><name>PostPal</name><user>PostPal</user><email>hello@postpal.ee</email></author></authors>
|
| 14 |
+
<date>2016-02-24</date>
|
| 15 |
+
<time>22:15:31</time>
|
| 16 |
+
<contents><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="postpal"><dir name="css"><file name="postpal.css" hash="5b3f0d0cce5377aa5bf6978865d0061b"/></dir><dir name="img"><file name="postpal_logo.png" hash="fc3f0bbb0d70f229321bcdd31eaa7549"/></dir><dir name="js"><file name="opcheckout_postpal.js" hash="ddbd3e07a118291edf36c077e1ecc2d1"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="PostPal"><dir name="Shipping"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Shipment"><file name="View.php" hash="edc39b75e3b0e69ae5dc122c4078ac7a"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="9dfca5f43c00ccab5f1f5b8ac5445c8e"/></dir><dir name="Model"><file name="Api.php" hash="fd8bd87f5798e5da81a1d5dcdf58f020"/><file name="Carrier.php" hash="9ec19dc45a524f9d96e48ce3d6c06a06"/><file name="Observer.php" hash="1e61ca4d0cb36d73137d4110ad4070b6"/><file name="Shipping.php" hash="5f3ceaa12a412f8c9bcf50551292dcf7"/></dir><dir name="etc"><file name="config.xml" hash="c08e8265216b90763ed228664997bc8b"/><file name="system.xml" hash="ed221153d603cfa5f3bfaae51d5ab896"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="postpal"><file name="shipping.xml" hash="cbc63d0c8072bf83685e9a19db8aeaac"/></dir></dir><dir name="template"><dir name="postpal"><file name="extras.phtml" hash="8bad02b894d8fc8da8dbd5729dfceff1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PostPal_Shipping.xml" hash="8336b32b2ec54a8ebf90029265ab5729"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="PostPal_Shipping.csv" hash="50052dc9f9a55bc8a4ff56ce43606eff"/></dir><dir name="et_EE"><file name="PostPal_Shipping.csv" hash="d9d64841396d1a0fb705246409ea7933"/></dir></dir></target></contents>
|
| 17 |
<compatible/>
|
| 18 |
<dependencies><required><php><min>5.3.0</min><max>7.0.0</max></php><extension><name>json</name><min/><max/></extension></required></dependencies>
|
| 19 |
</package>
|
skin/frontend/base/default/postpal/js/opcheckout_postpal.js
CHANGED
|
@@ -1,42 +1,45 @@
|
|
| 1 |
-
Review
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
this.isSuccess = true;
|
| 11 |
-
location.href = response.redirect;
|
| 12 |
-
return;
|
| 13 |
-
}
|
| 14 |
-
if (response.success) {
|
| 15 |
-
this.isSuccess = true;
|
| 16 |
-
window.location=this.successUrl;
|
| 17 |
-
}
|
| 18 |
-
else{
|
| 19 |
-
var msg = response.error_messages;
|
| 20 |
-
if (typeof(msg)=='object') {
|
| 21 |
-
msg = msg.join("\n");
|
| 22 |
}
|
| 23 |
-
if (
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
}
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
}
|
| 31 |
}
|
| 32 |
-
}
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
|
|
|
| 40 |
}
|
| 41 |
}
|
| 42 |
}
|
| 1 |
+
if(typeof Review != 'undefined') {
|
| 2 |
+
|
| 3 |
+
Review.prototype.nextStep = function (transport) {
|
| 4 |
+
if (transport && transport.responseText) {
|
| 5 |
+
try {
|
| 6 |
+
response = eval('(' + transport.responseText + ')');
|
| 7 |
+
}
|
| 8 |
+
catch (e) {
|
| 9 |
+
response = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
}
|
| 11 |
+
if (response.redirect) {
|
| 12 |
+
this.isSuccess = true;
|
| 13 |
+
location.href = response.redirect;
|
| 14 |
+
return;
|
| 15 |
+
}
|
| 16 |
+
if (response.success) {
|
| 17 |
+
this.isSuccess = true;
|
| 18 |
+
window.location = this.successUrl;
|
| 19 |
+
}
|
| 20 |
+
else {
|
| 21 |
+
var msg = response.error_messages;
|
| 22 |
+
if (typeof(msg) == 'object') {
|
| 23 |
+
msg = msg.join("\n");
|
| 24 |
}
|
| 25 |
+
if (msg) {
|
| 26 |
+
msg = msg.replace(new RegExp((';').replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"), 'g'), '<br />');
|
| 27 |
+
if ($('checkout-step-review') != null) {
|
| 28 |
+
$('checkout-step-review').update('<div class="error postpal_error_wrapper" id="checkoutError">' + msg + '<span class="postpal_error_close">x</span></div>' + $('checkout-step-review').innerHTML);
|
| 29 |
+
}
|
| 30 |
+
else {
|
| 31 |
+
alert(msg);
|
| 32 |
+
}
|
| 33 |
}
|
| 34 |
}
|
|
|
|
| 35 |
|
| 36 |
+
if (response.update_section) {
|
| 37 |
+
$('checkout-' + response.update_section.name + '-load').update(response.update_section.html);
|
| 38 |
+
}
|
| 39 |
|
| 40 |
+
if (response.goto_section) {
|
| 41 |
+
checkout.gotoSection(response.goto_section, true);
|
| 42 |
+
}
|
| 43 |
}
|
| 44 |
}
|
| 45 |
}
|
