2014-09-23 2 views
0

'관련'제품을 배치하고 특정 div 레이어의 제품 페이지에 배치하려고했습니다. catalog.xml 레이아웃을 변경해 보았지만 제품 정보 이전 또는 이후에 항상 표시되지만 괜찮습니다.related.phtml 제품 페이지에 표시되는 내용

나는

내가 그것을 호출 시도 가격 등의 div 레이어 오른쪽에 그것을 싶습니다;

div 레이어에 배치하면 표시되지 않으며 페이지의 다른 모든 요소 아래에만 표시됩니다.

나는 아직도 catalog.xml

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

없는 기쁨을 시도했습니다 변경, 가장 좋은 방법은 관련 표시하는 것입니다

, crossell, 상위 상품 구매 유도 블록은 어디서나 당신이 좋아?

고맙습니다.

+0

일부 스크린 샷을 제공 할 수 있습니까? –

답변

1

더 많은 문제가있을 수 있습니다. 더 많은 코드를 보지 않고 명확한 하나는 블록의 이름을 잘못 호출하는 것입니다. 섹션은 "이름 ="catalog.product.related "당신이 그것을 호출 이름을 정의합니다. 말했다되는 것을 아래에 호출이 어떻게 보일지입니다.

<div id="recommended-right"><?php echo $this->getChildHtml('catalog.product.related') ?></div> 

참조 이름은 어쩌면 당신의 xml 파일에 사용 잘못된뿐만 아니라,하지만 노력이 첫 번째

확인 젠토의 XML 구조에 대해 알고 도움이 정말 네 부분이 있습니다.

1) "이름이"이 당신이 XML의 내의 특정 블록을 참조하는 방법입니다 이 이름으로 phtml 파일에서 블록을 호출 할 수 있습니다. "as"이름을 지정하지 않은 경우에만

2.) "as"를 선택하면 이것을 정의 할 수 있습니다.이 이름은 .phtml 파일의 블록을 호출하는 데 엄격하게 사용됩니다.

3.) getChildHtml ('') phtml 파일에서 블록을 호출하는 주요 방법. 마 젠토는 관련의 "로"또는 이름 "참조 블록을 찾을 수 없습니다 때문에 작동하지 않았다 ('관련') 이유입니다.

4)이 슬러그

이 정의
<default>, <catalog_product_view> etc. 

이러한 블록이 사용될 수있는 페이지.

<default> = all pages <catalog_product_view> = product detail pages. 

그리고 더 많은.

+0

당신은 아름다움! 고마워, 왜 그냥 '관련'wouldnt 작업을 설명 할 수 있습니까? 그냥 내 머리를 감쌀 수 있니? – mg33dev

+0

위의 대답에 제가 추가되었습니다. – Rob

+1

추가 할 또 다른 사항은 local.xml 파일을 사용하여 모든 변경 작업을 수행하는 것입니다. 요청이 있으면 샘플을 제공 할 수 있습니다. – Rob

1

점잖은 최근 프로젝트 예제를 부여 그래서이 드래그 a를하지 않습니다 참조 꽤 많은 사용자 정의 확장이 기억 그러나 당신은 그것으로부터 많은 것을 배울 수 있어야합니다.

<?xml version="1.0"?> 

<layout version="0.1.0"> 

    <!-- Default handle, loaded on most pages --> 
    <default> 
     <!-- Removal of Default Magento Call outs --> 
     <remove name="left.permanent.callout" /> <!--the dog--> 
     <remove name="right.permanent.callout" /> <!--back to school--> 
     <remove name="paypal.partner.right.logo" /> <!--paypal logo--> 
     <remove name="left.reports.product.viewed" /> <!--recently viewed prod--> 
     <remove name="right.reports.product.viewed" /> <!--recently viewed prod--> 
     <remove name="right.poll" /> <!--Poll--> 
     <remove name="product_tag_list" /> <!--Product Tags--> 

     <!-- Head Global CSS and JS updates --> 
     <reference name="head"> 
      <!-- Remove Magento's default assets --> 
      <action method="removeItem"><type>skin_css</type><name>css/print.css</name></action> 
      <action method="removeItem"><type>skin_css</type><name>css/styles-ie.css</name></action> 
      <action method="removeItem"><type>skin_css</type><name>css/styles.css</name></action> 
      <action method="removeItem"><type>skin_css</type><name>css/widgets.css</name></action> 
      <action method="removeItem"><type>skin_js</type><name>js/ie6.js</name></action> 
      <action method="removeItem"><type>js</type><name>lib/ds-sleight.js</name></action> 
      <action method="removeItem"><type>js</type><name>varien/menu.js</name></action> 

      <!-- Add our assets --> 
      <action method="addCss"><stylesheet>css/style-base.css</stylesheet></action> 
      <action method="addCss"><stylesheet>css/style-theme.css</stylesheet></action> 
      <action method="addCss"><stylesheet>css/style-custom.css</stylesheet></action> 
      <!-- <action method="addItem"><type>js</type><name>jquery/jquery-2.0.2.min.js</name></action> --> 
      <!-- <action method="addItem"><type>js</type><name>jquery/jquery-noconflict.js</name></action> --> 
      <action method="addItem"><type>skin_js</type><name>js/script.js</name></action> 
      <action method="addItem"><type>skin_js</type><name>js/jquery.fitvids.js</name></action> 

      <!-- Custom Theme Javascript --> 
      <action method="addItem"><type>skin_js</type><name>js/custom.js</name></action> 

      <!-- Add Custom Fonts --> 
      <block type="core/template" name="custom.fonts" template="page/html/fonts.phtml"/> 

      <!-- Add additioanl child blocks --> 
      <block type="core/template" name="boilerplate.head.meta" template="boilerplate/page/html/head/meta.phtml"/> 
      <block type="core/template" name="boilerplate.head.ie8" template="boilerplate/page/html/head/ie8.phtml"/> 
     </reference> 

     <!-- Right Column Global --> 
     <!-- Remove Unwanted Magento Defaults from Right column. Use unsetChild to remove from one section--> 
     <!-- unsetChild removes this block on from the referenced section. It's not a permanent removal like "remove" --> 
     <reference name="right"> 
      <action method="unsetChild"><name>cart_sidebar</name></action> 
      <action method="unsetChild"><name>catalog.compare.sidebar</name></action> 
      <action method="unsetChild"><name>right.reports.product.compared</name></action> 
      <action method="unsetChild"><name>right.reports.product.viewed</name></action> 
      <action method="unsetChild"><name>wishlist</name></action> 
      <action method="unsetChild"><name>sale.reorder.sidebar</name></action> 
      <action method="unsetChild"><name>right.poll</name></action> 

      <remove name="sale.reorder.sidebar"></remove> 
     </reference> 

     <!-- Left Column Global --> 
     <reference name="left"> 
      <action method="unsetChild"><name>left.newsletter</name></action> 
      <action method="unsetChild"><name>sale.reorder.sidebar</name></action> 
     </reference> 

     <!-- Top Links --> 
     <reference name="top.links"> 
      <remove name="wishlist_link"/> 

      <!-- Remove and re-add My Account link --> 
      <action method="removeLinkByUrl"><url helper="customer/getAccountUrl" /></action> 
      <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>1</position></action> 

      <!-- Remove Cart/Checkout links and re-add Cart link only --> 
      <remove name="checkout_cart_link" /> 
      <!-- <block type="checkout/links" name="checkout_cart_link_custom"> 
       <action method="addCartLink"></action> 
      </block> --> 
     </reference> 

     <!-- Footer --> 
     <reference name="footer"> 
      <block type="cms/block" name="footer_bottom" before="footer_bottom"> 
       <action method="setBlockId"><block_id>footer_bottom</block_id></action> 
      </block> 
     </reference> 

     <!-- Ajax Cart --> 
     <reference name="header"> 
      <block type="checkout/cart_sidebar" name="ajaxcart" template="ajaxcart/ajaxcart.phtml" before="-"> 
       <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>ajaxcart/ajaxcart/default.phtml</template></action> 
       <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>ajaxcart/ajaxcart/default.phtml</template></action> 
       <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>ajaxcart/ajaxcart/default.phtml</template></action> 
       <block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/> 
      </block> 
     </reference> 

     <!-- Footer Bottom --> 
     <reference name="footer_links"> 
      <remove name="return_link" /> 
      <action method="removeLinkByUrl"><url helper="catalogsearch/getSearchTermUrl" /></action> 
      <action method="removeLinkByUrl"><url helper="catalogsearch/getAdvancedSearchUrl" /></action> 
      <action method="removeLinkByUrl"><url helper="catalog/map/getCategoryUrl" /></action> 

      <!-- Dependent on utltilties Extension --> 
      <action method="removeLinkByUrl"><url helper="utilities/getUrl"><url>contacts</url></url></action> 

      <block type="cms/block" name="footer_bottom"> 
       <action method="setBlockId"><block_id>footer_bottom</block_id></action> 
      </block> 
     </reference> 

     <reference name="catalog.topnav"> 
      <block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/> 
     </reference> 
    </default> 

    <print> 
     <reference name="head"> 
      <!-- Add our assets --> 
      <action method="addCss"><stylesheet>css/style.css</stylesheet></action> 
      <action method="addItem"><type>skin_js</type><name>js/script-ck.js</name></action> 
     </reference> 
    </print> 

    <!-- Homepage a way to target the home page wihtout using the admin --> 
<!--  <cms_index_index> 
     <reference name="right"> 
      <block type="catalog/product/list" category_id="17" template="catalog/product/topselling.phtml" /> 
     </reference> 
    </cms_index_index> 
--> 
    <!-- Category Layered Navigation and Search Result Pages --> 
     <!-- QUICK SEARCH --> 

    <catalogsearch_result_index> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
      <!-- Available actions to add for different layouts --> 
      <!-- <action method="setTemplate"><template>page/2columns-right.phtml</template></action> --> 
      <!-- <action method="setTemplate"><template>page/3columns.phtml</template></action> --> 
      <!-- <action method="setTemplate"><template>page/1column.phtml</template></action> --> 
     </reference> 
     <reference name="search_result_list"> 
       <action method="setColumnCount"><count>4</count></action> 
     </reference> 
     <reference name="product_list_toolbar"> 
      <action method="setTemplate"> 
       <template>catalog/blank.phtml</template> 
      </action> 
     </reference> 
    </catalogsearch_result_index> 

    <!-- ADVANCED SEARCH --> 

    <catalogsearch_advanced_result> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
     <reference name="search_result_list"> 
       <action method="setColumnCount"><count>4</count></action> 
     </reference> 
     <reference name="product_list_toolbar"> 
      <action method="setTemplate"> 
       <template>catalog/blank.phtml</template> 
      </action> 
     </reference> 
    </catalogsearch_advanced_result> 


<!-- CATEGORY PAGE WITH LAYERED NAVIGATION --> 

    <catalog_category_layered translate="label"> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
     <reference name="product_list"> 
      <action method="setColumnCount"><count>4</count></action> 
     </reference> 
     <reference name="product_list_toolbar"> 
      <action method="setTemplate"> 
       <template>catalog/blank.phtml</template> 
      </action> 
     </reference> 
    </catalog_category_layered> 

<!-- CATEGORY PAGE WITHOUT LAYERED NAVIGATION --> 

    <catalog_category_default translate="label"> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
     <reference name="product_list"> 
      <action method="setColumnCount"><count>4</count></action> 
     </reference> 
     <!-- Set Template to a blank file to remove toolbar functionality. --> 
     <reference name="product_list_toolbar"> 
      <action method="setTemplate"> 
       <template>catalog/blank.phtml</template> 
      </action> 
     </reference> 
     <reference name="content"> 
      <block type="wordpress/sidebar_widget_posts" name="wordpress.widget.recent_posts" as="recent_posts" template="wordpress/sidebar/widget/posts.phtml"> 
     <action method="setTitle"><title>Latest Posts</title></action> 
     <action method="setPostCount"><post_count>5</post_count></action> 
    </block> 
     </reference> 
    </catalog_category_default> 

<!-- Product Detail Page --> 
    <catalog_product_view translate="label"> 
     <!-- Set to single column layout --> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
     <reference name="head"> 
      <action method="addItem"><type>skin_js</type><name>js/expander.min.js</name></action> 
     </reference> 
     <reference name="product.info.additional"> 
      <action method="unsetChild"><name>wordpress_posts_associated</name></action> 
     </reference> 
     <reference name="product.info"> 
      <block type="review/product_view_list" name="product.info.review_list" as="reviews" template="review/product/view/list.phtml" /> 
      <block type="review/form" name="product.info.review_form" as="review_form" template="review/form.phtml"/> 
      <!-- <block type="wordpress/post_associated" name="wordpress.widget.recent_posts" as="recent_posts" template="wordpress/sidebar/widget/testimonial-custom.phtml"> 
       <action method="setTitle"><title>Customer Testimonials</title></action> 
       <action method="setPostCount"><post_count>5</post_count></action> 
       <action method="setExcerpt"><display>on</display></action> 
       <action method="setFeaturedImage"><display>on</display></action> 
       <action method="setPostType"><type>testimonial</type></action> 
       <action method="setDate"><date>on</date></action> 
      </block> --> 
      <block type="wordpress/post_associated" name="wordpress_posts_associated" as="associated_posts" template="wordpress/sidebar/widget/testimonial-custom.phtml"> 
       <action method="setTitle" translate="title" module="wordpress"><title><![CDATA[Testimonials]]></title></action> 
       <action method="setEntity"><type><![CDATA[product]]></type></action> 
       <!-- <action method="setCount"><count>5</count></action> --> 
      </block> 
     </reference> 

     <!-- remove product info options wrapper bottom --> 
     <!-- <reference name="product.info.container1"> 
      <action method="unsetChild"><name>product.info.options.wrapper.bottom</name></action> 
     </reference> --> 
    </catalog_product_view> 

<!-- Email a Friend page --> 
    <sendfriend_product_send translate="label"> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
    </sendfriend_product_send> 

<!-- Customer Account Dashboard --> 
    <customer_account> 
     <remove name="sale.reorder.sidebar"></remove> 
     <reference name="root"> 
      <action method="addBodyClass"><classname>my-account-wrapper</classname></action> 
     </reference> 
     <reference name="left"> 
      <!-- Remove cart from the left column --> 
      <action method="unsetChild"><name>cart_sidebar</name></action> 

      <!-- Remove Compare block, it is already inserted in DEFAULT section --> 
      <action method="unsetChild"><name>catalog.compare.sidebar</name></action> 
     </reference> 
     <!-- Remove Unnecessary links using Swarming Custom Module --> 
     <reference name="customer_account_navigation" > 
      <action method="removeLinkByName"><name>downloadable_products</name></action> 
      <action method="removeLinkByName"><name>OAuth Customer Tokens</name></action> 
      <action method="removeLinkByName"><name>billing_agreements</name></action> 
      <action method="removeLinkByName"><name>recurring_profiles</name></action> 
      <action method="removeLinkByName"><name>tags</name></action> 
      <!-- <action method="removeLinkByName"><name>wishlist</name></action> --> 
      <action method="removeLinkByName"><name>newsletter</name></action> 
      <action method="removeLinkByName"><name>reviews</name></action> 

      <!-- Available links to remove 

      <action method="removeLinkByName"><name>account</name></action> 
      <action method="removeLinkByName"><name>address_book</name></action> 
      <action method="removeLinkByName"><name>orders</name></action> 
      <action method="removeLinkByName"><name>account_edit</name></action> --> 
     </reference> 
    </customer_account> 

<!-- 
Load this update on every page when customer is logged in 
--> 

    <customer_logged_in> 
     <reference name="top.links"> 
      <action method="removeLinkByUrl"><url helper="customer/getLogoutUrl" /></action> 
      <action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>2</position></action> 
     </reference> 
    </customer_logged_in> 

<!-- 
Load this update on every page when customer is logged out 
--> 

    <customer_logged_out> 
     <reference name="top.links"> 
      <action method="removeLinkByUrl"><url helper="customer/getLoginUrl" /></action> 
      <action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>2</position></action> 
     </reference> 
     <remove name="reorder"></remove> 
    </customer_logged_out> 


<!-- Dealer Locator Page --> 
<!-- Custom Extension Should replace --> 

    <ustorelocator_location_map> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
    </ustorelocator_location_map> 

<checkout_onepage_success> 
     <reference name="root"> 
      <action method="setTemplate"><template>page/1column.phtml</template></action> 
     </reference> 
    </checkout_onepage_success> 
</layout> 
관련 문제