2

I am overriding Usa\Model\Shipping\Carrier\Ups.php but its not working. i want update this function collectRates() code below

what's the problem

app/etc/modules/TechnikExpert_Usa.xml
<?xml version="1.0"?>
<config>
  <modules>
    <TechnikExpert_Usa>
      <active>true</active>
      <codePool>local</codePool>
    </TechnikExpert_Usa>
  </modules>
</config>


app\code\local\TechnikExpert\Usa\etc\config.xml
<?xml version="1.0"?>
<config>
  <modules>
    <TechnikExpert_Usa>
      <version>0.1</version>
    </TechnikExpert_Usa>
  </modules>
  <global>
    <models>
      <usa>
        <rewrite>
          <shipping_carrier_ups>TechnikExpert_Usa_Model_Shipping_Carrier_Ups</shipping_carrier_ups>     
      </usa>
    </models>
  </global>
</config>

app\code\local\TechnikExpert\Usa\Model\Shipping\Carrier\Ups.php

<?php
 class TechnikExpert_Usa_Model_Shipping_Carrier_Ups extends Mage_Usa_Model_Shipping_Carrier_Ups
{

    const CODE = 'ups';

    /**
     * Delivery Confirmation level based on origin/destination
     *
     * @var int
     */
    const DELIVERY_CONFIRMATION_SHIPMENT = 1;
    const DELIVERY_CONFIRMATION_PACKAGE = 2;

    /**
     * Code of the carrier
     *
     * @var string
     */
    protected $_code = self::CODE;

    /**
     * Rate request data
     *
     * @var Mage_Shipping_Model_Rate_Request|null
     */
    protected $_request = null;

    /**
     * Raw rate request data
     *
     * @var Varien_Object|null
     */
    protected $_rawRequest = null;

    /**
     * Rate result data
     *
     * @var Mage_Shipping_Model_Rate_Result|null
     */
    protected $_result = null;

    /**
     * Base currency rate
     *
     * @var double
     */
    protected $_baseCurrencyRate;

    /**
     * Xml access request
     *
     * @var string
     */
    protected $_xmlAccessRequest = null;

    /**
     * Default cgi gateway url
     *
     * @var string
     */
    protected $_defaultCgiGatewayUrl = 'http://www.ups.com:80/using/services/rave/qcostcgi.cgi';

    /**
     * Default urls for XML
     *
     * @var array
     */
    protected $_defaultUrls = array(
        'Rate'        => 'https://onlinetools.ups.com/ups.app/xml/Rate',
        'Track'       => 'https://onlinetools.ups.com/ups.app/xml/Track',
        'ShipConfirm' => 'https://onlinetools.ups.com/ups.app/xml/ShipConfirm',
        'ShipAccept'  => 'https://onlinetools.ups.com/ups.app/xml/ShipAccept',
    );

    /**
     * Container types that could be customized for UPS carrier
     *
     * @var array
     */
    protected $_customizableContainerTypes = array('CP', 'CSP');

    /**
     * Collect and get rates
     *
     * @param Mage_Shipping_Model_Rate_Request $request
     * @return Mage_Shipping_Model_Rate_Result|bool|null
     */

    public function collectRates(Mage_Shipping_Model_Rate_Request $request)
    {
         die('function called');  
    }
} 
  • what version are you working on? – TBI Infotech Jul 28 '14 at 15:36
5

You did not close rewrite tag. Try this:

<?xml version="1.0"?> <config> <modules> <TechnikExpert_Usa> <version>0.1</version> </TechnikExpert_Usa> </modules> <global> <models> <usa> <rewrite> <shipping_carrier_ups>TechnikExpert_Usa_Model_Shipping_Carrier_Ups</shipping_carrier_ups> </rewrite> </usa> </models> </global> </config>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.