【发布时间】:2010-10-01 06:46:05
【问题描述】:
提前感谢您帮助解决我的问题。
在产品中保存在 magento 中此代码不保存产品。请找到这个问题的解决方案:
<?php
define('MAGENTO_MAGE_LOCATION','/home/admin/domains/public_html/importcsv1/app/Mage.php');
error_reporting(E_ALL);
require_once MAGENTO_MAGE_LOCATION;
$client = new Zend_XmlRpc_Client('http:www.examole.com/importcsv1/index.php/api/xmlrpc/');
$session = $client->call('login', array('aazi', 'asdfjsdf'));
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$product = Mage::getModel('catalog/product');
$product->setSku("12");
$product->setName("test name of the product");
$product->setWebsiteIDs(array('1'));
$product->setTypeId('simple');
$product->setPrice("111");
$product->setInprice("222");
$product->setDescription("test description of the product");
$product->setShort_description("test short description of the product");
$product->setQty("11");
$product->setWeight("1.1");
$product->setCategoryIds(array(4));
try {
$product->save();
echo "<br>yes save new product insert into magento";
} catch (Exception $e) {
var_dump("NO new insert product save");
}
谁能帮我解决这个问题?
【问题讨论】:
-
您是要更新现有产品,还是要创建新产品?
-
另外,当所有错误日志都打开时,您的错误日志中会出现什么错误? (或至少 $e->getMessage())