/ Published in: PHP
In this tutorial, we are going to see how to create a shipping method with form fields.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class Excellence_Pickup_Model_Carrier_Pickup extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface { protected $_code = 'pickup'; public function getFormBlock(){ return 'pickup/pickup'; } public function collectRates(Mage_Shipping_Model_Rate_Request $request) { if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) { return false; } $handling = Mage::getStoreConfig('carriers/'.$this->_code.'/handling'); $result = Mage::getModel('shipping/rate_result'); $method = Mage::getModel('shipping/rate_result_method'); $method->setCarrier($this->_code); $method->setMethod($this->_code); $method->setCarrierTitle($this->getConfigData('title')); $method->setMethodTitle($this->getConfigData('name')); $method->setPrice($this->getConfigData('price')); $method->setCost($this->getConfigData('price')); $result->append($method); return $result; } public function getAllowedMethods() { } }
URL: http://www.excellencemagentoblog.com/magento-advanced-shipping-method-development