首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Magento 1.9展示最新产品的页脚

Magento 1.9展示最新产品的页脚
EN

Stack Overflow用户
提问于 2014-10-13 13:07:06
回答 1查看 842关注 0票数 0

编辑:实际上,下面的解决方案是正确的。事实证明,我的迷幻药盒没有安装php5-gd,所以magento没有执行映像操作,但是PHP并没有显示没有安装它的错误。因此,请确保安装php5-gd :P。

日安!

我目前正在一个基于Magento1.9的电子商务网站上工作,我基本上是在学习它。我目前正在进行静态设计,并将其转换为Magento主题。

我试图显示图片(与链接)的6个最新产品在商店的页脚区的商店,但我发现的教程和问题,但我没有发挥作用。

我基本上已经从静态模板中提取了我的页脚,并将其粘贴到主题footer.phtml文件中。该设计要求在html中像这样显示这六个图像(如果这有意义的话?)

代码语言:javascript
复制
<div class="medium-6 large-3 columns newlyAdded">
    <div class="footerHat"></div>
    <h3> Newly Added</h3>
    <div class="row">
        <ul class="small-block-grid-3">
            <li><img src="./images/footer-image-1.jpg" alt="footer image"></li>
            <li><img src="./images/footer-image-2.jpg" alt="footer image"></li>
            <li><img src="./images/footer-image-3.jpg" alt="footer image"></li>
        </ul>
    </div>
    <p></p>
    <div class="row">
        <ul class="small-block-grid-3">
            <li><img src="./images/footer-image-4.jpg" alt="footer image"></li>
            <li><img src="./images/footer-image-5.jpg" alt="footer image"></li>
            <li><img src="./images/footer-image-6.jpg" alt="footer image"></li>
        </ul>
    </div>
</div>

我最初的想法是把它放在一个静态块中,然后在Magento的模型中循环一些东西,但我不确定这是否是最好的方法。

任何帮助都将不胜感激,当然,我会提供尽可能多的信息:)

谢谢

编辑:额外信息

page.xml文件中与页脚相关的内容:

代码语言:javascript
复制
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
    <block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
        <label>Page Footer</label>
        <action method="setElementClass"><value>bottom-container</value></action>
    </block>
    <block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
    <block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
</block>

<block type="core/text_list" name="before_body_end" as="before_body_end" translate="label">
    <label>Page Bottom</label>
    <block type="page/html_cookieNotice" name="global_cookie_notice" as ="global_cookie_notice" template="page/html/cookienotice.phtml" before="-" />
</block>

<reference name="footer">
    <block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml">
        <action method="setProductsCount"><count>4</count></action>
    </block>
</reference>

footer.phtml文件(默认magento版本)

代码语言:javascript
复制
<div class="footer-container">
    <div class="footer">
        <?php echo $this->getChildHtml() ?>
        <p class="bugs"><?php echo $this->__('Help Us to Keep Magento Healthy') ?> - <a href="http://www.magentocommerce.com/bug-tracking" onclick="this.target='_blank'"><strong><?php echo $this->__('Report All Bugs') ?></strong></a> <?php echo $this->__('(ver. %s)', Mage::getVersion()) ?></p>
        <address><?php echo $this->getCopyright() ?></address>
    </div>
</div>

custom_page.xml:

代码语言:javascript
复制
<?xml version="1.0"?>
<layout>
    <custom_layout translate="label">
        <label>Custom layout</label>
        <reference name="root">
            <action method="setTemplate"><template>page/custom_layout.phtml</template></action>
            <action method="setIsHandle"><applied>1</applied></action>
        </reference>
    </custom_layout>
</layout>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-13 13:37:09

Magento已经具有此功能,您可以使用以下代码在页脚/要显示的任何位置显示新产品

代码语言:javascript
复制
<reference name="footer">
<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page">
<action method="setProductsCount"><count>4</count></action>
</block>
</reference>

注意到,我认为您已经遵循了Magento的主题化方式,并且有“引用页脚”,如果您想要的话,可以将块代码放入任何引用调用中,并且可以在footer.phtml中直接调用它。

如果要对布局进行样式设置,请在"app/design/frontend/base/default/template/catalog/product/new.phtml“中创建"app/design/frontend/{themepackage}/{themename}/template/catalog/product/new.phtml”副本并修改布局。

如果你有任何疑问,请随时发表评论!希望这能有所帮助!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26340724

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档