• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP MShop_Product_Manager_Factory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中MShop_Product_Manager_Factory的典型用法代码示例。如果您正苦于以下问题:PHP MShop_Product_Manager_Factory类的具体用法?PHP MShop_Product_Manager_Factory怎么用?PHP MShop_Product_Manager_Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了MShop_Product_Manager_Factory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testSearchItemsWithReference

 public function testSearchItemsWithReference()
 {
     $context = TestHelper::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 = MShop_Product_Manager_Factory::createManager($context);
     $productsList = $productManager->getSubManager('list');
     $search = $productsList->createSearch();
     $expr = array($search->compare('==', 'product.list.domain', 'price'), $search->compare('==', 'product.list.refid', $price['items'][0]->{'price.id'}));
     $search->setConditions($search->combine('&&', $expr));
     $sort = array($search->sort('+', 'product.list.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:Bananamoon,项目名称:aimeos-core,代码行数:27,代码来源:DefaultTest.php


示例2: __construct

 /**
  * Initializes the product tag type controller.
  *
  * @param MShop_Context_Item_Interface $context MShop context object
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     parent::__construct($context, 'Product_Tag_Type');
     $manager = MShop_Product_Manager_Factory::createManager($context);
     $tagManager = $manager->getSubManager('tag');
     $this->_manager = $tagManager->getSubManager('type');
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:12,代码来源:Default.php


示例3: testCreateManagerInvalidName

 public function testCreateManagerInvalidName()
 {
     $this->setExpectedException('MShop_Product_Exception');
     $target = 'MShop_Common_Manager_Interface';
     $manager = MShop_Product_Manager_Factory::createManager(TestHelper::getContext(), '#$%');
     $this->assertInstanceOf($target, $manager);
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:7,代码来源:FactoryTest.php


示例4: 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();
     $couponManager = MShop_Coupon_Manager_Factory::createManager($context);
     $this->_couponItem = $couponManager->createItem();
     $provider = new MShop_Coupon_Provider_Example($context, $this->_couponItem, 'abcd');
     $this->_object = new MShop_Coupon_Provider_Decorator_BasketValues($context, $this->_couponItem, 'abcd', $provider);
     $this->_object->setObject($this->_object);
     $orderManager = MShop_Order_Manager_Factory::createManager($context);
     $orderBaseManager = $orderManager->getSubManager('base');
     $orderProductManager = $orderBaseManager->getSubManager('product');
     $productManager = MShop_Product_Manager_Factory::createManager($context);
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', array('CNC')));
     $products = $productManager->searchItems($search);
     $priceManager = 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 MShop_Order_Item_Base_Default($priceManager->createItem(), $context->getLocale());
     $this->_orderBase->addProduct($orderProducts['CNC']);
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:34,代码来源:BasketValuesTest.php


示例5: _process

 /**
  * Adds product test data.
  */
 protected function _process()
 {
     $iface = 'MShop_Context_Item_Interface';
     if (!$this->_additional instanceof $iface) {
         throw new 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 = dirname(__FILE__) . $ds . 'data' . $ds . 'product-list.php';
     if (($testdata = (include $path)) == false) {
         throw new MShop_Exception(sprintf('No file "%1$s" found for product domain', $path));
     }
     $refKeys = array();
     foreach ($testdata['product/list'] as $dataset) {
         $refKeys[$dataset['domain']][] = $dataset['refid'];
     }
     $productManager = MShop_Product_Manager_Factory::createManager($this->_additional, 'Default');
     $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['product/tag'] = $this->_getProductTagData($productManager, $refKeys['product/tag']);
     $this->_addProductData($testdata, $productManager, $refIds, $refKeys['product']);
     $this->_status('done');
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:30,代码来源:ProductListAddTestData.php


示例6: 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 = MShop_Product_Manager_Factory::createManager(TestHelper::getContext());
     $listManager = $manager->getSubManager('list');
     $this->_object = $listManager->getSubManager('type');
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:13,代码来源:DefaultTest.php


示例7: _addProductData

 /**
  * Adds the product test data.
  *
  * @param array $testdata Associative list of key/list pairs
  * @throws MW_Setup_Exception If no type ID is found
  */
 private function _addProductData(array $testdata)
 {
     $productManager = MShop_Product_Manager_Factory::createManager($this->_additional, 'Default');
     $productTypeManager = $productManager->getSubManager('type', 'Default');
     $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 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->setSupplierCode($dataset['suppliercode']);
         $product->setStatus($dataset['status']);
         $productManager->saveItem($product, false);
     }
     $this->_conn->commit();
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:37,代码来源:ProductAddTestData.php


示例8: __construct

 /**
  * Initializes the product stock warehouse controller.
  *
  * @param MShop_Context_Item_Interface $context MShop context object
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     parent::__construct($context, 'Product_Stock_Warehouse');
     $manager = MShop_Product_Manager_Factory::createManager($context);
     $stockManager = $manager->getSubManager('stock');
     $this->_manager = $stockManager->getSubManager('warehouse');
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:12,代码来源:Default.php


示例9: _process

 /**
  * Adds product stock test data.
  */
 protected function _process()
 {
     $iface = 'MShop_Context_Item_Interface';
     if (!$this->_additional instanceof $iface) {
         throw new MW_Setup_Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
     }
     $this->_msg('Adding warehouse data', 0);
     $ds = DIRECTORY_SEPARATOR;
     $path = dirname(__FILE__) . $ds . 'default' . $ds . 'data' . $ds . 'warehouse.php';
     if (($data = (include $path)) == false) {
         throw new MShop_Exception(sprintf('No file "%1$s" found for product stock domain', $path));
     }
     $manager = 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 (MW_DB_Exception $e) {
         }
         // if warehouse was already available
     }
     $this->_status($num > 0 ? $num . '/' . $total : 'OK');
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:34,代码来源:MShopAddWarehouseData.php


示例10: __construct

 /**
  * Initializes the product list controller.
  *
  * @param MShop_Context_Item_Interface $context MShop context object
  */
 public function __construct(MShop_Context_Item_Interface $context)
 {
     parent::__construct($context, 'Product_List');
     $manager = MShop_Product_Manager_Factory::createManager($context);
     $this->_manager = $manager->getSubManager('list');
     $this->_context = $context;
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:12,代码来源:Default.php


示例11: _addProductPropertyData

 /**
  * Adds the product property test data.
  *
  * @param array $testdata Associative list of key/list pairs
  * @throws MW_Setup_Exception If no type ID is found
  */
 private function _addProductPropertyData(array $testdata)
 {
     $productManager = MShop_Product_Manager_Factory::createManager($this->_additional, 'Default');
     $productPropertyManager = $productManager->getSubManager('property', 'Default');
     $productPropertyTypeManager = $productPropertyManager->getSubManager('type', 'Default');
     $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 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:Bananamoon,项目名称:aimeos-core,代码行数:38,代码来源:ProductAddPropertyTestData.php


示例12: 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 Client_Html_Catalog_List_Items_Default($context, $paths);
     $catalogManager = 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 = 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:arcavias,项目名称:arcavias-core,代码行数:31,代码来源:DefaultTest.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()
 {
     $pluginManager = MShop_Plugin_Manager_Factory::createManager(TestHelper::getContext());
     $this->_plugin = $pluginManager->createItem();
     $this->_plugin->setTypeId(2);
     $this->_plugin->setProvider('PropertyMatch');
     $this->_plugin->setConfig(array('product.suppliercode' => 'unitSupplier'));
     $this->_plugin->setStatus('1');
     $orderManager = MShop_Order_Manager_Factory::createManager(TestHelper::getContext());
     $orderBaseManager = $orderManager->getSubManager('base');
     $orderBaseProductManager = $orderBaseManager->getSubManager('product');
     $manager = 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 MShop_Plugin_Provider_Order_PropertyMatch(TestHelper::getContext(), $this->_plugin);
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:33,代码来源:PropertyMatchTest.php


示例14: testSaveDeleteItem

 public function testSaveDeleteItem()
 {
     $ctx = TestHelper::getContext();
     $productManager = 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 Exception('No item found');
     }
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('~=', 'product.label', 'Cheapest'));
     $items = $productManager->searchItems($search);
     if (($productItem = reset($items)) === false) {
         throw new Exception('No item found');
     }
     $saveParams = (object) array('site' => 'unittest', 'items' => (object) array('product.stock.productid' => $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.productid'}, $searched['items'][0]->{'product.stock.productid'});
     $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:Bananamoon,项目名称:aimeos-core,代码行数:35,代码来源:DefaultTest.php


示例15: testSaveDeleteItem

 public function testSaveDeleteItem()
 {
     $productManager = MShop_Product_Manager_Factory::createManager(TestHelper::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('==', 'catalog.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('==', 'catalog.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:arcavias,项目名称:arcavias-core,代码行数:28,代码来源:DefaultTest.php


示例16: testFinish

 public function testFinish()
 {
     $productManager = 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:arcavias,项目名称:arcavias-core,代码行数:8,代码来源:DefaultTest.php


示例17: testExportCSVFile

 public function testExportCSVFile()
 {
     $productManager = 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 (mkdir($testdir) === false) {
         throw new 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('metadescription', $lines[2][4]);
     $this->assertEquals('Expresso', $lines[2][6]);
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:57,代码来源:DefaultTest.php


示例18: _addProductStockData

 /**
  * Adds the product stock test data.
  *
  * @param array $testdata Associative list of key/list pairs
  * @throws MW_Setup_Exception If no type ID is found
  */
 private function _addProductStockData(array $testdata)
 {
     $productManager = MShop_Product_Manager_Factory::createManager($this->_additional, 'Default');
     $productStockManager = $productManager->getSubManager('stock', 'Default');
     $productStockWarehouse = $productStockManager->getSubManager('warehouse', 'Default');
     $productStockUnitManager = $productStockManager->getSubManager('unit', 'Default');
     $prodcode = array();
     foreach ($testdata['product/stock'] as $dataset) {
         if (($pos = strpos($dataset['prodid'], '/')) === false || ($str = substr($dataset['prodid'], $pos + 1)) == false) {
             throw new MW_Setup_Exception(sprintf('Some keys for prodid are set wrong "%1$s"', $dataset['prodid']));
         }
         $prodcode[] = $str;
     }
     $search = $productManager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', $prodcode));
     $parentIds = array();
     foreach ($productManager->searchItems($search) as $item) {
         $parentIds['product/' . $item->getCode()] = $item->getId();
     }
     $wareIds = $unitIds = array();
     $ware = $productStockWarehouse->createItem();
     $unit = $productStockUnitManager->createItem();
     $this->_conn->begin();
     foreach ($testdata['product/stock/unit'] as $key => $dataset) {
         $unit->setId(null);
         $unit->setCode($dataset['code']);
         $unit->setLabel($dataset['label']);
         $unit->setStatus($dataset['status']);
         $productStockUnitManager->saveItem($unit);
         $unitIds[$key] = $unit->getId();
     }
     foreach ($testdata['product/stock/warehouse'] as $key => $dataset) {
         $ware->setId(null);
         $ware->setCode($dataset['code']);
         $ware->setLabel($dataset['label']);
         $ware->setStatus($dataset['status']);
         $productStockWarehouse->saveItem($ware);
         $wareIds[$key] = $ware->getId();
     }
     $stock = $productStockManager->createItem();
     foreach ($testdata['product/stock'] as $dataset) {
         if (!isset($parentIds[$dataset['prodid']])) {
             throw new MW_Setup_Exception(sprintf('No product ID found for "%1$s"', $dataset['prodid']));
         }
         if (!isset($wareIds[$dataset['warehouseid']])) {
             throw new MW_Setup_Exception(sprintf('No warehouse ID found for "%1$s"', $dataset['warehouseid']));
         }
         $stock->setId(null);
         $stock->setProductId($parentIds[$dataset['prodid']]);
         $stock->setWarehouseId($wareIds[$dataset['warehouseid']]);
         $stock->setUnitId($unitIds[$dataset['unitid']]);
         $stock->setStocklevel($dataset['stocklevel']);
         $stock->setDateBack($dataset['backdate']);
         $productStockManager->saveItem($stock, false);
     }
     $this->_conn->commit();
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:63,代码来源:ProductAddStockTestData.php


示例19: _getProductItem

 protected function _getProductItem()
 {
     $manager = MShop_Product_Manager_Factory::createManager(TestHelper::getContext());
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', 'CNC'));
     $items = $manager->searchItems($search, array('text'));
     if (($item = reset($items)) === false) {
         throw new Exception('No product item with code "CNC" found');
     }
     return $item;
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:11,代码来源:DefaultTest.php


示例20: _getProductItem

 /**
  * @param string $code
  */
 protected function _getProductItem($code)
 {
     $manager = MShop_Product_Manager_Factory::createManager($this->_context);
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', $code));
     $items = $manager->searchItems($search);
     if (($item = reset($items)) === false) {
         throw new Exception(sprintf('No product item with code "%1$s" found', $code));
     }
     return $item;
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:14,代码来源:DefaultTest.php



注:本文中的MShop_Product_Manager_Factory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP MText类代码示例发布时间:2022-05-23
下一篇:
PHP MShop_Order_Manager_Factory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap