This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added files ignored in previous commit
- Loading branch information
Showing
9 changed files
with
744 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
153 changes: 153 additions & 0 deletions
153
...ode/community/Webshopapps/Matrixrate/Block/Adminhtml/Shipping/Carrier/Matrixrate/Grid.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?php | ||
|
||
|
||
class Webshopapps_Matrixrate_Block_Adminhtml_Shipping_Carrier_Matrixrate_Grid extends Mage_Adminhtml_Block_Widget_Grid | ||
{ | ||
|
||
/** | ||
* Prepare table columns | ||
* | ||
* @return Mage_Adminhtml_Block_Widget_Grid | ||
*/ | ||
protected function _prepareColumns() | ||
{ | ||
$this->addColumn('dest_country', array( | ||
'header' => Mage::helper('adminhtml')->__('Country'), | ||
'index' => 'dest_country', | ||
'default' => '*', | ||
)); | ||
|
||
$this->addColumn('dest_region', array( | ||
'header' => Mage::helper('adminhtml')->__('Region/State'), | ||
'index' => 'dest_region', | ||
'default' => '*', | ||
)); | ||
|
||
$this->addColumn('dest_city', array( | ||
'header' => Mage::helper('adminhtml')->__('City'), | ||
'index' => 'dest_city', | ||
'default' => '*', | ||
)); | ||
|
||
$this->addColumn('dest_zip', array( | ||
'header' => Mage::helper('adminhtml')->__('Zip/Postal Code From'), | ||
'index' => 'dest_zip', | ||
)); | ||
|
||
$this->addColumn('dest_zip_to', array( | ||
'header' => Mage::helper('adminhtml')->__('Zip/Postal Code To'), | ||
'index' => 'dest_zip_to', | ||
)); | ||
|
||
|
||
$label = Mage::getSingleton('matrixrate/carrier_matrixrate') | ||
->getCode('condition_name_short', $this->getConditionName()); | ||
|
||
$this->addColumn('condition_from_value', array( | ||
'header' => $label.' From', | ||
'index' => 'condition_from_value', | ||
)); | ||
|
||
$this->addColumn('condition_to_value', array( | ||
'header' => $label.' To', | ||
'index' => 'condition_to_value', | ||
)); | ||
|
||
$this->addColumn('price', array( | ||
'header' => Mage::helper('adminhtml')->__('Shipping Price'), | ||
'index' => 'price', | ||
)); | ||
|
||
$this->addColumn('delivery_type', array( | ||
'header' => Mage::helper('adminhtml')->__('Delivery Type'), | ||
'index' => 'delivery_type', | ||
)); | ||
|
||
return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns(); | ||
} | ||
|
||
protected function _prepareCollection() | ||
{ | ||
$collection = Mage::getResourceModel('matrixrate_shipping/carrier_matrixrate_collection'); | ||
$collection->setConditionFilter($this->getConditionName()) | ||
->setWebsiteFilter($this->getWebsiteId()); | ||
|
||
$this->setCollection($collection); | ||
|
||
return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection(); | ||
} | ||
|
||
/** | ||
* Website filter | ||
* | ||
* @var int | ||
*/ | ||
protected $_websiteId; | ||
|
||
/** | ||
* Condition filter | ||
* | ||
* @var string | ||
*/ | ||
protected $_conditionName; | ||
|
||
/** | ||
* Define grid properties | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->setId('shippingTablerateGrid'); | ||
$this->_exportPageSize = 10000; | ||
} | ||
|
||
/** | ||
* Set current website | ||
* | ||
* @param int $websiteId | ||
* @return Mage_Adminhtml_Block_Shipping_Carrier_Tablerate_Grid | ||
*/ | ||
public function setWebsiteId($websiteId) | ||
{ | ||
$this->_websiteId = Mage::app()->getWebsite($websiteId)->getId(); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Retrieve current website id | ||
* | ||
* @return int | ||
*/ | ||
public function getWebsiteId() | ||
{ | ||
if (is_null($this->_websiteId)) { | ||
$this->_websiteId = Mage::app()->getWebsite()->getId(); | ||
} | ||
return $this->_websiteId; | ||
} | ||
|
||
/** | ||
* Set current website | ||
* | ||
* @param int $websiteId | ||
* @return Mage_Adminhtml_Block_Shipping_Carrier_Tablerate_Grid | ||
*/ | ||
public function setConditionName($name) | ||
{ | ||
$this->_conditionName = $name; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Retrieve current website id | ||
* | ||
* @return int | ||
*/ | ||
public function getConditionName() | ||
{ | ||
return $this->_conditionName; | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
...ommunity/Webshopapps/Matrixrate/Block/Adminhtml/System/Config/Form/Field/Exportmatrix.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* Magento | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@magentocommerce.com so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Magento to newer | ||
* versions in the future. If you wish to customize Magento for your | ||
* needs please refer to http://www.magentocommerce.com for more information. | ||
* | ||
* @category Mage | ||
* @package Mage_Adminhtml | ||
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
/** | ||
* Export CSV button for shipping table rates | ||
* | ||
* @category Mage | ||
* @package Mage_Adminhtml | ||
* @author Magento Core Team <core@magentocommerce.com> | ||
*/ | ||
class Webshopapps_Matrixrate_Block_Adminhtml_System_Config_Form_Field_Exportmatrix extends Mage_Adminhtml_Block_System_Config_Form_Field | ||
|
||
{ | ||
|
||
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) | ||
{ | ||
$this->setElement($element); | ||
|
||
$buttonBlock = $this->getLayout()->createBlock('adminhtml/widget_button'); | ||
|
||
$params = array( | ||
'website' => $buttonBlock->getRequest()->getParam('website') | ||
); | ||
|
||
$data = array( | ||
'label' => Mage::helper('adminhtml')->__('Export CSV'), | ||
|
||
'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl("*/*/exportmatrix", $params) . 'conditionName/\' + $(\'carriers_matrixrate_condition_name\').value + \'/matrixrate.csv\' )', | ||
'class' => '', | ||
); | ||
|
||
$html = $buttonBlock->setData($data)->toHtml(); | ||
|
||
return $html; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* Magento | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@magentocommerce.com so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Magento to newer | ||
* versions in the future. If you wish to customize Magento for your | ||
* needs please refer to http://www.magentocommerce.com for more information. | ||
* | ||
* @category Mage | ||
* @package Mage_Shipping | ||
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
/** | ||
* Webshopapps Shipping Module | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@magentocommerce.com so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Magento to newer | ||
* versions in the future. If you wish to customize Magento for your | ||
* needs please refer to http://www.magentocommerce.com for more information. | ||
* | ||
* Shipping MatrixRates | ||
* | ||
* @category Webshopapps | ||
* @package Webshopapps_Matrixrate | ||
* @copyright Copyright (c) 2010 Zowta Ltd (http://www.webshopapps.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @author Karen Baker <sales@webshopapps.com> | ||
*/ | ||
|
||
/** | ||
* Shipping data helper | ||
*/ | ||
class Webshopapps_Matrixrate_Helper_Data extends Mage_Core_Helper_Abstract | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
5.0 Ammended numeric zip-from/to search to use ints and BETWEEN logic | ||
Changed free shipping logic to allow items to be included in calculations even if marked as free shipping | ||
Changed setconditionname to stop conflict with tablerates |
59 changes: 59 additions & 0 deletions
59
app/code/community/Webshopapps/Matrixrate/controllers/System/ConfigController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* Magento | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@magentocommerce.com so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Magento to newer | ||
* versions in the future. If you wish to customize Magento for your | ||
* needs please refer to http://www.magentocommerce.com for more information. | ||
* | ||
* @category Mage | ||
* @package Mage_Adminhtml | ||
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
|
||
/** | ||
* config controller | ||
* | ||
* @category Mage | ||
* @package Mage_Adminhtml | ||
* @author Magento Core Team <core@magentocommerce.com> | ||
*/ | ||
class Webshopapps_Matrixrate_System_ConfigController extends Mage_Adminhtml_Controller_Action | ||
{ | ||
|
||
|
||
/** | ||
* Export shipping table rates in csv format | ||
* | ||
*/ | ||
public function exportmatrixAction() | ||
{ | ||
$fileName = 'matrixrates.csv'; | ||
/** @var $gridBlock Mage_Adminhtml_Block_Shipping_Carrier_Tablerate_Grid */ | ||
$gridBlock = $this->getLayout()->createBlock('matrixrate_adminhtml/shipping_carrier_matrixrate_grid'); | ||
$website = Mage::app()->getWebsite($this->getRequest()->getParam('website')); | ||
if ($this->getRequest()->getParam('conditionName')) { | ||
$conditionName = $this->getRequest()->getParam('conditionName'); | ||
} else { | ||
$conditionName = $website->getConfig('carriers/matrixrate/condition_name'); | ||
} | ||
$gridBlock->setWebsiteId($website->getId())->setConditionName($conditionName); | ||
$content = $gridBlock->getCsvFile(); | ||
$this->_prepareDownloadResponse($fileName, $content); | ||
} | ||
|
||
} |
Oops, something went wrong.