显示未来创建日期的帖子需要进行哪些更改?

时间:2015-02-27 16:57:08

标签: magento date rss blogs

我在这一点上有点亏。我使用AheadWorks博客扩展程序将当前日历年的活动帖子添加到我的页面。该扩展程序还会创建这些帖子的Feed,我将其添加到Google日历中。正因为如此,我使用事件的日期作为创建日期,因此它们正确地提供给Google日历。但是,我无法弄清楚如何让Magento显示所有帖子;它只会从当天或更早的时候开始创建日期。我知道这是默认的;我该如何处理它以便所有帖子都不管created_time显示?

我已经看到了一些关于更改商店时间的建议,还有一些提到了编辑created.php文件的建议,但我真的不知道从哪里开始?

有人可以告诉我需要做些什么吗?

这是app / code / community / AW / Blog / Block / Blog.php:

<?php
/**
 * aheadWorks Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/AW-LICENSE.txt
 *
 * =================================================================
 *                 MAGENTO EDITION USAGE NOTICE
 * =================================================================
 * This software is designed to work with Magento community edition and
 * its use on an edition other than specified is prohibited. aheadWorks does     not
 * provide extension support in case of incorrect edition use.
 * =================================================================
 *
 * @category   AW
 * @package    AW_Blog
 * @version    1.3.4
 * @copyright  Copyright (c) 2010-2012 aheadWorks Co.   (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/AW-LICENSE.txt
 */


class AW_Blog_Block_Blog extends AW_Blog_Block_Abstract
{
    public function getPosts()
    {
        $collection = parent::_prepareCollection();
        $tag = $this->getRequest()->getParam('tag');
        if ($tag) {
            $collection->addTagFilter(urldecode($tag));
        }
        parent::_processCollection($collection);
        return $collection;
    }

    protected function _prepareLayout()
    {
        if ($this->isBlogPage() && ($breadcrumbs = $this->getCrumbs())) {
            parent::_prepareMetaData(self::$_helper);
            $tag = $this->getRequest()->getParam('tag', false);
            if ($tag) {
                $tag = urldecode($tag);
                $breadcrumbs->addCrumb(
                    'blog',
                    array(
                        'label' => self::$_helper->getTitle(),
                        'title' => $this->__('Return to ' . self::$_helper-    >getTitle()),
                        'link'  => $this->getBlogUrl(),
                    )
                );
                $breadcrumbs->addCrumb(
                    'blog_tag',
                    array(
                        'label' => $this->__('Tagged with "%s"',     self::$_helper->convertSlashes($tag)),
                        'title' => $this->__('Tagged with "%s"', $tag),
                    )
                );
            } else {
                $breadcrumbs->addCrumb('blog', array('label' =>     self::$_helper->getTitle()));
            }
        }
    }
}

这里有app / design / frontend / [theme] / [theme] /template/aw_blog/blog.phtml:

<?php
/**
 * aheadWorks Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/AW-LICENSE.txt
 *
 * =================================================================
 *                 MAGENTO EDITION USAGE NOTICE
 * =================================================================
 * This software is designed to work with Magento community edition and
 * its use on an edition other than specified is prohibited. aheadWorks does  not
 * provide extension support in case of incorrect edition use.
 * =================================================================
 *
 * @category   AW
 * @package    AW_Blog
 * @version    1.3.4
 * @copyright  Copyright (c) 2010-2012 aheadWorks Co.   (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/AW-LICENSE.txt
 */
?><?php $posts = $this->getPosts(); ?>
<div id="messages_product_view">
    <?php Mage::app()->getLayout()->getMessagesBlock()->setMessages(Mage::getSingleton('customer/session')->getMessages(true)); ?>
    <?php echo Mage::app()->getLayout()->getMessagesBlock()->getGroupedHtml(); ?>
</div>

<?php echo $this->getChildHtml('aw_blog_comments_toolbar'); ?>

<?php foreach ($posts as $post): ?>

    <div class="postWrapper">
        <div class="postTitle">
            <h2><a href="<?php echo $post->getAddress(); ?>" ><?php echo $post->getTitle(); ?></a></h2>
            <h3><?php echo $post->getCreatedTime(); ?></h3>
        </div>
        <div class="postContent">
            <?php echo $post->getPostContent(); ?>
        </div>

        <?php echo $this->getBookmarkHtml($post) ?>
        <div class="tags"><?php echo $this->getTagsHtml($post) ?></div>
        <div class="postDetails">
            <?php if ($this->getCommentsEnabled()): ?>
                <?php echo $post->getCommentCount(); ?> <a href="<?php echo $post->getAddress(); ?>#commentBox" > <?php echo Mage::helper('blog')->__('Comments'); ?></a> |
            <?php endif; ?>
            <?php $postCats = $post->getCats(); ?>
            <?php if (!empty($postCats)): ?>
                <?php echo Mage::helper('blog')->__('Posted in'); ?>
                <?php foreach ($postCats as $data): ?>
                    <a href="<?php echo $data['url']; ?>"><?php echo $data['title']; ?></a>
                <?php endforeach; ?>
            <?php else: ?>
                <?php echo Mage::helper('blog')->__('Posted'); ?>
            <?php endif; ?><?php echo $this->__("By"); ?> <?php echo $post->getUser(); ?></div>
    </div>

<?php endforeach; ?>
<?php echo $this->getChildHtml('aw_blog_comments_toolbar'); ?>

2 个答案:

答案 0 :(得分:0)

只是一个更新 - 我想我找到了我需要编辑的过滤器:

应用程序/代码/小区/ AW /博客/型号/ Mysg14 /博客/ Collection.php

public function addPresentFilter()
{
    $this->getSelect()->where('main_table.created_time<=?', now());
    return $this;
}

我改为:

public function addPresentFilter()
{
    $this->getSelect()->where('main_table.created_time>=?', now());
    return $this;
}

我试着完全评论它,但是... whitescreen;所以我还在努力修改以显示所有 - 而jhgraphics感谢你把它带到那里!

答案 1 :(得分:0)

你很亲密,只是改变;

public function addPresentFilter()
    {
        $this->getSelect()->where('main_table.created_time<=?', now());
        return $this;
    }

public function addPresentFilter()
    {
        $this->getSelect()->where('main_table.update_time<=?', now());
        return $this;
    }

完美无缺。