0
아래의 코드를 사용하여 카테고리를 추가하고 있습니다.Magento 카테고리 목록이 비어 있습니다.
내 질문은 :이 코드를 수정하여 루트 범주에 범주를 추가하는 방법은 무엇입니까? 당신은 API 클래스를 사용하는 경우
require_once('../app/Mage.php');
Mage::app('mysite');
$category = Mage::getModel('catalog/category');
$category->setStoreId(Mage::app()->getStore()->getId());
if ($id) {
$category->load($id);
}
$general['name'] = "My Category";
$general['description'] = "Great My Category";
$general['meta_title'] = "My Category"; //Page title
$general['meta_keywords'] = "My , Category";
$general['meta_description'] = "Some description to be found by meta search robots. 2";
$general['is_active'] = 1;
$general['is_anchor'] = 0;
$general['url_key'] = "cars";//url to be used for this category's page by magento.
$category->addData($general);
try {
$category->save();
echo "<p>Success! Id: ".$category->getId();
}
catch (Exception $e){
echo $e->getMessage();
}
감사합니다. –
당신을 진심으로 환영합니다. 이 스크립트를 원샷 스크립트로 만들지 않으려면 API 방법을 주저하지 마십시오. 많은 문서가 인터넷을 통해 제공되며 Andrew의 메시지가 도움이 될 것입니다. – dagfr