當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。