• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mage_Catalog_Block_Product_Abstract类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: applyProductView

 /**
  * Product view block, don't cache if rendered with cart item update
  *
  * @param Mage_Catalog_Block_Product_View $block
  */
 public function applyProductView(Mage_Catalog_Block_Product_Abstract $block)
 {
     // The "messages" block is session-dependent, don't cache
     if (Mage::helper('cache')->responseHasMessages()) {
         $block->setData('cache_lifetime', null);
         return;
     }
     // Cart stuff is session-dependent
     $request = $block->getRequest();
     if ($request->getModuleName() == 'checkout' && $request->getControllerName() == 'cart' && $request->getActionName() == 'configure' && $request->getParam('id')) {
         $block->setData('cache_lifetime', null);
         return;
     }
     // Set cache keys
     $keys = $block->getCacheKeys();
     $customer = Mage::getSingleton('customer/session')->getCustomer();
     $keys = array_merge($keys, array($customer->getGroupId()));
     $product = $block->getProduct();
     if ($product) {
         $tags = array(Mage_Catalog_Model_Product::CACHE_TAG . '_' . $block->getProduct()->getId());
         $taxCalculator = Mage::getModel('tax/calculation');
         $product = $block->getProduct();
         $keys = array_merge($keys, array($product->getId(), $taxCalculator->getRate($taxCalculator->getRateRequest()->setProductClassId($product->getTaxClassId()))));
     } else {
         $tags = array(Mage_Catalog_Model_Product::CACHE_TAG);
     }
     $block->setData('cache_tags', $tags);
     $block->setData('cache_keys', $keys);
 }
开发者ID:eneiasramos,项目名称:Made_Cache,代码行数:34,代码来源:Catalog.php


示例2: _prepareLayout

 protected function _prepareLayout()
 {
     if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
         $product = $this->getProduct();
         $sess = Mage::getSingleton('udropship/session');
         $searchUrlKey = $sess->getData('udsell_search_type') ? 'mysellSearch' : 'sellSearch';
         if ($sess->getData('udsell_search_type')) {
             $breadcrumbsBlock->addCrumb('sellyours', array('label' => Mage::helper('catalog')->__('My Sell List'), 'title' => Mage::helper('catalog')->__('My Sell List'), 'link' => $this->getUrl('udsell/index/mysellSearch')));
         } else {
             $breadcrumbsBlock->addCrumb('sellyours', array('label' => Mage::helper('catalog')->__('Sell Yours'), 'title' => Mage::helper('catalog')->__('Sell Yours'), 'link' => $this->getUrl('udsell/index/sellSearch')));
         }
         if (Mage::registry('current_category')) {
             $cat = Mage::registry('current_category');
             $pathIds = explode(',', $cat->getPathInStore());
             array_shift($pathIds);
             $cats = Mage::helper('udropship/catalog')->getCategoriesCollection($pathIds);
             foreach ($cats as $c) {
                 $breadcrumbsBlock->addCrumb('sellyours_cat' . $c->getId(), array('label' => $c->getName(), 'title' => $c->getName(), 'link' => $this->getUrl('udsell/index/' . $searchUrlKey, array('_current' => true, 'c' => $c->getId()))));
             }
             $breadcrumbsBlock->addCrumb('sellyours_cat' . $cat->getId(), array('label' => $cat->getName(), 'title' => $cat->getName(), 'link' => $this->getUrl('udsell/index/' . $searchUrlKey, array('_current' => true, 'c' => $cat->getId()))));
         }
         $breadcrumbsBlock->addCrumb('sellyours_query', array('label' => htmlspecialchars($product->getName()), 'title' => htmlspecialchars($product->getName()), 'link' => $this->getUrl('*/*/*', array('_current' => true))));
     }
     return Mage_Catalog_Block_Product_Abstract::_prepareLayout();
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:25,代码来源:ProductView.php


示例3: _prepareLayout

 /**
  * Add meta information from product to head block
  *
  * @return Mage_Catalog_Block_Product_View
  */
 protected function _prepareLayout()
 {
     $this->getLayout()->createBlock('catalog/breadcrumbs');
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $product = $this->getProduct();
         $title = $product->getMetaTitle();
         if ($title) {
             $headBlock->setTitle($title);
         }
         $keyword = $product->getMetaKeyword();
         $currentCategory = Mage::registry('current_category');
         if ($keyword) {
             $headBlock->setKeywords($keyword);
         } elseif ($currentCategory) {
             $headBlock->setKeywords($product->getName());
         }
         $description = $product->getMetaDescription();
         if ($description) {
             $headBlock->setDescription($description);
         } else {
             $headBlock->setDescription(Mage::helper('core/string')->substr($product->getDescription(), 0, 255));
         }
     }
     return Mage_Catalog_Block_Product_Abstract::_prepareLayout();
 }
开发者ID:purpleweb,项目名称:ImprovedLayeredNavigationFix,代码行数:31,代码来源:View.php


示例4: _toHtml

 protected function _toHtml()
 {
     $html = "\n<!-- MSEMANTIC 1.2.6.5 begin -->";
     $html .= "\n";
     $id = Mage::registry('current_product')->getId();
     $product = Mage::getModel('catalog/product')->load($id);
     if ($product->getTypeId() == "grouped") {
         $html .= "<!-- Magento grouped products are not supported by MSemantic at the moment.-->";
     } else {
         @(include_once "../../EssentiaLib/includeAll.php");
         $this->initData();
         if ($this->settings['basicsettings']['active']) {
             $html .= parent::_toHtml();
             $this->rdff->useRdfNamespaces("rdf,rdfs,xsd,dc,owl,vcard,gr,product,v,foaf,media");
             $html .= $this->rdff->startRdfa($this->Business->getLegalName());
             $this->GR->setBusiness($this->Business)->setProduct($this->Product);
             $html .= $this->GR->pOffering();
             $html .= $this->rdff->endRdfa();
             //@webdirx_div::debug(htmlentities($html));
         }
     }
     $html .= "\n";
     $html .= "<!-- MSEMANTIC end. http://www.msemantic.com -->\n";
     return $html;
 }
开发者ID:FranchuCorraliza,项目名称:magento,代码行数:25,代码来源:Product.php


示例5: _beforeToHtml

 protected function _beforeToHtml()
 {
     $todayDate = AO::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     $collection = $this->_addProductAttributesAndPrices(AO::getResourceModel('catalog/product_collection'))->addStoreFilter()->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate))->addAttributeToFilter('news_to_date', array('or' => array(0 => array('date' => true, 'from' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToSort('news_from_date', 'desc')->setPageSize($this->getProductsCount())->setCurPage(1);
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Product_New.php


示例6: __construct

 public function __construct()
 {
     $this->configP = Mage::getStoreConfig('dailydeal/general');
     parent::__construct();
     $maxday = 350;
     $from = (int) @$_GET['from'];
     $to = (int) @$_GET['to'];
     $to = $to == $maxday ? 0 : $to;
     $datefrom = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') + $from, date('y')));
     $dateto = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') + $to, date('y')));
     $todayDate = date('Y-m-d H:i:s');
     //echo $todayDate;
     // $todayDate = '2014-01-11 11:24:39 ';
     // $dateFrom = Mage::app()->getLocale()->date($todayDate, Varien_Date::DATETIME_INTERNAL_FORMAT);
     // echo Mage::getModel('core/date')->gmtDate(null, time());
     //echo Mage::getModel('core/date')->gmtDate();
     //echo Mage::getModel('core/date')->gmtDate(null, time());
     // echo $dateFrom = Mage::app()->getLocale()->date(date('Y-m-d H:i:s'), Varien_Date::DATETIME_INTERNAL_FORMAT);
     $tomorrow = mktime(0, 0, 0, date('m'), date('d') + 1, date('y'));
     $tomorrowDate = date('m/d/y', $tomorrow);
     $collection = Mage::getResourceModel('catalogsearch/advanced_collection')->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addMinimalPrice()->addStoreFilter();
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     $collection->getSelect()->join(array('t2' => Mage::getSingleton('core/resource')->getTableName('dailydeal/dailydealproducts')), '(e.entity_id = t2.productid and t2.status != 2 ' . ($from ? ' and t2.closetime >= "' . $datefrom . '"' : ' and t2.starttime <= "' . $todayDate . '"') . ($to ? ' and t2.closetime <= "' . $dateto . '"' : '') . ' and t2.closetime >= "' . $todayDate . '")', array('t2.sold', 't2.save', 't2.quantity', 't2.starttime', 't2.closetime'));
     // Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     // $collection->getSelect()->join(array('t2' => Mage::getSingleton('core/resource')->getTableName('dailydeal/dailydealproducts')),'e.entity_id = t2.productid ', array('t2.sold', 't2.save', 't2.quantity', 't2.starttime', 't2.closetime'));
     //$collection->getSelect()->group('e.entity_id');
     // echo count($collection);
     //$collection->setPageSize($this->get_prod_count())->setCurPage($this->get_cur_page());
     $this->setCollection($collection);
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:30,代码来源:Dailydeal.php


示例7: getGroupIdentifier

 public function getGroupIdentifier()
 {
     if (parent::getGroupIdentifier()) {
         return parent::getGroupIdentifier();
     }
     return 'default';
 }
开发者ID:AlexanderParker,项目名称:Doghouse_Carousel,代码行数:7,代码来源:Carousel.php


示例8: __construct

 public function __construct($attributes = array())
 {
     $helper = Mage::helper('ves_verticalmenu/data');
     $this->_config = $helper->get($attributes);
     /* End init meida files */
     parent::__construct();
 }
开发者ID:quanghuynt93,项目名称:VesSmartshop,代码行数:7,代码来源:List.php


示例9: _toHtml

 protected function _toHtml()
 {
     if (!(bool) Mage::getStoreConfig('newproducts/general/active')) {
         return '';
     }
     return parent::_toHtml();
 }
开发者ID:sivaanil,项目名称:paytech,代码行数:7,代码来源:Newproductslist.php


示例10: _prepareLayout

 protected function _prepareLayout()
 {
     $title = $this->getHeaderText();
     $this->getLayout()->getBlock('head')->setTitle($title);
     $this->getLayout()->getBlock('root')->setHeaderTitle($title);
     return parent::_prepareLayout();
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:7,代码来源:Result.php


示例11: _beforeToHtml

 protected function _beforeToHtml()
 {
     if ($this->getTemplate() == 'dgt/widget/default.phtml') {
         switch ($this->getData('widget_type')) {
             case 'product':
                 switch ($this->getData('mode')) {
                     case 'related':
                         $this->setTemplate('dgt/widget/related.phtml');
                         break;
                     default:
                         $this->setTemplate('dgt/widget/product.phtml');
                         break;
                 }
                 switch ($this->getData('widget_tab')) {
                     case 'categories':
                     case 'collections':
                         $this->setTemplate('dgt/widget/tab.phtml');
                         break;
                 }
                 break;
             case 'attribute':
                 $this->setTemplate('dgt/widget/attribute.phtml');
                 break;
             case 'block':
                 $this->setTemplate('dgt/widget/block.phtml');
                 break;
             case 'category':
                 $this->setTemplate('dgt/widget/category.phtml');
                 break;
         }
     }
     return parent::_beforeToHtml();
 }
开发者ID:dragontheme1235,项目名称:project-1,代码行数:33,代码来源:Widget.php


示例12: _prepareLayout

 /**
  * Preparing layout
  *
  * @return Mage_Catalog_Block_Product_Compare_List
  */
 protected function _prepareLayout()
 {
     if ($headBlock = $this->getLayout()->getBlock('head')) {
         $headBlock->setTitle(AO::helper('catalog')->__('Compare Products List') . ' - ' . $headBlock->getDefaultTitle());
     }
     return parent::_prepareLayout();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:12,代码来源:Product_Compare_List.php


示例13: _prepareLayout

 /**
  * Add meta information from product to head block
  *
  * @return Mage_Catalog_Block_Product_View
  */
 protected function _prepareLayout()
 {
     $this->getLayout()->createBlock('catalog/breadcrumbs');
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $product = $this->getProduct();
         $title = $product->getMetaTitle();
         if ($title) {
             $headBlock->setTitle($title);
         }
         $keyword = $product->getMetaKeyword();
         $currentCategory = Mage::registry('current_category');
         if ($keyword) {
             $headBlock->setKeywords($keyword);
         } elseif ($currentCategory) {
             $headBlock->setKeywords($product->getName());
         }
         $description = $product->getMetaDescription();
         if ($description) {
             $headBlock->setDescription($description);
         } else {
             $headBlock->setDescription(Mage::helper('core/string')->substr($product->getDescription(), 0, 255));
         }
         if ($this->helper('catalog/product')->canUseCanonicalTag()) {
             $params = array('_ignore_category' => true);
             $headBlock->addLinkRel('canonical', $product->getUrlModel()->getUrl($product, $params));
         }
     }
     return parent::_prepareLayout();
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:35,代码来源:View.php


示例14: _prepareLayout

 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $toolbar = $this->getToolbarBlock();
     $collection = $this->getCollection();
     if ($orders = $this->getAvailableOrders()) {
         $toolbar->setAvailableOrders($orders);
     }
     if ($sort = $this->getSortBy()) {
         $toolbar->setDefaultOrder($sort);
     }
     if ($dir = $this->getDefaultDirection()) {
         $toolbar->setDefaultDirection($dir);
     }
     $toolbar->setCollection($collection);
     $this->setChild('toolbar', $toolbar);
     $this->getCollection()->load();
     $partner = $this->getProfileDetail();
     if ($partner->getShoptitle() != '') {
         $this->getLayout()->getBlock('head')->setTitle($partner->getShoptitle());
     } else {
         $this->getLayout()->getBlock('head')->setTitle($partner->getProfileurl());
     }
     $this->getLayout()->getBlock('head')->setKeywords($partner->getMetaKeyword());
     $this->getLayout()->getBlock('head')->setDescription($partner->getMetaDescription());
     return $this;
 }
开发者ID:axovel,项目名称:exqzt,代码行数:27,代码来源:Collection.php


示例15: _toHtml

 protected function _toHtml()
 {
     if (!$this->helper('featuredproducts')->getIsActive()) {
         return '';
     }
     return parent::_toHtml();
 }
开发者ID:enjoy2000,项目名称:gemz,代码行数:7,代码来源:Block.php


示例16: __construct

 public function __construct()
 {
     parent::__construct();
     $productSize = 5;
     //  No Of Products Display in Frontend
     $storeId = Mage::app()->getStore()->getId();
     $sql = "SELECT f.product_id, f.qty_ordered  FROM sales_flat_order_item as f, sales_order as s WHERE s.entity_id = f.order_id and s.store_id = {$storeId} and f.parent_item_id is NULL";
     $data = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($sql);
     $output = array();
     foreach ($data as $d) {
         if (isset($output[$d['product_id']])) {
             $output[$d['product_id']] += $d['qty_ordered'];
         } else {
             $output[$d['product_id']] = $d['qty_ordered'];
         }
     }
     arsort($output);
     $final = array_slice(array_keys($output), 0, $productSize);
     $products = Mage::getModel('catalog/product')->getCollection();
     $products->addAttributeToSelect('*');
     $products->addAttributeToFilter('entity_id', array('in' => $final));
     $products->load();
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
     $this->setProductCollection($products);
 }
开发者ID:nkhine,项目名称:smashing,代码行数:26,代码来源:Bestsellers.php


示例17: __construct

 public function __construct($attributes = array())
 {
     $helper = Mage::helper('ves_megamenu/data');
     $this->_config = $helper->get($attributes);
     if ($attributes) {
         $this->convertAttributesToConfig($attributes);
     }
     /* End init meida files */
     parent::__construct();
     if ($this->hasData("template") && $this->getData("template")) {
         $this->setTemplate($this->getData("template"));
     } else {
         $this->setTemplate('ves/megamenu/default.phtml');
     }
     /*Cache Block*/
     $enable_cache = $this->getConfig("enable_cache", 1);
     if (!$enable_cache) {
         $cache_lifetime = null;
     } else {
         $cache_lifetime = $this->getConfig("cache_lifetime", 86400);
         $cache_lifetime = (int) $cache_lifetime > 0 ? $cache_lifetime : 86400;
     }
     $this->addData(array('cache_lifetime' => $cache_lifetime));
     $this->addCacheTag(array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG, Ves_Megamenu_Model_Megamenu::CACHE_BLOCK_TAG));
     /*End Cache Block*/
 }
开发者ID:booklein,项目名称:bookle,代码行数:26,代码来源:List.php


示例18: _toHtml

 /**
  * Render product info as hidden meta data if the module is enabled for the
  * current store.
  * If it is a "bundle" product with fixed price type, then do not render.
  * These are not supported due to their child products not having prices
  * available.
  *
  * @return string
  */
 protected function _toHtml()
 {
     if (!Mage::helper('nosto_tagging')->isModuleEnabled() || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()) {
         return '';
     }
     return parent::_toHtml();
 }
开发者ID:nosto,项目名称:nosto-magento-nodeps,代码行数:16,代码来源:Product.php


示例19: __construct

 public function __construct()
 {
     parent::__construct();
     //        $this->setTemplate('reports/product_viewed.phtml');
     $ignore = null;
     if (($product = Mage::registry('product')) && $product->getId()) {
         $ignore = $product->getId();
     }
     $customer = Mage::getSingleton('customer/session')->getCustomer();
     if ($customer->getId()) {
         $subjectId = $customer->getId();
         $subtype = 0;
     } else {
         $subjectId = Mage::getSingleton('log/visitor')->getId();
         $subtype = 1;
     }
     $collection = Mage::getModel('reports/event')->getCollection()->addRecentlyFiler(1, $subjectId, $subtype, $ignore);
     $productIds = array();
     foreach ($collection as $event) {
         $productIds[] = $event->getObjectId();
     }
     unset($collection);
     $productCollection = null;
     if ($productIds) {
         $productCollection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('name')->addAttributeToSelect('price')->addAttributeToSelect('small_image')->addIdFilter($productIds);
         Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($productCollection);
         Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($productCollection);
         $productCollection->setPageSize(5)->setCurPage(1)->load();
     }
     $this->setRecentlyViewedProducts($productCollection);
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:31,代码来源:Viewed.php


示例20: _construct

 /**
  * _construct
  */
 public function _construct()
 {
     parent::_construct();
     $this->addPriceBlockType('simple', 'catalog/product_price', 'merchandiser/new/category/price.phtml');
     $this->addPriceBlockType('grouped', 'catalog/product_price', 'merchandiser/new/category/price-grouped.phtml');
     $this->addPriceBlockType('configurable', 'catalog/product_price', 'merchandiser/new/category/price-configurable.phtml');
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:10,代码来源:List.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mage_Catalog_Block_Product_List类代码示例发布时间:2022-05-23
下一篇:
PHP Mage_Catalog_Block_Layer_Filter_Abstract类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap