오랜 시간 동안 검색 한 후 메이지 코어 파일에서 솔루션을 추출하지 못하면 status
속성과 동일한 속성을 만들었습니다. 이 속성의 이름은 Archive
(예/아니오)입니다. 이 새로운 속성은 제품의 생산 중단 여부를 정당화합니다.
Atlast,이 새로운 속성 Archive
과 관련된 모든 제품 목록, 제품 세부 정보 및 홈 페이지 만 필터링합니다.
나는
status
status = disabled
제품에 대한 예로서
Archive
을 트리거
enabled
로 동시에 모든 제품을 변경하는 MVC 액션을 쓸 계획입니다. 나는 곧 여기에서 코드를 공유 할 것이다.
코드 :
는 URL을 호출 할 때 다음 코드를 실행하는 더미 컨트롤러 쓰기 :
public function updateproductsAction() {
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
->addAttributeToFilter('type_id', array('eq' => 'configurable'))
->addAttributeToFilter('entity_id', array('gt' => 0)); // This line should be removed to affect all the configurable products. (to avoid execution time-out)
echo 'Total are ' . count($collectionConfigurable) . '<br/>';
$i = 1;
foreach($collectionConfigurable as $p) {
$product = Mage::getModel('catalog/product')->load($p->getId());
$product->save();
echo $i++ . ') The product Id with ' . $p->getId() . " is done...." . "<br/>"; // if the execution time-out occurs, note down the last product id and change the value above in addAttributeToFilter. so the execution runs from the last stopped product.
}
}
나는 완전한 코어 파일의 섹션을 비교 검색을하지만 난 아무것도 찾을 수 없습니다 .. –