Magento批量修改产品的所属分类

很多朋友在产品所属分类的时候都感觉到后台产品一个一个调整所属分类是很不现实的,工程量相当巨大。现在和大家分享一个快捷的方法

使用批量导入产品的分类

首先后台导出产品的SKU 和Category_ids

然后重新导入产品,但是这次导入的产品不需要所有的列,只需要SKU, Category_ids就可以,
在category_ids列加上产品所属分类的id号

例如: 3,4,10

用逗号隔开。

Magento产品列表增加A-Z字母过滤功能

转自互联网 文章来自:嗨 · 酷哥网

首先将
app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
拷到
app/code/local/Mage/Catalog/Block/Product/List/Toolbar.php
然后增加一个函数

public function str_replace_once($needle , $replace , $haystack){
// Looks for the first occurence of $needle in $haystack
// and replaces it with $replace.
$pos = strpos($haystack, $needle);
if ($pos === false) {
// Nothing found
return $haystack;
}
return substr_replace($haystack, $replace, $pos, strlen($needle));
}
然后将以下函数换在如下代码
public function jameshallison casino  setCollection($collection){
$this->_collection = $collection;
$this->_collection->setCurPage($this->getCurrentPage());
// we need to set pagination only if passed value integer and more that 0
$limit = (int)$this->getLimit();
$postData = "";
if ($limit) {
$this->_collection->setPageSize($limit);
}
if ($this->getCurrentOrder()){
/////Alphabate search Code Start From here.
$postData = Mage::app()->getRequest()->getParam("alpha")."%";
$postData_all = Mage::app()->getRequest()->getParam("alpha");
if(isset($postData_all) && $postData_all!= "" && trim($postData_all) !="ALL"){
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection())
->addAttributeToFilter(array(array("attribute"=>"name", "like"=>$postData)  ));
}else{
$this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
}////Code End
}
return $this;
}

在app/design/frontend/default/default/template/catalog/product/list/toolbar.phtml
尾部增加如下代码如可:

<div>
<p>
<?php
$postData = Mage::app()->getRequest()->getParam("alpha");
foreach ($search_array  as $search_array_value):
if (strstr( $this->helper("core/url")->getCurrentUrl(), "?" )){
$final_Url =  $this->str_replace_once("&","?",str_replace
("?alpha=".trim($postData["alpha"]),"",str_replace($make_nbsp.
"alpha=".trim($postData["alpha"]),"",$this->helper("core/url")->getCurrentUrl())));
}else{
$final_Url = str_replace("?alpha=".trim($postData["alpha"]),"",
str_replace($make_nbsp."alpha=".trim($postData["alpha"]),"",
$this->helper("core/url")->getCurrentUrl()));    }?>
<a href="<?php echo $final_Url.$make_nbsp."alpha=".$search_array_value;?>" 
title="<?php echo $_label ?>"><?php echo $search_array_value; ?></a>&nbsp;&nbsp;
<?php endforeach; ?>
</p>
</div>