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


PHP Mage_Catalog_Model_Product::load方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     $this->_product = Mage::getModel('Mage_Catalog_Model_Product');
     $this->_product->load(1);
     $this->_block = Mage::app()->getLayout()->createBlock('Mage_Catalog_Block_Product_View_Type_Configurable');
     $this->_block->setProduct($this->_product);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:7,代码来源:ConfigurableTest.php

示例2: setUp

 protected function setUp()
 {
     $this->_block = new Mage_Catalog_Block_Product_AbstractTestAbstract();
     $this->_product = new Mage_Catalog_Model_Product();
     $this->_product->load(1);
     $this->_product->addData(array('image' => '/m/a/magento_image.jpg', 'small_image' => '/m/a/magento_image.jpg', 'thumbnail' => '/m/a/magento_image.jpg'));
     $this->_block->setProduct($this->_product);
 }
开发者ID:relue,项目名称:magento2,代码行数:8,代码来源:AbstractTest.php

示例3: setUp

 protected function setUp()
 {
     $this->_product = Mage::getModel('Mage_Catalog_Model_Product');
     $this->_product->load(1);
     Mage::unregister('current_product');
     Mage::register('current_product', $this->_product);
     $this->_block = Mage::app()->getLayout()->createBlock('Mage_Catalog_Block_Product_View_Options');
 }
开发者ID:natxetee,项目名称:magento2,代码行数:8,代码来源:OptionsTest.php

示例4: setUp

 protected function setUp()
 {
     $this->_product = new Mage_Catalog_Model_Product();
     $this->_product->load(1);
     Mage::unregister('current_product');
     Mage::register('current_product', $this->_product);
     $this->_block = new Mage_Catalog_Block_Product_View_Options();
 }
开发者ID:nemphys,项目名称:magento2,代码行数:8,代码来源:OptionsTest.php

示例5: setUp

 protected function setUp()
 {
     $this->_block = Mage::getObjectManager()->create('Mage_Catalog_Block_Product_View');
     $this->_product = Mage::getModel('Mage_Catalog_Model_Product');
     $this->_product->load(1);
     Mage::unregister('product');
     Mage::register('product', $this->_product);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:8,代码来源:ViewTest.php

示例6: setUp

 protected function setUp()
 {
     $this->_product = new Mage_Catalog_Model_Product();
     $this->_product->load(1);
     // fixture
     $this->_model = new Mage_Catalog_Model_Product_Type_Configurable();
     // prevent fatal errors by assigning proper "singleton" of type instance to the product
     $this->_product->setTypeInstance($this->_model);
 }
开发者ID:relue,项目名称:magento2,代码行数:9,代码来源:ConfigurableTest.php

示例7: testDataHelperGetters

 /**
  * @test
  * @loadExpectation testDataHelperGetters
  * @loadFixture testDataHelperGetters
  */
 public function testDataHelperGetters()
 {
     $product = $this->model->load(1);
     $expected = $this->expected('product');
     $this->assertEquals($expected['video_width'], $this->helper->getVideoWidth($product));
     $this->assertEquals($expected['video_height'], $this->helper->getVideoHeight($product));
     $this->assertEquals($expected['youtube_url_code'], $this->helper->getEmbedUrl($product));
     $this->assertEquals($expected['schema_duration'], $this->helper->getVideoDuration($product));
     $this->assertEquals($expected['schema_name'], $product->getSchemaName());
     $this->assertEquals($expected['schema_description'], $product->getSchemaDescription());
 }
开发者ID:TomFoyster,项目名称:magento-simple-videos,代码行数:16,代码来源:Data.php

示例8: setUp

 protected function setUp()
 {
     if (!self::$_isStubClass) {
         $this->getMockForAbstractClass('Mage_Catalog_Block_Product_Abstract', array(), self::STUB_CLASS, false);
         self::$_isStubClass = true;
     }
     $this->_block = Mage::app()->getLayout()->createBlock(self::STUB_CLASS);
     $this->_product = Mage::getModel('Mage_Catalog_Model_Product');
     $this->_product->load(1);
     $this->_product->addData(array('image' => '/m/a/magento_image.jpg', 'small_image' => '/m/a/magento_image.jpg', 'thumbnail' => '/m/a/magento_image.jpg'));
     $this->_block->setProduct($this->_product);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:12,代码来源:AbstractTest.php

示例9: testGetCacheIdTags

 public function testGetCacheIdTags()
 {
     $this->assertFalse($this->_model->getCacheIdTags());
     $this->_model->load(1);
     // fixture
     $this->assertEquals(array('catalog_product_1'), $this->_model->getCacheIdTags());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:7,代码来源:ProductGetters.php

示例10: addAction

 public function addAction()
 {
     if ($this->getRequest()->isGet()) {
         $gift_id = $this->getRequest()->getParam('gift', 0);
         if ($gift_id) {
             if (!Mage::helper('gifts')->isGiftUsed() && in_array($gift_id, Mage::helper('gifts')->getGiftsIds())) {
                 $quote = Mage::getSingleton('checkout/session')->getQuote();
                 $cart = Mage::getModel('checkout/cart');
                 $product = new Mage_Catalog_Model_Product();
                 $product->load($gift_id);
                 $cart->addProduct($product, 1);
                 $cart->save();
                 foreach ($quote->getAllItems() as $item) {
                     if ($item->getProductId() == $gift_id) {
                         $item->setCustomPrice(0);
                         $item->setOriginalCustomPrice(0);
                     }
                 }
                 $cart->init();
                 $cart->save();
                 Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
             }
         }
     }
     $this->_redirect('checkout/cart');
 }
开发者ID:ankitsapient,项目名称:testgithubankit,代码行数:26,代码来源:IndexController.php

示例11: productMediaFixture

 public static function productMediaFixture()
 {
     $product = new Mage_Catalog_Model_Product();
     $product->load(1);
     $product->setTierPrice(array());
     $product->setData('media_gallery', array('images' => array(array('file' => '/m/a/magento_image.jpg'))));
     $product->save();
 }
开发者ID:nemphys,项目名称:magento2,代码行数:8,代码来源:ApiTest.php

示例12: _getProductImageFile

 protected function _getProductImageFile()
 {
     $product = new Mage_Catalog_Model_Product();
     $product->load(1);
     $images = $product->getMediaGalleryImages()->getItems();
     $image = reset($images);
     return $image['file'];
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:8,代码来源:ProductController.php

示例13: setUp

 protected function setUp()
 {
     $this->_block = new Mage_Checkout_Block_Cart_Item_Renderer();
     $item = new Mage_Sales_Model_Quote_Item();
     $product = new Mage_Catalog_Model_Product();
     $product->load(1);
     $item->setProduct($product);
     $this->_block->setItem($item);
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:9,代码来源:Renderer.php

示例14: testGetUrl

 public function testGetUrl()
 {
     $product = new Mage_Catalog_Model_Product();
     $product->load(1);
     $this->assertStringEndsWith('simple-product.html', $this->_model->getUrl($product));
     $product = new Mage_Catalog_Model_Product();
     $product->setId(100);
     $this->assertStringEndsWith('catalog/product/view/id/100/', $this->_model->getUrl($product));
 }
开发者ID:relue,项目名称:magento2,代码行数:9,代码来源:UrlTest.php

示例15: testGenerateUniqueSkuExistingProduct

 /**
  * @magentoDataFixture Mage/Catalog/_files/product_simple.php
  */
 public function testGenerateUniqueSkuExistingProduct()
 {
     $product = new Mage_Catalog_Model_Product();
     $product->load(1);
     $product->setId(null);
     $this->assertEquals('simple', $product->getSku());
     $product->getResource()->getAttribute('sku')->getBackend()->beforeSave($product);
     $this->assertEquals('simple-1', $product->getSku());
 }
开发者ID:nayanchamp,项目名称:magento2,代码行数:12,代码来源:SkuTest.php


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