当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Object::setId方法代码示例

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


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

示例1: setTrackingReqeust

 protected function setTrackingReqeust()
 {
     $r = new Varien_Object();
     $id = $this->getConfigData('id');
     $r->setId($id);
     $this->_rawTrackRequest = $r;
 }
开发者ID:FranchuCorraliza,项目名称:magento,代码行数:7,代码来源:Abstract.php

示例2: testGetStoredAliasForCustomer

 /**
  * @loadFixture ../../../var/fixtures/aliases.yaml
  */
 public function testGetStoredAliasForCustomer()
 {
     $reflectionClass = new ReflectionClass(get_class($this->_block));
     $method = $reflectionClass->getMethod("getStoredAliasForCustomer");
     $method->setAccessible(true);
     $this->assertNull($method->invoke($this->_block));
     $configMock = $this->getModelMock('ops/config', array('isAliasManagerEnabled'));
     $configMock->expects($this->any())->method('isAliasManagerEnabled')->will($this->returnValue(true));
     $this->replaceByMock('model', 'ops/config', $configMock);
     $aliases = Mage::getModel('ops/alias')->getCollection()->addFieldToFilter('customer_id', 1)->addFieldToFilter('state', Netresearch_OPS_Model_Alias_State::ACTIVE)->setOrder('created_at', Varien_Data_Collection::SORT_ORDER_DESC);
     $alias = $aliases->getFirstItem();
     $aliasHelperMock = $this->getHelperMock('ops/alias', array('getAliasesForAddresses'));
     $aliasHelperMock->expects($this->once())->method('getAliasesForAddresses')->will($this->returnValue($aliases));
     $this->replaceByMock('helper', 'ops/alias', $aliasHelperMock);
     $customerMock = $this->getHelperMock('customer/data', array('isLoggedIn'));
     $customerMock->expects($this->once())->method('isLoggedIn')->will($this->returnValue(true));
     $this->replaceByMock('helper', 'customer/data', $customerMock);
     $fakeCustomer = new Varien_Object();
     $fakeCustomer->setId(1);
     $fakeQuote = new Varien_Object();
     $fakeQuote->setCustomer($fakeCustomer);
     $blockMock = $this->getBlockMock('ops/form', array('getQuote'));
     $blockMock->expects($this->once())->method('getQuote')->will($this->returnValue($fakeQuote));
     $this->replaceByMock('block', 'ops/form', $blockMock);
     $reflectionClass = new ReflectionClass(get_class($blockMock));
     $method = $reflectionClass->getMethod("getStoredAliasForCustomer");
     $method->setAccessible(true);
     $this->assertEquals($alias->getData(), $method->invoke($blockMock));
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:32,代码来源:FormTest.php

示例3: _prepareCollection

 /**
  * Prepare grid collection
  */
 protected function _prepareCollection()
 {
     $collection = new Varien_Data_Collection();
     $layout = $this->getLayout();
     $update = $layout->getUpdate();
     $design = Mage::getSingleton('core/design_package');
     $layoutXML = $update->getFileLayoutUpdatesXml('frontend', $design->getPackageName(), $design->getTheme('layout'), 0);
     $xpath = $layoutXML->xpath('//action[@method="setEsi"]');
     foreach ($xpath as $x) {
         $esi = new Varien_Object();
         $handle = $x->xpath('ancestor::node()[last()-2]');
         $handleName = $handle[0]->label ? $handle[0]->label : $handle[0]->getName();
         $parentBlock = $x->xpath('parent::*');
         $parentBlockName = $parentBlock[0]->getAttribute('name');
         $parentBlockDescription = $parentBlock[0]->getAttribute('description');
         $cacheType = $x->params->cache_type ? $x->params->cache_type : "global";
         $esi->setId($parentBlockName);
         $esi->setHandle($handleName);
         $esi->setBlockName($parentBlockName);
         $esi->setDescription($parentBlockDescription);
         $esi->setCacheType($cacheType);
         try {
             $collection->addItem($esi);
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
开发者ID:mwin007,项目名称:Magento-Varnish,代码行数:33,代码来源:Grid.php

示例4: _prepareObject

 /**
  * Prepare page object
  *
  * @param array $data
  * @return Varien_Object
  */
 protected function _prepareObject(array $data)
 {
     $object = new Varien_Object();
     $object->setId($data[$this->getIdFieldName()]);
     $object->setUrl($data['url']);
     return $object;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:13,代码来源:Page.php

示例5: updateAttributes

 /**
  * Update attribute values for entity list per store
  *
  * @param array $entityIds
  * @param array $attrData
  * @param int $storeId
  * @return Mage_Catalog_Model_Product_Action
  */
 public function updateAttributes($entityIds, $attrData, $storeId)
 {
     $object = new Varien_Object();
     $object->setIdFieldName('entity_id')->setStoreId($storeId);
     $this->_getWriteAdapter()->beginTransaction();
     try {
         foreach ($attrData as $attrCode => $value) {
             $attribute = $this->getAttribute($attrCode);
             if (!$attribute->getAttributeId()) {
                 continue;
             }
             $i = 0;
             foreach ($entityIds as $entityId) {
                 $object->setId($entityId);
                 // collect data for save
                 $this->_saveAttributeValue($object, $attribute, $value);
                 // save collected data every 1000 rows
                 if ($i % 1000 == 0) {
                     $this->_processAttributeValues();
                 }
             }
         }
         $this->_processAttributeValues();
         $this->_getWriteAdapter()->commit();
     } catch (Exception $e) {
         $this->_getWriteAdapter()->rollBack();
         throw $e;
     }
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:38,代码来源:Action.php

示例6: _createRowObject

 /**
  * Converts map array to microdata Object
  *
  * @param array $map map array returned by the generator
  * @return null|Varien_Object
  */
 protected function _createRowObject($map)
 {
     if (empty($map['price']) || empty($map['availability']) || empty($map['title'])) {
         return null;
     }
     $microdata = new Varien_Object();
     $microdata->setName($map['title']);
     $microdata->setId($map['id']);
     if (!empty($map['sale_price'])) {
         $price = $map['sale_price'];
     } else {
         $price = $map['price'];
     }
     $microdata->setPrice(Zend_Locale_Format::toNumber($price, array('precision' => 2, 'number_format' => '#0.00')));
     $microdata->setCurrency(Mage::app()->getStore()->getCurrentCurrencyCode());
     if ($map['availability'] == 'in stock') {
         $microdata->setAvailability('http://schema.org/InStock');
     } else {
         $microdata->setAvailability('http://schema.org/OutOfStock');
     }
     if (array_key_exists('condition', $map)) {
         if (strcasecmp('new', $map['condition']) == 0) {
             $microdata->setCondition('http://schema.org/NewCondition');
         } else {
             if (strcasecmp('used', $map['condition']) == 0) {
                 $microdata->setCondition('http://schema.org/UsedCondition');
             } else {
                 if (strcasecmp('refurbished', $map['condition']) == 0) {
                     $microdata->setCondition('http://schema.org/RefurbishedCondition');
                 }
             }
         }
     }
     return $microdata;
 }
开发者ID:brandontamm,项目名称:api-merchant-center,代码行数:41,代码来源:Microdata.php

示例7: _prepareObject

 protected function _prepareObject(array $data)
 {
     $object = new Varien_Object();
     $object->setId($data['post_id']);
     $object->setUrl($data['url']);
     $object->setDate($data['date']);
     return $object;
 }
开发者ID:vstorm83,项目名称:ausport,代码行数:8,代码来源:Page.php

示例8: _prepareCategory

 /**
  * Prepare category
  *
  * @param array $categoryRow
  * @return Varien_Object
  */
 protected function _prepareCategory(array $categoryRow)
 {
     $category = new Varien_Object();
     $category->setId($categoryRow[$this->getIdFieldName()]);
     $categoryUrl = $this->getCategoryUrl($categoryRow, $category);
     $category->setUrl($categoryUrl);
     return $category;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:14,代码来源:Category.php

示例9: _beforeSave

 protected function _beforeSave(Varien_Object $object)
 {
     if (!$object->getId() && $object->getSku()) {
         $object->setId($this->getIdBySku($object->getSku()));
     }
     if (is_array($object->getData('category_ids'))) {
         $object->setData('category_ids', implode(',', $object->getData('category_ids')));
     }
     return parent::_beforeSave($object);
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:10,代码来源:Product.php

示例10: testGetRecommendedCategoryIds

 public function testGetRecommendedCategoryIds()
 {
     $productType = new Varien_Object();
     $productType->setId('test_id_1');
     $productTypeId = 'test_id_1';
     $expectedResult = array(1, 2, 3);
     $selectMock = $this->_getSelectMock(array('category_id'), 'mapping_product_type_id', 'test_id_1');
     $adapterMock = $this->_getAdapterMock($selectMock, $expectedResult);
     $this->_mockReadAdapter($adapterMock);
     $result = $this->_object->getRecommendedCategoryIds($productTypeId);
     $this->assertEquals($expectedResult, $result);
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:12,代码来源:CategoryTest.php

示例11: _ToHtml

 public function _ToHtml()
 {
     $json = array();
     $data = Mage::helper('core')->jsonDecode($this->getRequest()->getPost('data'));
     foreach ($data as $f) {
         $row = new Varien_Object();
         $row->setId($f[0]);
         $row->setCronExpr($f[1]);
         $status = new Wyomind_Simplegoogleshopping_Block_Adminhtml_Simplegoogleshopping_Renderer_Status();
         $json[] = array("id" => $f[0], "content" => $status->render($row));
     }
     return Mage::helper('core')->jsonEncode($json);
 }
开发者ID:rcclaudrey,项目名称:dev,代码行数:13,代码来源:Updater.php

示例12: _prepareProduct

 protected function _prepareProduct(array $productRow)
 {
     $product = new Varien_Object();
     $product->setId($productRow[$this->getIdFieldName()]);
     $id = $product->getId();
     $productMedia = Mage::getModel('catalog/product')->load($id)->getImage();
     $product->setMedia($productMedia);
     $productName = Mage::getModel('catalog/product')->load($id)->getName();
     $product->setName($productName);
     $productUrl = !empty($productRow['url']) ? $productRow['url'] : 'catalog/product/view/id/' . $product->getId();
     $product->setUrl($productUrl);
     return $product;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:13,代码来源:Product.php

示例13: jsonProductInfoAction

 public function jsonProductInfoAction()
 {
     $response = new Varien_Object();
     $id = $this->getRequest()->getParam('id');
     if (intval($id) > 0) {
         $product = Mage::getModel('catalog/product')->load($id);
         $response->setId($id);
         $response->addData($product->getData());
         $response->setError(0);
     } else {
         $response->setError(1);
         $response->setMessage(Mage::helper('catalog')->__('Unable to get the product ID.'));
     }
     $this->getResponse()->setBody($response->toJSON());
 }
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:15,代码来源:IndexController.php

示例14: update

 /**
  * Mage_Catalog_Model_Resource_Eav_Mysql4_Import_Product_Action::update()
  * 
  * @param mixed $entityId
  * @param mixed $data = array('statics' => , 'attributes' => , 'inventories' => )
  * @param mixed $storeId
  * @return void
  */
 public function update($entityId, $data, $storeId, $obj = null)
 {
     $object = new Varien_Object();
     $object->setIdFieldName('entity_id')->setStoreId($storeId);
     $this->_getWriteAdapter()->beginTransaction();
     try {
         if ($obj == null) {
             $obj = new Varien_Object();
         }
         if (!$obj->getId()) {
             $this->simpleLoad($obj, $entityId);
         }
         //update attributes
         foreach ($data['attributes'] as $attrCode => $value) {
             $attribute = $this->getAttribute($attrCode);
             if (!$this->__checkApply($obj, $attribute)) {
                 continue;
             }
             $object->setId($entityId);
             // collect data for save
             $this->_saveAttributeValue($object, $attribute, $value);
             // save collected data every 1000 rows
         }
         //update
         $this->__updateProductValues($entityId, $data['statics']);
         //update inventory
         if (count($data['inventories']) > 0) {
             $stockItem = Mage::getSingleton('cataloginventory/stock_item');
             $stockItem->setData(array());
             $stockItem->loadByProduct($entityId)->setProductId($entityId);
             $stockDataChanged = false;
             foreach ($data['inventories'] as $k => $v) {
                 $stockItem->setDataUsingMethod($k, $v);
                 if ($stockItem->dataHasChangedFor($k)) {
                     $stockDataChanged = true;
                 }
             }
             if ($stockDataChanged) {
                 $stockItem->save();
             }
         }
         $this->_processAttributeValues();
         $this->_getWriteAdapter()->commit();
     } catch (Exception $e) {
         $this->_getWriteAdapter()->rollBack();
         throw $e;
     }
 }
开发者ID:hyhoocchan,项目名称:extension,代码行数:56,代码来源:Action.php

示例15: getCollection

 public function getCollection($storeId)
 {
     $pages = parent::getCollection($storeId);
     $select = Mage::getModel('amlanding/page')->getCollection()->addFieldToFilter('is_active', 1)->getSelect()->join(array('amlanding_page_store' => $this->getTable('amlanding/page_store')), 'main_table.page_id = amlanding_page_store.page_id', array())->where('amlanding_page_store.store_id IN (?)', array($storeId));
     $query = $this->_getWriteAdapter()->query($select);
     $urlSuffix = Mage::helper('catalog/category')->getCategoryUrlSuffix($storeId);
     $urlSuffix = $urlSuffix ? $urlSuffix : '';
     while ($row = $query->fetch()) {
         $object = new Varien_Object();
         $object->setId($row['page_id']);
         $object->setUrl($row['identifier'] . $urlSuffix);
         $object->setTitle($row['title']);
         $pages[] = $object;
     }
     return $pages;
 }
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:16,代码来源:Page.php


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