Inchooのブログに従って、製品ビューページに[前へ] / [次へ]ボタンを実装しています。デフォルトのMagentoテーマで問題なく機能しますが、私のテーマでは、カテゴリーからの製品の位置の取得に問題があります。
製品のview.phtmlにコードを追加しました
<?php $_prev = $this->helper('retailon_productprevnext')->getPreviousProduct(); ?>
<?php $_next = $this->helper('retailon_productprevnext')->getNextProduct(); ?>
<?php if($_prev): ?><a class="product-prev" href="<?php echo $_prev;?>"><?php echo $this->__('< Previous')?></a><?php endif; ?>
<?php if($_next): ?><a class="product-next" href="<?php echo $_next;?>"><?php echo $this->__('Next >')?></a><?php endif; ?>私のヘルパーの以前の製品のコードは次のとおりです:
     public function getPreviousProduct()
        {
            $prodId = Mage::registry('current_product')->getId();
            $catArray = Mage::registry('current_category');
            if($catArray){
var_dump($catArray); 
                $catArray = $catArray->getProductsPosition();
var_dump($catArray); 
/// Remaining code to return previous product最初のダンプはカテゴリ配列情報を返しますが、2番目のダンプは値をダンプしていません。
を使用する代わりに、カテゴリ配列から製品の位置を取得できる他の方法はあります    $catArray = $catArray->getProductsPosition();か?