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


PHP Mage_Catalog_Model_Product::setOrigData方法代码示例

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


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

示例1: testReset

 public function testReset()
 {
     $model = $this->_model;
     $testCase = $this;
     $assertEmpty = function () use($model, $testCase) {
         $testCase->assertEquals(array(), $model->getData());
         $testCase->assertEquals(null, $model->getOrigData());
         $testCase->assertEquals(array(), $model->getCustomOptions());
         // impossible to test $_optionInstance
         $testCase->assertEquals(array(), $model->getOptions());
         $testCase->assertFalse($model->canAffectOptions());
         // impossible to test $_errors
     };
     $assertEmpty();
     $this->_model->setData('key', 'value');
     $this->_model->reset();
     $assertEmpty();
     $this->_model->setOrigData('key', 'value');
     $this->_model->reset();
     $assertEmpty();
     $this->_model->addCustomOption('key', 'value');
     $this->_model->reset();
     $assertEmpty();
     $this->_model->addOption(new Mage_Catalog_Model_Product_Option());
     $this->_model->reset();
     $assertEmpty();
     $this->_model->canAffectOptions(true);
     $this->_model->reset();
     $assertEmpty();
 }
开发者ID:relue,项目名称:magento2,代码行数:30,代码来源:ProductTest.php

示例2: testAfterSave

 /**
  * @magentoConfigFixture current_store catalog/price/scope 1
  * @magentoConfigFixture current_store currency/options/base GBP
  */
 public function testAfterSave()
 {
     $product = new Mage_Catalog_Model_Product();
     $product->load(1);
     $product->setOrigData();
     $product->setPrice(9.99);
     $product->setStoreId(0);
     $this->_model->setScope($this->_model->getAttribute());
     $this->_model->afterSave($product);
     $this->assertEquals('9.99', $product->getResource()->getAttributeRawValue($product->getId(), $this->_model->getAttribute()->getId(), Mage::app()->getStore()->getId()));
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:15,代码来源:Price.php

示例3: testCalaogProductSaveAfter

 /**
  * @test
  */
 public function testCalaogProductSaveAfter()
 {
     $this->_fpc->save('product1', 'product1_cache_id', array(sha1('product_1')));
     $this->_fpc->save('category1', 'category1_cache_id', array(sha1('category_1')));
     $this->_fpc->save('category2', 'category2_cache_id', array(sha1('category_2')));
     $product = new Mage_Catalog_Model_Product();
     $product->setOrigData(array());
     $product->setCategoryIds(array(1));
     $product->setId(1);
     Mage::dispatchEvent('catalog_product_save_after', array('product' => $product));
     $this->assertFalse($this->_fpc->load('product1_cache_id'));
     $this->assertFalse($this->_fpc->load('category1_cache_id'));
     $this->assertEquals('category2', $this->_fpc->load('category2_cache_id'));
 }
开发者ID:AndreKlang,项目名称:Lesti_Fpc,代码行数:17,代码来源:Save.php

示例4: testReset

 public function testReset()
 {
     $model = $this->_model;
     $this->_assertEmpty($model);
     $this->_model->setData('key', 'value');
     $this->_model->reset();
     $this->_assertEmpty($model);
     $this->_model->setOrigData('key', 'value');
     $this->_model->reset();
     $this->_assertEmpty($model);
     $this->_model->addCustomOption('key', 'value');
     $this->_model->reset();
     $this->_assertEmpty($model);
     $this->_model->addOption(new Mage_Catalog_Model_Product_Option());
     $this->_model->reset();
     $this->_assertEmpty($model);
     $this->_model->canAffectOptions(true);
     $this->_model->reset();
     $this->_assertEmpty($model);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:20,代码来源:ProductTest.php

示例5: afterLoad

 /**
  * Assign group prices to product data
  *
  * @param Mage_Catalog_Model_Product $object
  * @return Mage_Catalog_Model_Product_Attribute_Backend_Groupprice_Abstract
  */
 public function afterLoad($object)
 {
     $storeId = $object->getStoreId();
     $websiteId = null;
     if ($this->getAttribute()->isScopeGlobal()) {
         $websiteId = 0;
     } else {
         if ($storeId) {
             $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
         }
     }
     $data = $this->_getResource()->loadGroupData($object->getId(), $websiteId);
     foreach ($data as $k => $v) {
         //$data[$k]['website_price'] = $v['price'];
         if ($v['all_groups']) {
             $data[$k]['cust_group'] = Mage_Customer_Model_Group::CUST_GROUP_ALL;
         }
     }
     $object->setData($this->getAttribute()->getName(), $data);
     $object->setOrigData($this->getAttribute()->getName(), $data);
     $valueChangedKey = $this->getAttribute()->getName() . '_changed';
     $object->setOrigData($valueChangedKey, 0);
     $object->setData($valueChangedKey, 0);
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:31,代码来源:Abstract.php

示例6: testAfterSaveEmpty

 /**
  * @depends testAfterSave
  */
 public function testAfterSaveEmpty()
 {
     Mage::app()->setCurrentStore(Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID));
     $product = new Mage_Catalog_Model_Product();
     $product->load(1);
     $product->setOrigData();
     $product->setTierPrice(array());
     $this->_model->afterSave($product);
     $product = new Mage_Catalog_Model_Product();
     $product->setId(1);
     $this->_model->afterLoad($product);
     $this->assertEmpty($product->getTierPrice());
 }
开发者ID:relue,项目名称:magento2,代码行数:16,代码来源:TierpriceTest.php

示例7: afterLoad

 /**
  * Assign tier prices to product data
  *
  * @param Mage_Catalog_Model_Product $object
  * @return Mage_Catalog_Model_Product_Attribute_Backend_Tierprice
  */
 public function afterLoad($object)
 {
     $storeId = $object->getStoreId();
     $websiteId = null;
     if ($this->getAttribute()->isScopeGlobal()) {
         $websiteId = 0;
     } else {
         if ($storeId) {
             $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
         }
     }
     $data = $this->_getResource()->loadPriceData($object->getId(), $websiteId);
     foreach ($data as $k => $v) {
         $data[$k]['website_price'] = $v['price'];
         if ($v['all_groups']) {
             $data[$k]['cust_group'] = Mage_Customer_Model_Group::CUST_GROUP_ALL;
         }
     }
     if (!$object->getData('_edit_mode') && $websiteId) {
         $rates = $this->_getWebsiteRates();
         $full = $data;
         $data = array();
         foreach ($full as $v) {
             $key = join('-', array($v['cust_group'], $v['price_qty']));
             if ($v['website_id'] == $websiteId) {
                 $data[$key] = $v;
                 $data[$key]['website_price'] = $v['price'];
             } else {
                 if ($v['website_id'] == 0 && !isset($data[$key])) {
                     $data[$key] = $v;
                     $data[$key]['website_id'] = $websiteId;
                     if ($object->getPriceModel()->isTierPriceFixed()) {
                         $data[$key]['price'] = $v['price'] * $rates[$websiteId]['rate'];
                         $data[$key]['website_price'] = $v['price'] * $rates[$websiteId]['rate'];
                     }
                 }
             }
         }
     }
     $object->setData($this->getAttribute()->getName(), $data);
     $object->setOrigData($this->getAttribute()->getName(), $data);
     $valueChangedKey = $this->getAttribute()->getName() . '_changed';
     $object->setOrigData($valueChangedKey, 0);
     $object->setData($valueChangedKey, 0);
     return $this;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:52,代码来源:Tierprice.php

示例8: setOrigData

 /**
  * Set original loaded data if needed
  *
  * @param string $key
  * @param mixed $data
  * @return Varien_Object
  */
 public function setOrigData($key = null, $data = null)
 {
     if (Mage::app()->getStore()->isAdmin()) {
         return parent::setOrigData($key, $data);
     }
     return $this;
 }
开发者ID:WesleyDevLab,项目名称:magento-app-v2,代码行数:14,代码来源:Product.php


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