doujiang1913 2013-08-01 16:38
浏览 23

如何使用Magento的Position框来订购数组

I am using Magento and WordPress so have gone for the FishPig Module. I have a CMS Page and am using the assocaited blog posts tab to select posts to show on this page which is all working as expected.

The problem I am facing is when I try to use the position box in Magento next to each post selected they always stay in the same order on the frontend no matter what order I set them as.

I know in Magentos Categories you can use the same position boxes to order how the products show on that specific category so I am wanting to use the same function for the code below to order the blog posts but I cant find out how to get it working.

    <?php if (($posts = $this->getPostCollection()) !== false): ?>
    <?php if (count($posts) > 0): ?>
        <div class="box-collateral box-description" style="padding:5px 20px;">
            <!--<?php if ($title = $this->getTitle()): ?>
                <h2 style="margin-bottom:15px;">Blog <span style="color: #68d088;">Posts</span></h2>

            <?php endif; ?>-->
            <div class="std">
                <ul>
                <?php foreach($posts as $post): ?>
                    <li class="related-blogs">
                        <a href="<?php echo $post->getPermalink() ?>"><h2><?php echo $this->escapeHtml($post->getPostTitle()) ?></h2></a>
                        <div class="content">
                            <?php 
                                $pos = strpos($post['post_content'], ' ', 300);
                                echo substr($post['post_content'],0,$pos );
                            ?>
                        </div>
                        <a style="color:#68d088; font-weight:bold;" href="<?php echo $post->getPermalink() ?>">Read More...</a>
                    </li>
                <?php endforeach; ?>
                </ul>
            </div>
        </div>
    <?php endif; ?>
    <?php endif; ?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用