1
A
回答
0
標籤要導入的格式應該是這樣的
和地點有關電子表格root/tagimport/tagsheet.csv
並粘貼到root/tagimport/importtag.php
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/../app/Mage.php';
Mage::app();
$fileName = 'importtag.csv';
getAttributeCsv($fileName);
function getAttributeCsv($fileName){
$file = fopen($fileName,"r");
$RemoveLine = 0;
while(!feof($file)){
$data = fgetcsv($file);
if($RemoveLine != 0){
$labelText[] = $data[1];
}$RemoveLine++;
}createAttribute($labelText);
fclose($file);
}
function createAttribute($labelText)
{
foreach($labelText as $tag){
if($tag){
$quote = Mage::getModel('tag/tag');
$quote->loadByName($tag);
if(!$quote->getId()){
$quote->setName($tag);
$quote->setStatus(1);
$quote->setFirstStoreId(0);
$quote->setPopularity(0);
$quote->save();
##### Save product tags in "tag_properties"
$connectionresource = Mage::getSingleton('core/resource');
$connectionWrite = $connectionresource->getConnection('core_write');
$table = 'tag_properties';
$query = "insert into ".$table." "."(tag_id,store_id,base_popularity) values "."(:tag_id, :store_id, :base_popularity)";
$binds = array(
'tag_id' => $quote->getTagId(),
'store_id' => '1',
'base_popularity' => '0',
);
$connectionWrite->query($query, $binds);
echo 'Tags Imported Successfully';
}
}
}
}
運行上面下面的代碼php文件使用
www.yourdomain.com/tagimport/importtag.php
相關問題
- 1. 通過xml文件導入magento產品
- 2. 更改產品標籤Magento
- 3. magento促銷產品導入?
- 4. 將Magento產品列表導入xml產品列表
- 5. 僅導入magento類別和產品表
- 6. Magento的套裝產品圖片標籤在導入
- 7. Magento的:更改產品的價格通過讓產品編號
- 8. Magento:如何通過標籤名稱獲取產品?
- 9. Magento通過Dataprofiler Magento導入magento中的可配置產品默認
- 10. Magento通過現有圖像導入產品
- 11. Magento通過新的擴展名導入產品
- 12. 導入多個產品價格/ Magento中使用Magento的1.5/EE
- 13. 通過WooCommerce中的產品ID獲取產品標籤
- 14. woocommerce產品如何通過產品標籤獲得訂單
- 15. Magento標籤集合的多個產品
- 16. magento產品描述unclosed html標籤
- 17. Magento分組產品標籤問題
- 18. 更改WooCommerce電子郵件通知訂單項目表「產品」標籤
- 19. 產品導入與商店經理Magento
- 20. Magento 1.7產品重新導入問題
- 21. Magento - 導入產品 - getAdapter返回null
- 22. 導入具有屬性的產品magento
- 23. Magento導入產品時出錯
- 24. 如何將產品評論導入Magento?
- 25. Magento導入產品給出錯誤
- 26. Magento產品從csv文件導入
- 27. Magento 2不導入可配置產品
- 28. Magento 2分組產品導入
- 29. 從舊CMS導入產品到Magento
- 30. Magento的導入CSV錯誤的產品