本文整理汇总了PHP中Aimeos\MShop\Product\Manager\Factory类的典型用法代码示例。如果您正苦于以下问题:PHP Factory类的具体用法?PHP Factory怎么用?PHP Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Factory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: migrate
/**
* Insert product data.
*/
public function migrate()
{
$this->msg('Adding product base performance data', 0);
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->getContext());
$productTypeItem = $this->getTypeItem('product/type', 'product', 'default');
$productItem = $productManager->createItem();
$productItem->setTypeId($productTypeItem->getId());
$productItem->setStatus(1);
$productItem->setDateStart('1970-01-01 00:00:00');
if ($this->count >= 1000) {
$count = (int) $this->count / 1000;
$size = 1000;
} else {
$count = 1;
$size = $this->count;
}
for ($i = 0; $i < $count; $i++) {
$this->txBegin();
for ($j = 0; $j < $size; $j++) {
$code = 'perf-' . str_pad($i * 1000 + $j, 5, '0', STR_PAD_LEFT);
$productItem->setId(null);
$productItem->setCode($code);
$productItem->setLabel($code);
$productManager->saveItem($productItem, false);
}
$this->txCommit();
}
$this->status('done');
}
开发者ID:aimeos,项目名称:aimeos-core,代码行数:32,代码来源:ProductAddBasePerfData.php
示例2: testSearchItemsWithReference
public function testSearchItemsWithReference()
{
$context = \TestHelperExtjs::getContext();
$params = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('price.quantity' => 1000)))), 'sort' => 'price.quantity', 'dir' => 'ASC', 'start' => 0, 'limit' => 1);
$price = $this->object->searchItems($params);
// find refs
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
$productsList = $productManager->getSubManager('lists');
$search = $productsList->createSearch();
$expr = array($search->compare('==', 'product.lists.domain', 'price'), $search->compare('==', 'product.lists.refid', $price['items'][0]->{'price.id'}));
$search->setConditions($search->combine('&&', $expr));
$sort = array($search->sort('+', 'product.lists.id'));
$search->setSortations($sort);
$search->setSlice(0, 1);
$items = $productsList->searchItems($search);
if (($productItem = reset($items)) === false) {
throw new \Exception('No item found');
}
$parentid = $productItem->getParentId();
// search with refs
$params = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('price.quantity' => 1000)))), 'sort' => 'price.quantity', 'dir' => 'ASC', 'start' => 0, 'limit' => 1, 'domain' => 'product', 'parentid' => $parentid);
$result = $this->object->searchItems($params);
$this->assertEquals(1, count($result['items']));
$this->assertEquals(1, $result['total']);
$this->assertTrue($result['success']);
$this->assertEquals($price['items'], $result['items']);
}
开发者ID:mvnp,项目名称:aimeos-core,代码行数:27,代码来源:StandardTest.php
示例3: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$context = \TestHelper::getContext();
$paths = \TestHelper::getHtmlTemplatePaths();
$this->object = new \Aimeos\Client\Html\Catalog\Lists\Items\Standard($context, $paths);
$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($context);
$search = $catalogManager->createSearch();
$search->setConditions($search->compare('==', 'catalog.code', 'cafe'));
$catItems = $catalogManager->searchItems($search);
if (($catItem = reset($catItems)) === false) {
throw new \Exception('No catalog item found');
}
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
$search = $productManager->createSearch();
$search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE')));
$total = 0;
$view = \TestHelper::getView();
$view->listProductItems = $productManager->searchItems($search, array('media', 'price', 'text'), $total);
$view->listProductTotal = $total;
$view->listPageSize = 100;
$view->listPageCurr = 1;
$view->listParams = array();
$view->listCatPath = array($catalogManager->createItem(), $catItem);
$this->object->setView($view);
}
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:31,代码来源:StandardTest.php
示例4: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->editor = \TestHelper::getContext()->getEditor();
$manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelper::getContext());
$listManager = $manager->getSubManager('lists');
$this->object = $listManager->getSubManager('type');
}
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:13,代码来源:StandardTest.php
示例5: addProductPropertyData
/**
* Adds the product property test data.
*
* @param array $testdata Associative list of key/list pairs
* @throws \Aimeos\MW\Setup\Exception If no type ID is found
*/
private function addProductPropertyData(array $testdata)
{
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->additional, 'Standard');
$productPropertyManager = $productManager->getSubManager('property', 'Standard');
$productPropertyTypeManager = $productPropertyManager->getSubManager('type', 'Standard');
$typeIds = array();
$type = $productPropertyTypeManager->createItem();
$prodIds = $this->getProductIds($productManager);
$this->conn->begin();
foreach ($testdata['product/property/type'] as $key => $dataset) {
$type->setId(null);
$type->setCode($dataset['code']);
$type->setDomain($dataset['domain']);
$type->setLabel($dataset['label']);
$type->setStatus($dataset['status']);
$productPropertyTypeManager->saveItem($type);
$typeIds[$key] = $type->getId();
}
$prodProperty = $productPropertyManager->createItem();
foreach ($testdata['product/property'] as $key => $dataset) {
if (!isset($typeIds[$dataset['typeid']])) {
throw new \Aimeos\MW\Setup\Exception(sprintf('No product property type ID found for "%1$s"', $dataset['typeid']));
}
$prodProperty->setId(null);
$prodProperty->setParentId($prodIds[$dataset['parentid']]);
$prodProperty->setTypeId($typeIds[$dataset['typeid']]);
$prodProperty->setLanguageId($dataset['langid']);
$prodProperty->setValue($dataset['value']);
$productPropertyManager->saveItem($prodProperty, false);
}
$this->conn->commit();
}
开发者ID:mvnp,项目名称:aimeos-core,代码行数:38,代码来源:ProductAddPropertyTestData.php
示例6: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelperMShop::getContext());
$this->plugin = $pluginManager->createItem();
$this->plugin->setProvider('PropertyAdd');
$this->plugin->setStatus('1');
$this->plugin->setConfig(array('product.stock.parentid' => array('product.stock.warehouseid', 'product.stock.editor', 'product.stock.stocklevel', 'product.stock.dateback')));
$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperMShop::getContext());
$orderBaseManager = $orderManager->getSubManager('base');
$orderBaseProductManager = $orderBaseManager->getSubManager('product');
$manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperMShop::getContext());
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'product.code', array('CNE', 'CNC')));
$products = $manager->searchItems($search);
if (count($products) !== 2) {
throw new \Exception('Wrong number of products');
}
$this->products = array();
foreach ($products as $product) {
$item = $orderBaseProductManager->createItem();
$item->copyFrom($product);
$this->products[$product->getCode()] = $item;
}
$this->order = $orderBaseManager->createItem();
$this->object = new \Aimeos\MShop\Plugin\Provider\Order\PropertyAdd(\TestHelperMShop::getContext(), $this->plugin);
}
开发者ID:mvnp,项目名称:aimeos-core,代码行数:32,代码来源:PropertyAddTest.php
示例7: testSaveDeleteItem
public function testSaveDeleteItem()
{
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelperMShop::getContext());
$search = $productManager->createSearch();
$search->setConditions($search->compare('==', 'product.code', 'CNC'));
$result = $productManager->searchItems($search, array('attribute'));
if (($product = reset($result)) === false) {
throw new \Exception('No product item with code CNE found!');
}
$attributes = $product->getRefItems('attribute');
if (($attrItem = reset($attributes)) === false) {
throw new \Exception('Product doesnt have any attribute item');
}
$product->setId(null);
$product->setCode('ModifiedCNC');
$productManager->saveItem($product);
$this->object->saveItem($product);
$search = $this->object->createSearch();
$search->setConditions($search->compare('==', 'index.attribute.id', $attrItem->getId()));
$result = $this->object->searchItems($search);
$this->object->deleteItem($product->getId());
$productManager->deleteItem($product->getId());
$search = $this->object->createSearch();
$search->setConditions($search->compare('==', 'index.attribute.id', $attrItem->getId()));
$result2 = $this->object->searchItems($search);
$this->assertContains($product->getId(), array_keys($result));
$this->assertFalse(in_array($product->getId(), array_keys($result2)));
}
开发者ID:mvnp,项目名称:aimeos-core,代码行数:28,代码来源:StandardTest.php
示例8: addProductData
/**
* Adds the product test data.
*
* @param array $testdata Associative list of key/list pairs
* @throws \Aimeos\MW\Setup\Exception If no type ID is found
*/
private function addProductData(array $testdata)
{
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->additional, 'Standard');
$productTypeManager = $productManager->getSubManager('type', 'Standard');
$typeIds = array();
$type = $productTypeManager->createItem();
$this->conn->begin();
foreach ($testdata['product/type'] as $key => $dataset) {
$type->setId(null);
$type->setCode($dataset['code']);
$type->setDomain($dataset['domain']);
$type->setLabel($dataset['label']);
$type->setStatus($dataset['status']);
$productTypeManager->saveItem($type);
$typeIds[$key] = $type->getId();
}
$product = $productManager->createItem();
foreach ($testdata['product'] as $key => $dataset) {
if (!isset($typeIds[$dataset['typeid']])) {
throw new \Aimeos\MW\Setup\Exception(sprintf('No product type ID found for "%1$s"', $dataset['typeid']));
}
$product->setId(null);
$product->setTypeId($typeIds[$dataset['typeid']]);
$product->setCode($dataset['code']);
$product->setLabel($dataset['label']);
$product->setStatus($dataset['status']);
if (isset($dataset['config'])) {
$product->setConfig($dataset['config']);
} else {
$product->setConfig(array());
}
$productManager->saveItem($product, false);
}
$this->conn->commit();
}
开发者ID:aimeos,项目名称:aimeos-core,代码行数:41,代码来源:ProductAddTestData.php
示例9: setUp
/**
* Sets up the fixture, especially creates products.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$orderProducts = array();
$context = \TestHelper::getContext();
$this->couponItem = \Aimeos\MShop\Coupon\Manager\Factory::createManager($context)->createItem();
$provider = new \Aimeos\MShop\Coupon\Provider\Example($context, $this->couponItem, 'abcd');
$this->object = new \Aimeos\MShop\Coupon\Provider\Decorator\Required($context, $this->couponItem, 'abcd', $provider);
$this->object->setObject($this->object);
$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context);
$orderBaseManager = $orderManager->getSubManager('base');
$orderProductManager = $orderBaseManager->getSubManager('product');
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
$search = $productManager->createSearch();
$search->setConditions($search->compare('==', 'product.code', array('CNC')));
$products = $productManager->searchItems($search);
$priceManager = \Aimeos\MShop\Price\Manager\Factory::createManager($context);
$price = $priceManager->createItem();
$price->setValue(321);
foreach ($products as $product) {
$orderProduct = $orderProductManager->createItem();
$orderProduct->copyFrom($product);
$orderProducts[$product->getCode()] = $orderProduct;
}
$orderProducts['CNC']->setPrice($price);
$this->orderBase = new \Aimeos\MShop\Order\Item\Base\Standard($priceManager->createItem(), $context->getLocale());
$this->orderBase->addProduct($orderProducts['CNC']);
}
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:33,代码来源:RequiredTest.php
示例10: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$pluginManager = \Aimeos\MShop\Plugin\Manager\Factory::createManager(\TestHelper::getContext());
$this->plugin = $pluginManager->createItem();
$this->plugin->setTypeId(2);
$this->plugin->setProvider('ProductLimit');
$this->plugin->setConfig(array('single-number-max' => 10));
$this->plugin->setStatus('1');
$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelper::getContext());
$orderBaseManager = $orderManager->getSubManager('base');
$orderBaseProductManager = $orderBaseManager->getSubManager('product');
$manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelper::getContext());
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'product.code', array('CNE', 'CNC')));
$products = $manager->searchItems($search);
if (count($products) !== 2) {
throw new \Exception('Wrong number of products');
}
$this->products = array();
foreach ($products as $product) {
$item = $orderBaseProductManager->createItem();
$item->copyFrom($product);
$this->products[$product->getCode()] = $item;
}
$this->order = $orderBaseManager->createItem();
$this->object = new \Aimeos\MShop\Plugin\Provider\Order\ProductLimit(\TestHelper::getContext(), $this->plugin);
}
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:33,代码来源:ProductLimitTest.php
示例11: testSaveDeleteItem
public function testSaveDeleteItem()
{
$ctx = \TestHelperExtjs::getContext();
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($ctx);
$warehouseManager = $productManager->getSubManager('stock')->getSubManager('warehouse');
$search = $warehouseManager->createSearch();
$search->setConditions($search->compare('==', 'product.stock.warehouse.code', 'default'));
$search->setSlice(0, 1);
$items = $warehouseManager->searchItems($search);
if (($warehouseItem = reset($items)) === false) {
throw new \RuntimeException('No item found');
}
$search = $productManager->createSearch();
$search->setConditions($search->compare('~=', 'product.label', 'Cheapest'));
$items = $productManager->searchItems($search);
if (($productItem = reset($items)) === false) {
throw new \RuntimeException('No item found');
}
$saveParams = (object) array('site' => 'unittest', 'items' => (object) array('product.stock.parentid' => $productItem->getId(), 'product.stock.warehouseid' => $warehouseItem->getId(), 'product.stock.stocklevel' => 999, 'product.stock.dateback' => '2000-01-01 00:00:01'));
$saved = $this->object->saveItems($saveParams);
$searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('product.stock.dateback' => '2000-01-01 00:00:01')))));
$searched = $this->object->searchItems($searchParams);
$deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'product.stock.id'});
$this->object->deleteItems($deleteParams);
$result = $this->object->searchItems($searchParams);
$this->assertInternalType('object', $saved['items']);
$this->assertNotNull($saved['items']->{'product.stock.id'});
$this->assertEquals($saved['items']->{'product.stock.id'}, $searched['items'][0]->{'product.stock.id'});
$this->assertEquals($saved['items']->{'product.stock.parentid'}, $searched['items'][0]->{'product.stock.parentid'});
$this->assertEquals($saved['items']->{'product.stock.warehouseid'}, $searched['items'][0]->{'product.stock.warehouseid'});
$this->assertEquals($saved['items']->{'product.stock.stocklevel'}, $searched['items'][0]->{'product.stock.stocklevel'});
$this->assertEquals($saved['items']->{'product.stock.dateback'}, $searched['items'][0]->{'product.stock.dateback'});
$this->assertEquals(1, count($searched['items']));
$this->assertEquals(0, count($result['items']));
}
开发者ID:aimeos,项目名称:ai-admin-extadm,代码行数:35,代码来源:StandardTest.php
示例12: process
/**
* Adds product stock test data.
*/
protected function process()
{
$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
if (!$this->additional instanceof $iface) {
throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
}
$this->msg('Adding warehouse data', 0);
$ds = DIRECTORY_SEPARATOR;
$path = __DIR__ . $ds . 'default' . $ds . 'data' . $ds . 'warehouse.php';
if (($data = (include $path)) == false) {
throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for product stock domain', $path));
}
$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->additional);
$warehouseManager = $manager->getSubManager('stock')->getSubManager('warehouse');
$num = $total = 0;
$item = $warehouseManager->createItem();
foreach ($data['warehouse'] as $key => $dataset) {
$total++;
$item->setId(null);
$item->setCode($dataset['code']);
$item->setLabel($dataset['label']);
$item->setStatus($dataset['status']);
try {
$warehouseManager->saveItem($item);
$num++;
} catch (\Aimeos\MW\DB\Exception $e) {
}
// if warehouse was already available
}
$this->status($num > 0 ? $num . '/' . $total : 'OK');
}
开发者ID:mvnp,项目名称:aimeos-core,代码行数:34,代码来源:MShopAddWarehouseData.php
示例13: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$context = \TestHelperHtml::getContext();
$config = $context->getConfig();
$config->set('client/html/catalog/lists/basket-add', true);
$paths = \TestHelperHtml::getHtmlTemplatePaths();
$this->object = new \Aimeos\Client\Html\Catalog\Lists\Items\Standard($context, $paths);
$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($context);
$search = $catalogManager->createSearch();
$search->setConditions($search->compare('==', 'catalog.code', 'cafe'));
$catItems = $catalogManager->searchItems($search);
if (($catItem = reset($catItems)) === false) {
throw new \RuntimeException('No catalog item found');
}
$domains = array('media', 'price', 'text', 'attribute', 'product');
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
$search = $productManager->createSearch();
$search->setConditions($search->compare('==', 'product.code', array('CNE', 'U:TEST', 'U:BUNDLE')));
$total = 0;
$view = \TestHelperHtml::getView('unittest', $config);
$view->listProductItems = $productManager->searchItems($search, $domains, $total);
$view->listProductTotal = $total;
$view->listPageSize = 100;
$view->listPageCurr = 1;
$view->listParams = array();
$view->listCatPath = array($catalogManager->createItem(), $catItem);
$this->object->setView($view);
}
开发者ID:aimeos,项目名称:ai-client-html,代码行数:34,代码来源:StandardTest.php
示例14: process
/**
* Adds product test data.
*/
protected function process()
{
$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
if (!$this->additional instanceof $iface) {
throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
}
$this->msg('Adding product-list test data', 0);
$this->additional->setEditor('core:unittest');
$ds = DIRECTORY_SEPARATOR;
$path = __DIR__ . $ds . 'data' . $ds . 'product-list.php';
if (($testdata = (include $path)) == false) {
throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for product domain', $path));
}
$refKeys = array();
foreach ($testdata['product/lists'] as $dataset) {
$refKeys[$dataset['domain']][] = $dataset['refid'];
}
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->additional, 'Standard');
$refIds = array();
$refIds['attribute'] = $this->getAttributeData($refKeys['attribute']);
$refIds['media'] = $this->getMediaData($refKeys['media']);
$refIds['price'] = $this->getPriceData($refKeys['price']);
$refIds['text'] = $this->getTextData($refKeys['text']);
$refIds['tag'] = $this->getTagData($refKeys['tag']);
$this->addProductData($testdata, $productManager, $refIds, $refKeys['product']);
$this->status('done');
}
开发者ID:mvnp,项目名称:aimeos-core,代码行数:30,代码来源:ProductListAddTestData.php
示例15: testFinish
public function testFinish()
{
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelper::getContext());
$search = $productManager->createSearch();
$search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE')));
$result = $productManager->searchItems($search);
$this->object->finish((object) array('site' => 'unittest', 'items' => array_keys($result)));
}
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:8,代码来源:StandardTest.php
示例16: testExportCSVFile
public function testExportCSVFile()
{
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
$criteria = $productManager->createSearch();
$expr = array();
$expr[] = $criteria->compare('==', 'product.code', 'CNE');
$criteria->setConditions($criteria->compare('==', 'product.code', 'CNE'));
$searchResult = $productManager->searchItems($criteria);
if (($productItem = reset($searchResult)) === false) {
throw new \Exception('No item with product code CNE found');
}
$params = new \stdClass();
$params->site = $this->context->getLocale()->getSite()->getCode();
$params->items = $productItem->getId();
$params->lang = 'de';
$result = $this->object->exportFile($params);
$file = substr($result['file'], 9, -14);
$this->assertTrue(file_exists($file));
$zip = new \ZipArchive();
$zip->open($file);
$testdir = 'tmp' . DIRECTORY_SEPARATOR . 'csvexport';
if (!is_dir($testdir) && mkdir($testdir, 0755, true) === false) {
throw new \Aimeos\Controller\ExtJS\Exception(sprintf('Couldn\'t create directory "csvexport"'));
}
$zip->extractTo($testdir);
$zip->close();
if (unlink($file) === false) {
throw new \Exception('Unable to remove export file');
}
$deCSV = $testdir . DIRECTORY_SEPARATOR . 'de.csv';
$this->assertTrue(file_exists($deCSV));
$fh = fopen($deCSV, 'r');
$lines = array();
while (($data = fgetcsv($fh)) != false) {
$lines[] = $data;
}
fclose($fh);
if (unlink($deCSV) === false) {
throw new \Exception('Unable to remove export file');
}
if (rmdir($testdir) === false) {
throw new \Exception('Unable to remove test export directory');
}
$this->assertEquals($lines[0][0], 'Language ID');
$this->assertEquals($lines[0][1], 'Product type');
$this->assertEquals($lines[0][2], 'Product code');
$this->assertEquals($lines[0][3], 'List type');
$this->assertEquals($lines[0][4], 'Text type');
$this->assertEquals($lines[0][5], 'Text ID');
$this->assertEquals($lines[0][6], 'Text');
$this->assertEquals('de', $lines[2][0]);
$this->assertEquals('default', $lines[2][1]);
$this->assertEquals('CNE', $lines[2][2]);
$this->assertEquals('unittype13', $lines[2][3]);
$this->assertEquals('meta-description', $lines[2][4]);
$this->assertEquals('Expresso', $lines[2][6]);
}
开发者ID:mvnp,项目名称:aimeos-core,代码行数:57,代码来源:StandardTest.php
示例17: getProductItem
protected function getProductItem()
{
$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'product.code', 'CNC'));
$items = $manager->searchItems($search);
if (($item = reset($items)) === false) {
throw new \RuntimeException('No product item with code "CNC" found');
}
return $item;
}
开发者ID:aimeos,项目名称:ai-client-html,代码行数:11,代码来源:StandardTest.php
示例18: getProductItem
protected function getProductItem()
{
$manager = \Aimeos\MShop\Product\Manager\Factory::createManager(\TestHelper::getContext());
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'product.code', 'CNE'));
$items = $manager->searchItems($search, array('product'));
if (($item = reset($items)) === false) {
throw new \Exception('No product item with code "CNE" found');
}
return $item;
}
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:11,代码来源:StandardTest.php
示例19: getProductItem
/**
* @param string $code
*/
protected function getProductItem($code)
{
$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'product.code', $code));
$items = $manager->searchItems($search, array('price'));
if (($item = reset($items)) === false) {
throw new \Exception(sprintf('No product item with code "%1$s" found', $code));
}
return $item;
}
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:14,代码来源:StandardTest.php
示例20: migrate
/**
* Insert catalog nodes and product/catalog relations.
*/
public function migrate()
{
$this->msg('Adding product categories performance data', 0);
$context = $this->getContext();
$catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($context);
$catalogListManager = $catalogManager->getSubManager('lists');
$catalogListTypeManager = $catalogListManager->getSubManager('type');
$search = $catalogListTypeManager->createSearch();
$expr = array($search->compare('==', 'catalog.lists.type.domain', 'product'), $search->compare('==', 'catalog.lists.type.code', 'default'));
$search->setConditions($search->combine('&&', $expr));
$types = $catalogListTypeManager->searchItems($search);
if (($typeItem = reset($types)) === false) {
throw new \RuntimeException('Catalog list type item not found');
}
$search = $catalogManager->createSearch();
$search->setSortations(array($search->sort('+', 'catalog.level'), $search->sort('+', 'catalog.left')));
$search->setSlice(0, 0x7fffffff);
$catIds = array_keys($catalogManager->searchItems($search));
$listItem = $catalogListManager->createItem();
$listItem->setTypeId($typeItem->getId());
$listItem->setDomain('product');
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
$search = $productManager->createSearch();
$search->setSortations(array($search->sort('+', 'product.id')));
$search->setSlice(0, 1000);
$start = $pos = 0;
do {
$catId = current($catIds);
if (($catId2 = next($catIds)) === false) {
$catId2 = reset($catIds);
}
$result = $productManager->searchItems($search);
$this->txBegin();
foreach ($result as $id => $item) {
$listItem->setId(null);
$listItem->setParentId($catId);
$listItem->setRefId($id);
$listItem->setPosition($pos++);
$catalogListManager->saveItem($listItem, false);
$listItem->setId(null);
$listItem->setParentId($catId2);
$listItem->setRefId($id);
$listItem->setPosition($pos++);
$catalogListManager->saveItem($listItem, false);
}
$this->txCommit();
$count = count($result);
$start += $count;
$search->setSlice($start, 1000);
} while ($count == $search->getSliceSize());
$this->status('done');
}
开发者ID:aimeos,项目名称:aimeos-core,代码行数:55,代码来源:CatalogAddProductPerfData.php
注:本文中的Aimeos\MShop\Product\Manager\Factory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论