本文整理汇总了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);
}
示例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);
}
示例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');
}
示例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();
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例9: testGetCacheIdTags
public function testGetCacheIdTags()
{
$this->assertFalse($this->_model->getCacheIdTags());
$this->_model->load(1);
// fixture
$this->assertEquals(array('catalog_product_1'), $this->_model->getCacheIdTags());
}
示例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');
}
示例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();
}
示例12: _getProductImageFile
protected function _getProductImageFile()
{
$product = new Mage_Catalog_Model_Product();
$product->load(1);
$images = $product->getMediaGalleryImages()->getItems();
$image = reset($images);
return $image['file'];
}
示例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);
}
示例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));
}
示例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());
}