コード例 #1
0
ファイル: Product.php プロジェクト: sergeykalenyuk/Tadic_AVP
 /**
  * Normally this methods check to see whether the product is configured
  * to be visible on the frontend.  We're overloading that so that
  * the product will actually show up as long as the url hash key
  * is correct.
  *
  * @param int|Mage_Catalog_Model_Product $product
  * @param string $where
  * @return bool
  */
 public function canShow($product, $where = 'catalog')
 {
     if ($this->_validateUrlHash()) {
         return true;
     }
     return parent::canShow($product, $where);
 }
コード例 #2
0
ファイル: ProductTest.php プロジェクト: nemphys/magento2
 /**
  * @magentoDataFixture Mage/Catalog/_files/products.php
  */
 public function testCanShow()
 {
     // non-visible or disabled
     $product = new Mage_Catalog_Model_Product();
     $this->assertFalse($this->_helper->canShow($product));
     // enabled and visible
     $product->setId(1);
     $product->setStatus(Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
     $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
     $this->assertTrue($this->_helper->canShow($product));
     $this->assertTrue($this->_helper->canShow(1));
 }
コード例 #3
0
ファイル: Product.php プロジェクト: rcclaudrey/dev
 function canShow($product, $where = 'catalog')
 {
     $isVisible = parent::canShow($product, $where);
     if (!$isVisible && Mage::app()->getRequest()->getParam('pid') > 0) {
         $product = Mage::getModel('catalog/product')->load(Mage::app()->getRequest()->getParam('pid'));
         foreach ($product->getTypeInstance(true)->getUsedProducts(null, $product) as $childProduct) {
             $childIds[] = $childProduct->getId();
         }
         if (in_array(Mage::app()->getRequest()->getParam('id'), $childIds)) {
             $isVisible = true;
         }
     }
     return $isVisible;
 }