Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento 语法错误_Magento_Navigation_Layered - Fatal编程技术网

Magento 语法错误

Magento 语法错误,magento,navigation,layered,Magento,Navigation,Layered,我正在尝试通过以下线程自定义magento的价格分层导航: 但当我复制并粘贴他的代码时,我遇到了一个错误,请参见下面的代码。 有什么想法吗 protected function _getItemsData() { $key = $this->_getCacheKey(); $data = $this->getLayer()->getAggregator()->getCacheData($key); if ($data === null) {

我正在尝试通过以下线程自定义magento的价格分层导航:

但当我复制并粘贴他的代码时,我遇到了一个错误,请参见下面的代码。 有什么想法吗

protected function _getItemsData()
{
    $key = $this->_getCacheKey();

    $data = $this->getLayer()->getAggregator()->getCacheData($key);
    if ($data === null) {
        $range      = 100;// $this->getPriceRange();
        $minEntries = 30;
        $minPercentage = 12; //overrides the previous line if set, sets minEntries to $minPercentage of total items
        $lastRange  = 5000; //collects everything over this value into one range, must be a multiple of $range. Set to 0 for no last range.
        $lastRangeIndex = $lastRange == 0 ? 0 : intval($lastRange / $range);

        $dbRanges   = $this->getRangeItemCounts($range);
        if ( ($minPercentage > 0) && ($minPercentage < 100) ) {
            $itemCount = array_sum($dbRanges);
            $minEntriesByPercentage = intval( $itemCount * ($minPercentage / 100) );
            $minEntries = $minEntriesByPercentage;
        }
        $data       = array();

        $collect = 0;
        $collectIndex = 0;
        $collections = 1;
        $lastIndex = 0;
        foreach ($dbRanges as $index=>$count) {
            if ( ( ( $collect + $count ) >= $minEntries ) && ( ($index <= $lastRangeIndex) || ($lastRangeIndex == 0) ) {
                    $collections = $collectIndex == 0 ? 1 : ( $index - $collectIndex ) + 1;
                    $data[] = array(
                        'label' => $this->_renderItemLabel($range * $collections, $index / $collections),
                        'value' => ( $index / $collections ) . ',' . $range * $collections,
                        'count' => $count + $collect,
                    );
                    $collect = 0;
                    $collections = 1;
                    $collectIndex = 0;
            } else {
                    $collect = $collect + $count;
                    if ( $collectIndex == 0 ) {
                            $collectIndex = $index;
                    }
                    $collections = $collectIndex == $index ? 1 : ( $index - $collectIndex ) + 1;

            }
            $lastIndex = $index;
        }
        if ( $collect > 0 ) {
                  $data[] = array(
                       'label' => $this->_renderItemLabel($range * $collections, $lastIndex / $collections),
                       'value' => ( $lastIndex / $collections ) . ',' . $range * $collections,
                       'count' => $collect,
                   );
        }

        $tags = array(
            Mage_Catalog_Model_Product_Type_Price::CACHE_TAG,
        );
        $tags = $this->getLayer()->getStateTags($tags);
        $this->getLayer()->getAggregator()->saveCacheData($data, $key, $tags);
    }
    return $data;
}
protectedfunction\u getItemsData()
{
$key=$this->_getCacheKey();
$data=$this->getLayer()->getAggregator()->getCacheData($key);
如果($data==null){
$range=100;//$this->getPriceRange();
$minEntries=30;
$minPercentage=12;//如果设置,则覆盖上一行,将minEntries设置为$minPercentage of total items
$lastRange=5000;//将超过此值的所有内容收集到一个范围中,必须是$range的倍数。如果没有最后一个范围,则设置为0。
$lastRangeIndex=$lastRange==0?0:intval($lastRange/$range);
$dbRanges=$this->getRangeItemCounts($range);
如果($minPercentage>0)和($minPercentage<100)){
$itemCount=数组和($dbRanges);
$minEntriesByPercentage=intval($itemCount*($minPercentage/100));
$minEntries=$minEntriesByPercentage;
}
$data=array();
$collect=0;
$collectIndex=0;
$collections=1;
$lastIndex=0;
foreach($dbRanges作为$index=>$count){
如果(($collect+$count)>=$minEntries)和($index$this->_renderItemLabel($range*$collections,$index/$collections),
“value'=>($index/$collections)。”,“.$range*$collections,
“count”=>$count+$collect,
);
$collect=0;
$collections=1;
$collectIndex=0;
}否则{
$collect=$collect+$count;
如果($collectIndex==0){
$collectIndex=$index;
}
$collections=$collectIndex==$index?1:($index-$collectIndex)+1;
}
$lastIndex=$index;
}
如果($collect>0){
$data[]=数组(
'label'=>$this->\u renderItemLabel($range*$collections,$lastIndex/$collections),
'value'=>($lastIndex/$collections)。','.$range*$collections,
“计数”=>$collect,
);
}
$tags=数组(
Mage_目录_型号_产品_类型_价格::缓存_标签,
);
$tags=$this->getLayer()->getStateTags($tags);
$this->getLayer()->getAggregator()->saveCacheData($data,$key,$tags);
}
返回$data;
}

if(($collect+$count)>=$minEntries)&&($index=$minEntries)&($index)&($index)
if ( ( ( $collect + $count ) >= $minEntries ) && ( ($index <= $lastRangeIndex) || ($lastRangeIndex == 0) ) {
if ( ( ( $collect + $count ) >= $minEntries ) && ( ($index <= $lastRangeIndex) || ($lastRangeIndex == 0) )) {