работы с Magento 1.9.0.1 Я свой собственный модуль, как этот tutorialMagento пользовательский модуль доставка - Фатальная ошибка: Вызов функции члена setStore()
Я последовал за этот шаг за шагом учебник, но в моем сервере производства Безразлично Не работай.
В корзине на веб-интерфейсе я получаю ошибку: Фатальная ошибка: Вызов функции члена setStore() на не-объект в /var/www/html/includes/src/Mage_Shipping_Model_Shipping.php на линии 424
Здесь я без труда прочитал много вопросов. Подобно этому question Я очистил кеш, отключил и включил компилятор, я скомпилировал его через терминал и т. Д., Но ошибка все еще здесь.
Вот код:
/app/etc/modules/Company_Module.xml
<?xml version="1.0"?>
<config>
<modules>
<Company_Module>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Shipping />
</depends>
</Company_Module>
</modules>
</config>
/app/code/local/Company/Module/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Company_Module>
<module>0.0.1</module>
</Company_Module>
</modules>
<global>
<models>
<company_module>
<class>Company_Module_Model</class>
</company_module>
</models>
</global>
<!-- Default configuration -->
<default>
<carriers>
<company_module>
<active>1</active>
<!--
This configuration should not be made visible
to the administrator, because it specifies
the model to be used for this carrier.
-->
<model>company_module/carrier</model>
<!--
The title as referenced in the carrier class
-->
<title>Transporte Test</title>
<sort_order>10</sort_order>
<sallowspecific>0</sallowspecific>
</company_module>
</carriers>
</default>
</config>
/app/code/local/Company/Module/etc/system.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sections>
<carriers translate="label" module="shipping">
<groups>
<company_module translate="label">
<label>Transporte Test</label>
<frontend_type>text</frontend_type>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<active translate="label">
<label>Enabled</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</active>
<title translate="label">
<label>Title</label>
<frontend_type>text</frontend_type>
<sort_order>2</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</title>
<sort_order translate="label">
<label>Sort Order</label>
<frontend_type>text</frontend_type>
<sort_order>100</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</sort_order>
<sallowspecific translate="label">
<label>Transporte aplicado a los siguientes paises</label>
<frontend_type>select</frontend_type>
<sort_order>90</sort_order>
<frontend_class>shipping-applicable-country</frontend_class>
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</sallowspecific>
<specificcountry translate="label">
<label>Envio a países especificos</label>
<frontend_type>multiselect</frontend_type>
<sort_order>91</sort_order>
<source_model>adminhtml/system_config_source_country</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
<can_be_empty>1</can_be_empty>
</specificcountry>
</fields>
</company_module>
</groups>
</carriers>
</sections>
</config>
/app/code/local/Company/Module/Model/carrier.php
<?php
class Company_Module_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
{
protected $_code = 'company_module';
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
$result = Mage::getModel('shipping/rate_result');
/* @var $result Mage_Shipping_Model_Rate_Result */
$result->append($this->_getStandardShippingRate());
return $result;
}
protected function _getStandardShippingRate()
{
$rate = Mage::getModel('shipping/rate_result_method');
// @var $rate Mage_Shipping_Model_Rate_Result_Method
$rate->setCarrier($this->_code);
//
// getConfigData(config_key) returns the configuration value for the
// carriers/[carrier_code]/[config_key]
//
$rate->setCarrierTitle($this->getConfigData('title'));
$rate->setMethod('standand');
$rate->setMethodTitle('Standard, de 5 a 10 días');
$rate->setPrice(14000);
$rate->setCost(0);
return $rate;
}
public function getAllowedMethods()
{
return array(
'standard' => 'Standard'
);
}
public function isTrackingAvailable()
{
return true;
}
}
Что происходит с отключенным компилятором? – zhartaunik
Очистить и отключить через терминал и mydomain.com/checkout/cart -> пустую страницу с этим: Неустранимая ошибка: вызвать функцию-член setStore() для не-объекта в/var/www/html/includes/src/Mage_Shipping_Model_Shipping.php в строке 424 – Unknown
Когда вы отключите компилятор magento, не следует использовать папку includes/src. Может быть, у вас есть APC/Varnish или, возможно, вы отключите кеш в другом пурпуре? – zhartaunik