2
A
回答
4
<?php
// Load the Magento core
require_once 'app/Mage.php';
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$userModel = Mage::getModel('admin/user');
$userModel->setUserId(0);
// Load the product collection
$collection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('*') //Select everything from the table
->addUrlRewrite(); //Generate nice URLs
/*
For this example I am generating a CSV file,
but you can change this to suit your needs.
*/
echo "title,sku,id,url\n" ."<br>";
foreach($collection as $product) {
//Load the product categories
$categories = $product->getCategoryIds();
//Select the last category in the list
$categoryId = end($categories);
//Load that category
$category = Mage::getModel('catalog/category')->load($categoryId);
echo '"'.$product->getTitle().'","'.
$product->getSku().'",'.
$product->getId().',"'.
//This will the proper URL, the base url is optional, though make sure you remove the trailing export.php (or whatever you name this file)
str_replace('export.php/','',Mage::getBaseUrl()).$product->getUrlPath($category).'"'.
"\n" ."<br>";
}
?>
+0
我們應該從哪裏寫代碼? – Narayan 2017-10-24 05:03:54
1
Create export.csv on root ..write a code to export csv the new thing is that you have to hardcode base url in the path of the product..
for example ..existing path category/product/
base url/category/product/
But remember to keep the code correct..
相關問題
- 1. 從管理產品網格將產品導出到csv
- 2. 如何從產品集合中獲取產品圖片網址?
- 3. PHP的產品網址
- 4. 導出Prestashop產品
- 5. Magento:將產品導出爲csv或excel
- 6. WooCommerce產品變更網址
- 7. 產品網址問題?
- 8. 取回產品網址
- 9. 學習導軌。例如,產品,產品,@產品,product.id,product_id
- 10. 獲得「分組產品」的網址,因爲單個產品ID
- 11. Opencart的:如何使產品的網址以全品類路徑
- 12. Magento:在分組產品中獲取產品網址
- 13. 從產品網址中刪除產品ID
- 14. 產品網址發送到產品頁面頂部
- 15. Magento的導入CSV錯誤的產品
- 16. 如何將eclipse產品導出到Linux?
- 17. 如何配置Magmi並導出產品
- 18. 插件產品與功能產品
- 19. php,CodeIgniter - 亞馬遜產品廣告API,如何從產品網址獲取ASIN
- 20. Magento的一致的產品網址
- 21. 如何找出簡單產品的主產品?
- 22. WooCommerce-如何從網站中刪除產品和產品類別?
- 23. WooCommerce-如何從網站中刪除產品和產品類別?
- 24. 重寫產品名稱的網址
- 25. Magento的產品網址鏈接
- 26. 修改wordpress中的woocommerce產品網址
- 27. 錯誤的產品網址magento
- 28. Magento產品從csv文件導入
- 29. Magento產品導入 - 超越CSV/XLS
- 30. 產品和副本產品
在谷歌第一個結果 - > http://t3jsot.blogspot.co.uk/2011/08/magento-export-products-with-full-urls.html – McNab 2013-02-14 14:00:16