2011-08-15 1 views
1

필요한 항목 : "content"가 아닌 "right"섹션의 "addtocart"및 "product_type_data"블록Magento - "product.info"블록을 사이드 바에 복제하고 조건부 제품 유형 데이터를 포함하십시오.

내가 시도한 것 : sidebar.phtml이라는 블록에 대한 새 파일을 만든 다음이 파일을 내 테마 (내 블록 안에 .xml 파일이 잘 작동 함)에있는 local.xml에 삽입했습니다.

이 어느 정도 작동
<default> 

     <reference name="right"> 
      <action method="unsetChildren"></action><!-- remove all blocks --> 

      <block type="catalog/product_view" name="product.sidebar" template="catalog/product/view/sidebar.phtml"> 

       <block type="catalog/product_view" name="product.sidebar.options.wrapper" as="product_options_wrapper" template="catalog/product/view/options/wrapper.phtml" translate="label"> 
        <label>Info Column Options Wrapper</label> 
        <block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/> 
        <block type="catalog/product_view_options" name="product.sidebar.options" as="product_options" template="catalog/product/view/options.phtml"> 
         <action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action> 
         <action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action> 
         <action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action> 
         <action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action> 
       </block> 
         <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/> 
        </block> 
       <block type="catalog/product_view" name="product.sidebar.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label"> 
        <label>Bottom Block Options Wrapper</label> 
        <action method="insert"><block>product.tierprices</block></action> 
        <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/> 
        <action method="append"><block>product.sidebar.addtocart</block></action> 
        <action method="append"><block>product.sidebar.addto</block></action> 
       </block> 

       <block type="core/template_facade" name="product.sidebar.container1" as="container1"> 
        <action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action> 
        <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action> 
        <action method="append"><block>product.sidebar.options.wrapper</block></action> 
        <action method="append"><block>product.sidebar.options.wrapper.bottom</block></action> 
       </block> 
       <block type="core/template_facade" name="product.sidebar.container2" as="container2"> 
        <action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action> 
        <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action> 
        <action method="append"><block>product.sidebar.options.wrapper</block></action> 
        <action method="append"><block>product.sidebar.options.wrapper.bottom</block></action> 
       </block> 
       <action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action> 
       <action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action> 

      </block> 

     </reference> 


    </default> 

<!-- 
    Additional block dependant on product type 
    --> 
    <PRODUCT_TYPE_simple translate="label" module="catalog"> 
     <label>Catalog Product View (Simple)</label> 
     <reference name="product.sidebar"> 
      <block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data" template="catalog/product/view/type/default.phtml"> 
       <block type="core/text_list" name="product.info.simple.extra" as="product_type_data_extra" translate="label"> 
        <label>Product Extra Info</label> 
       </block> 
      </block> 
     </reference> 
    </PRODUCT_TYPE_simple> 
    <PRODUCT_TYPE_configurable translate="label" module="catalog"> 
     <label>Catalog Product View (Configurable)</label> 
     <reference name="product.sidebar"> 
      <block type="catalog/product_view_type_configurable" name="product.info.configurable" as="product_type_data" template="catalog/product/view/type/default.phtml"> 
       <block type="core/text_list" name="product.info.configurable.extra" as="product_type_data_extra" translate="label"> 
        <label>Product Extra Info</label> 
       </block> 
      </block> 
     </reference> 
     <reference name="product.sidebar.options.wrapper"> 
      <block type="catalog/product_view_type_configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable.phtml"/> 
     </reference> 
    </PRODUCT_TYPE_configurable> 
    <PRODUCT_TYPE_grouped translate="label" module="catalog"> 
     <label>Catalog Product View (Grouped)</label> 
     <reference name="product.sidebar"> 
      <block type="catalog/product_view_type_grouped" name="product.info.grouped" as="product_type_data" template="catalog/product/view/type/grouped.phtml"> 
       <block type="core/text_list" name="product.info.grouped.extra" as="product_type_data_extra" translate="label"> 
        <label>Product Extra Info</label> 
       </block> 
      </block> 
     </reference> 
    </PRODUCT_TYPE_grouped> 
    <PRODUCT_TYPE_virtual translate="label" module="catalog"> 
     <label>Catalog Product View (Virtual)</label> 
     <reference name="product.sidebar"> 
      <block type="catalog/product_view_type_virtual" name="product.info.virtual" as="product_type_data" template="catalog/product/view/type/default.phtml"> 
       <block type="core/text_list" name="product.info.virtual.extra" as="product_type_data_extra" translate="label"> 
        <label>Product Extra Info</label> 
       </block> 
      </block> 
     </reference> 
    </PRODUCT_TYPE_virtual> 

는, 내 사이드에 "addToCart와"블록과 옵션 래퍼 등을 추가 만에 "product_type_data"블록을 추가 나던, 그래서 feeli했습니다 NG

또한 내 sidebar.phtml 파일은 다음과 같다 ... 거기에 그 조건 태그에 뭔가 문제가 될하지만 내 XML의 지식은 매우 제한되어 있습니다 :

<?php $_helper = $this->helper('catalog/output'); ?> 
<?php $_product = $this->getProduct(); ?> 

    <!-- Product Type Options Start --> 
      <?php echo $this->getChildHtml('product_type_data') ?> 
     <!-- Product Type Options End --> 

     <?php echo $this->getTierPriceHtml() ?> 

     <!-- container1 --> 
     <?php if ($_product->isSaleable() && $this->hasOptions()):?> 
      <?php echo $this->getChildChildHtml('container1', '', true, true) ?> 
     <?php endif;?> 

     <!-- container2 --> 
     <?php if ($_product->isSaleable() && $this->hasOptions()):?> 
      <?php echo $this->getChildChildHtml('container2', '', true, true) ?> 
     <?php endif;?> 

어떤 도움이 대규모 도움이 될 것입니다.

<reference name="right"> 
       <block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="catalog/product/view/options/wrapper.phtml" translate="label"> 
       <label>Info Column Options Wrapper</label> 
       <block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/> 
       <block type="catalog/product_view_options" name="product.info.options" as="product_options" template="catalog/product/view/options.phtml"> 
        <action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action> 
        <action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action> 
        <action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action> 
        <action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action> 
      </block> 
        <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/> 
       </block> 
      <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label"> 
       <label>Bottom Block Options Wrapper</label> 
       <action method="insert"><block>product.tierprices</block></action> 
       <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/> 
       <action method="append"><block>product.info.addtocart</block></action> 
       <action method="append"><block>product.info.addto</block></action> 
      </block> 



     <block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/> 
    </reference> 

: 다음과 같이 표시됩니다

많은 감사, 데이브

답변

1

이동을 catalog.xml하고

<block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="catalog/product/view/options/wrapper.phtml" translate="label"> 
       <label>Info Column Options Wrapper</label> 
       <block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/> 
       <block type="catalog/product_view_options" name="product.info.options" as="product_options" template="catalog/product/view/options.phtml"> 
        <action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action> 
        <action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action> 
        <action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action> 
        <action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action> 
      </block> 
        <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/> 
       </block> 
      <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label"> 
       <label>Bottom Block Options Wrapper</label> 
       <action method="insert"><block>product.tierprices</block></action> 
       <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/> 
       <action method="append"><block>product.info.addtocart</block></action> 
       <action method="append"><block>product.info.addto</block></action> 
      </block> 

을 복사

<reference name="right"> 


    HERE    

     <block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/> 
    </reference> 

에 넣어 즐겨!