1

I am receiving the following error, and I do not understand why. Any ideas or suggestions are greatly appreciated, I have been banging my head against my desk for the past couple of hours, and I am not sure what to do next.

Warning: include(VMR/Czechposta/Model/Rate/Request.php): failed to open stream: No such file or directory in /jlr/sites/mage/lib/Varien/Autoload.php on line 93

My config.xml looks like

<config>
    <modules>
        <VMR_Czechposta>
            <version>1.6.0.0</version>
            <depends><Mage_Shipping /></depends>

        </VMR_Czechposta>
    </modules>
    <global>
        <models>
            <shipping>
                <class>VMR_Czechposta_Model</class>
            </shipping>
        </models>
          <default>
              <carriers>
                  <czechposta>
                      <active>1</active>
                      <sallowspecific>0</sallowspecific>
                      <model>czechposta/carrier_czechposta</model>
                      <name>Fixed</name>
                      <price>5.00</price>
                      <title>Czech Posta</title>
                      <type>I</type>
                  <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this     shipping method, please contact us.</specificerrmsg>
                      <handling_type>F</handling_type>
                  </czechposta>
              </carriers>
          </default>
      </global>
</config>

And my Model looks like

class VMR_Czechposta_Model_Carrier_Czechposta
    extends Mage_Shipping_Model_Carrier_Abstract
    implements Mage_Shipping_Model_Carrier_Interface
{

    protected $_code = 'czechposta';
    protected $_isFixed = true;

    /**
     * Enter description here...
     *
     * @param Mage_Shipping_Model_Rate_Request $data
     * @return Mage_Shipping_Model_Rate_Result
     */
    public function collectRates(Mage_Shipping_Model_Rate_Request $request)
    {
        if (!$this->getConfigFlag('active')) {
            return false;
        }

        $freeBoxes = 0;
        if ($request->getAllItems()) {
            foreach ($request->getAllItems() as $item) {

                if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
                    continue;
                }

                if ($item->getHasChildren() && $item->isShipSeparately()) {
                    foreach ($item->getChildren() as $child) {
                        if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
                            $freeBoxes += $item->getQty() * $child->getQty();
                        }
                    }
                } elseif ($item->getFreeShipping()) {
                    $freeBoxes += $item->getQty();
                }
            }
        }
        $this->setFreeBoxes($freeBoxes);

        $result = Mage::getModel('shipping/rate_result');
        if ($this->getConfigData('type') == 'O') { // per order
            $shippingPrice = $this->getConfigData('price');
        } elseif ($this->getConfigData('type') == 'I') { // per item
        $shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this-    >getConfigData('price'));
        } else {
            $shippingPrice = false;
        }

        $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);

        if ($shippingPrice !== false) {
            $method = Mage::getModel('shipping/rate_result_method');

            $method->setCarrier('czechposta');
            $method->setCarrierTitle($this->getConfigData('title'));

            $method->setMethod('czechposta');
            $method->setMethodTitle($this->getConfigData('name'));

            if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
                $shippingPrice = '0.00';
            }


            $method->setPrice($shippingPrice);
            $method->setCost($shippingPrice);

            $result->append($method);
        }

        return $result;
    }

    public function getAllowedMethods()
    {
        return array('czechposta'=>$this->getConfigData('name'));
    }

}

1 Answer 1

2

This code is the problem:

<models>
    <shipping>
        <class>VMR_Czechposta_Model</class>
    </shipping>
</models>

By adding that to your config.xml you just told Magento you have overwritten every model that starts with shipping. Basically now Mage::getModel('shipping/...') will look for the model in your module.
I think what you need is this:

<models>
    <czechposta>
        <class>VMR_Czechposta_Model</class>
    </czechposta>
</models>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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