本文整理汇总了PHP中Mage_ImportExport_Model_Import::importSource方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_ImportExport_Model_Import::importSource方法的具体用法?PHP Mage_ImportExport_Model_Import::importSource怎么用?PHP Mage_ImportExport_Model_Import::importSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_ImportExport_Model_Import
的用法示例。
在下文中一共展示了Mage_ImportExport_Model_Import::importSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testImportSource
/**
* @covers Mage_ImportExport_Model_Import::_getEntityAdapter
*/
public function testImportSource()
{
/** @var $customersCollection Mage_Customer_Model_Resource_Customer_Collection */
$customersCollection = Mage::getResourceModel('Mage_Customer_Model_Resource_Customer_Collection');
$existCustomersCount = count($customersCollection->load());
$customersCollection->resetData();
$customersCollection->clear();
$this->_model->importSource();
$customers = $customersCollection->getItems();
$addedCustomers = count($customers) - $existCustomersCount;
$this->assertGreaterThan($existCustomersCount, $addedCustomers);
}
示例2: array
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
$pattern = array('_attribute_set' => 'Default', '_type' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, '_product_websites' => 'base', 'name' => 'Product %s', 'short_description' => 'Short desc %s', 'weight' => 1, 'description' => 'Description %s', 'sku' => 'product_dynamic_%s', 'price' => 10, 'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH, 'status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED, 'tax_class_id' => 0, 'is_in_stock' => 1, 'qty' => 100500, 'use_config_min_qty' => '1', 'use_config_backorders' => '1', 'use_config_min_sale_qty' => '1', 'use_config_max_sale_qty' => '1', 'use_config_notify_stock_qty' => '1', 'use_config_manage_stock' => '1', 'use_config_qty_increments' => '1', 'use_config_enable_qty_inc' => '1', 'stock_id' => Mage_CatalogInventory_Model_Stock::DEFAULT_STOCK_ID);
$generator = new Magento_ImportExport_Fixture_Generator($pattern, 100000);
$import = new Mage_ImportExport_Model_Import(array('entity' => 'catalog_product', 'behavior' => 'append'));
// it is not obvious, but the validateSource() will actually save import queue data to DB
$import->validateSource($generator);
// this converts import queue into actual entities
$import->importSource();