나는 마침내 나의 첫번째 확장을 여기의 모두의 덕택으로 지어 줬다! 확장 기능을 관리 영역의 탭으로 추가 할 수있었습니다. 사용 가능 또는 사용 불가를 말하는 메뉴가 있습니다. 이 기능을 사용하여 고객이이 확장 기능으로 더 많은 제어 권한을 부여하도록하고 싶습니다. 언급되기 전에 고급 메뉴에서 확장을 사용하거나 사용하지 않도록 설정할 수 있음을 알고 있습니다. 그러나 대부분의 Magento 고객은 그렇지 않습니다. 내 광고 확장에 직접 추가하고 싶습니다.맞춤 magento 확장. 옵션을 활성화하거나 비활성화하려면 어떻게 추가합니까?
모듈을 사용하는 경우 checkout/cart/shipping.phtml에있는 shipping.phtml 파일을 내 맞춤 배송 템플릿으로 덮어 쓰고 싶습니다.
- 어떻게 내 드롭 다운 상자를 활성화 또는 비활성화 할 수 있습니까?
등/system.xml을
<?xml version="1.0"?>
<config>
<tabs>
<beckinconfig translate="label" module="dropdownshipping">
<label>Beckin Extensions</label>
<sort_order>100</sort_order>
</beckinconfig>
</tabs>
<sections>
<dropdownshipping translate="label" module="dropdownshipping">
<label>Drop Down Shipping Options</label>
<tab>beckinconfig</tab>
<frontend_type>text</frontend_type>
<sort_order>1000</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<general>
<label>General</label>
<frontend_type>text</frontend_type>
<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>
<fields>
<enable translate="label">
<label>Enable</label>
<comment>
<![CDATA[Enable or Disable this extension.]]>
</comment>
<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>
</enable>
</fields>
</general>
</groups>
</dropdownshipping>
</sections>
</config>
등/config.xml에
<?xml version="1.0"?>
<config>
<modules>
<Beckin_DropDownShipping><version>1.0.0</version></Beckin_DropDownShipping>
</modules>
<global>
<blocks>
<beckin_dropdownshipping>
<class>Beckin_DropDownShipping_Block</class>
</beckin_dropdownshipping>
</blocks>
<helpers>
<beckin_dropdownshipping>
<class>Beckin_DropDownShipping_Helper</class>
</beckin_dropdownshipping>
</helpers>
</global>
<frontend>
<layout>
<updates>
<beckin>
<file><!-- beckin_dropdownshipping.xml --></file>
</beckin>
</updates>
</layout>
<routers>
<dropdownshipping>
<use>standard</use>
<args>
<module>Beckin_DropDownShipping</module>
<frontName>dropdownshipping</frontName>
</args>
</dropdownshipping>
</routers>
</frontend>
<adminhtml>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<dropdownshipping_options>
<title>Beckin Drop Down Shipping Extension</title>
</dropdownshipping_options>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</adminhtml>
</config>
도우미/Data.php
<?php
class Beckin_DropDownShipping_Helper_Data extends Mage_Core_Helper_Abstract
{
}
블록/장바구니 : 다음은 내 코드입니다 /Shipping.php
<?php
class Beckin_DropDownShipping_Block_Cart_Shipping extends Mage_Checkout_Block_Cart_Shipping
{
protected function _construct()
{
if(Mage::getStoreConfig('beckin/dropdownshipping_options/enable', Mage::app()->getStore()->getId()){
{
$this->setTemplate('Beckin/dropdownshipping/drop_down_shipping.phtml');
}
else
{
$this->setTemplate('checkout/cart/shipping.phtml');
}
}
}
도움을 주셔서 감사합니다 !! 내 확장 기능이 위치한 system/config 섹션으로 이동하면 이제 빈 관리 페이지가 나타납니다. 나는 그것이 내가 놓치고있는 것이 단순한 것이라고 확신한다. 부적절하다고 생각하는 템플릿 파일을 제외하고는 위의 모든 파일을 포함 시켰습니다. 내 실수를 발견 할 수 있습니까? 페이지가 비어있는 대신 나에게 오류가 표시되기를 바랐다. (
감사합니다. 명확한 설명을 위해, 내 모듈이 내 템플릿으로 활성화 된 경우 장바구니 배송 템플릿을 무시하고 싶습니다. 귀하의 지시를 따르려고했지만 내 확장이 위치한 system/config 섹션으로 갈 때 지금 빈 관리 페이지가 나타납니다. 나는 그것이 내가 놓치고있는 것이 단순한 것이라고 확신한다. 부적절하다고 생각하는 템플릿 파일을 제외하고는 위의 모든 파일을 포함 시켰습니다. 내 실수를 발견 할 수 있습니까? 추신 그 이후로 좀 더 편집하기 위해 약간의 편집 작업을했습니다.나는 그 페이지가 비어있는 대신에 오류 메시지를 보여주기를 바랐다. ( –
문제점/미래 이슈를 일으킬 수있는 한 가지는' 이다. beckin translate = "label"module = "dropdownshipping">' 더 이상 Model/Enable.php가 필요하지 않습니다. getCfgGeneral()을 사용하고 있지 않습니다. –
또한 오류 로그를 확인하여 오류가 있는지 확인하십시오. 나는 블록/장바구니/Shipping.php를 다시 작성하는 곳을보고 싶지 않습니다. layout.xml에서'type = 'dropdownshipping/cart_shipping'블록을 사용하고 있습니까? –