Post by samspson » Wed Apr 25, 2012 10:55 pm

我修改了./catalog/view/theme/default/template/product/category.tpl 內紅字部份
========================
<?php if ($categories) { ?>
<h2><?php echo $text_refine; ?></h2>
<div class="category-list">
<?php if (count($categories) <= 5) { ?>
<ul>
<?php foreach ($categories as $category) { ?>

<li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
<?php } ?>
</ul>

<?php } else { ?>

<?php for ($i = 0; $i < count($categories);) { ?>

<ul>
<?php $j = $i + ceil(count($categories) / 4); ?>
<?php for (; $i < $j; $i++) { ?>
<?php if (isset($categories[$i])) { ?>
<?php if ($category['thumb']) { ?>
<div class="image"><a href="<?php echo $categories[$i]['href']; ?>"><img src="<?php echo $category['thumb']; ?>" title="<?php echo $categories['name']; ?>" alt="<?php echo $categories[$i]['name']; ?>" /></a></div>
<?php } ?>


<li><a href="<?php echo $categories[$i]['href']; ?>"><?php echo $categories[$i]['name']; ?></a></li>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
<?php } ?>
</div>
=================================

但出了ERROR
error.jpg

error.jpg (248.46 KiB) Viewed 1920 times

請教大大要如何做才對

Newbie

Posts

Joined
Thu Mar 15, 2012 12:15 am

Post by alansubmarine » Tue May 15, 2012 4:26 pm

Code: Select all

			$this->data['categories'] = array();
			
			$results = $this->model_catalog_category->getCategories($category_id);
			
			foreach ($results as $result) {
				$data = array(
					'filter_category_id'  => $result['category_id'],
					'filter_sub_category' => true	
				);
							
				$product_total = $this->model_catalog_product->getTotalProducts($data);
				
				$this->data['categories'][] = array(
					'name'  => $result['name'] . ' (' . $product_total . ')',
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);
			}
見 catalog\controller\product\category.php 約 124行 (1.5.1 版)
category的controller並沒有對 categories這個變數定義thumb的 index
所以這個用法 "category['thumb']" 會有問題~

Newbie

Posts

Joined
Fri Apr 13, 2012 2:20 pm
Location - Taiwan

Post by larrylee5566 » Wed May 23, 2012 3:48 pm

我好想没发现这个问题 !!!!!!

android tablet australia


Newbie

Posts

Joined
Sat Apr 21, 2012 12:56 am

Who is online

Users browsing this forum: No registered users and 6 guests