1

magento への新しい配送方法を実装するモジュールを作成しました。現在、モジュールは正常に動作しています。

配送方法は、1 ページのチェックアウトに表示されます。

class Tigerbytes_Barverkauf_Model_Carrier_Selbstabholung extends Mage_Shipping_Model_Carrier_Abstract

今、私は機能を拡張したいと考えています。新しい出荷モジュールはフロントエンドに表示されなくなります。したがって、モジュールに新しい属性を追加しました。(show_frontend)

config.xml

<default>
        <carriers>
            <selbstabholung>
                <active>1</active>
                <allowed_methods>selbstabholung</allowed_methods>
                <methods>selbstabholung</methods>
                <sallowspecific>0</sallowspecific>
                <model>Tigerbytes_Barverkauf_Model_Carrier_Selbstabholung</model>
                <name>Selbstabholung</name>
                <title>Selbstabholung</title>
                <specificerrmsg>Zur Zeit ist die Versandmethode nicht verfuegbar</specificerrmsg>
                <handling>0</handling>
                <handling_type>F</handling_type>
                <show_frontend>0</show_frontend>
            </selbstabholung>
        </carriers>

    system.xml
<show_frontend translate="label">
                            <label>zeige im Frontend?</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>1</show_in_store>
                        </show_frontend>

属性 show_frontend はバックエンドに表示され、core_config_data テーブルにも保存されます。

ここでの大きな問題は、ユーザー選択のためにワンページ チェックアウトの配送方法を取得するときに、オブジェクトに show_frontend 属性がないことです。

発送方法リストに使われている物は

Mage_Sales_Model_Quote_Address_Rate

では、rate オブジェクトが show_frontend 属性を認識できるようにするには、何を拡張する必要があるのでしょうか?

4

2 に答える 2

1

モジュールにすべて挿入していますか?

早くやれよ:

collectRates() メソッドに次のコードを配置します。

if(!Mage::getStoreConfig('carrier/selbstabholung/show_frontend'))
    return false;

このコードは仕事をするはずです。

良い一日。

于 2012-11-27T12:08:43.907 に答える
0

附属書:

フロントエンドで配送方法を表示できるようにしたいだけです。バックエンド注文のバックエンドで表示したい。

したがって、collectRates() メソッドで、次の条件を実装しました。

if(Mage::getDesign()->getArea() === Mage_Core_Model_App_Area::AREA_FRONTEND &&
        !Mage::getStoreConfig('carriers/'.$this->_code.'/show_frontend')){

        return false;
    }

今では完璧に機能しています!

于 2012-11-27T13:37:10.847 に答える