本文整理汇总了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类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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);
}
示例7: getGroupIdentifier
public function getGroupIdentifier()
{
if (parent::getGroupIdentifier()) {
return parent::getGroupIdentifier();
}
return 'default';
}
示例8: __construct
public function __construct($attributes = array())
{
$helper = Mage::helper('ves_verticalmenu/data');
$this->_config = $helper->get($attributes);
/* End init meida files */
parent::__construct();
}
示例9: _toHtml
protected function _toHtml()
{
if (!(bool) Mage::getStoreConfig('newproducts/general/active')) {
return '';
}
return parent::_toHtml();
}
示例10: _prepareLayout
protected function _prepareLayout()
{
$title = $this->getHeaderText();
$this->getLayout()->getBlock('head')->setTitle($title);
$this->getLayout()->getBlock('root')->setHeaderTitle($title);
return parent::_prepareLayout();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例15: _toHtml
protected function _toHtml()
{
if (!$this->helper('featuredproducts')->getIsActive()) {
return '';
}
return parent::_toHtml();
}