首先,我想说,我是完全新的Magento如此回答,请不要认为Magento的任何知识 - 不过,我会非常感激的人谁可以点我在正确的方向。Magento的新产品小部件
我们遇到的问题是放置在主页上的新产品小部件 - 我没有安装它,我没有设置Magento,我只是试图解决这个问题,一个朋友一直在等待她的开发人员花了一年的时间制作了一个报价为六周的网站,现在只是关于作品。
Magento的版本是1.5.1
的问题是,该产品在新产品的小部件正在news_from_date分类 - 现在我不知道在哪里的Magento是从拉这一点,它似乎没有对应的顺序产品正在被添加,因此计划是通过entity_id desc进行排序,我已经设法将其编码到下拉排序列表中,但我正努力在新产品窗口小部件中实现此目的。
我不完全理解magentos文件结构和同时我希望这个代码是在一个小部件的文件夹,我不能在那里找到它和拖网谷歌已经建议我应该看的文件是在这里:
应用程序/代码/核心/法师/目录/座/产品/ New.php 此文件包含下面的代码块,我想我应该在寻找:
protected function _beforeToHtml()
{
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
$collection = Mage::getResourceModel('catalog/product_collection');
$collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
$collection = $this->_addProductAttributesAndPrices($collection)
->addStoreFilter()
->addAttributeToFilter('news_from_date', array('or'=> array(
0 => array('date' => true, 'to' => $todayDate),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left')
->addAttributeToFilter('news_to_date', array('or'=> array(
0 => array('date' => true, 'from' => $todayDate),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left')
->addAttributeToFilter(
array(
array('attribute' => 'news_from_date', 'is'=>new Zend_Db_Expr('not null')),
array('attribute' => 'news_to_date', 'is'=>new Zend_Db_Expr('not null'))
)
)
->addAttributeToSort('news_from_date', 'desc')
->setPageSize($this->getProductsCount())
->setCurPage(1)
;
$this->setProductCollection($collection);
return parent::_beforeToHtml();
}
现在,我已经试过这个,改变打它以各种方式出现,没有任何东西似乎在改变,所以我想我错了,因为我甚至没有设法改变消除小部件。
最后一件事我想是这样的:
protected function _beforeToHtml()
{
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
$collection = Mage::getResourceModel('catalog/product_collection');
$collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
$collection = $this->_addProductAttributesAndPrices($collection)
->addStoreFilter()
->addAttributeToSort('entity_id', 'desc')
->setPageSize($this->getProductsCount())
->setCurPage(1)
;
$this->setProductCollection($collection);
return parent::_beforeToHtml();
}
....没什么,没有任何变化,虚无缥缈。任何指针都非常赞赏 - 我认为我已经把自己置身于这里的深处,并且Im淹没在一个我不了解的复杂繁琐的系统中。
在此先感谢乡亲
您的评论是问题,以前的开发人员已经在app/code/local/Mage/Catalog/Block/Product/New.php上添加了代码,它覆盖了我的更改,感谢您清除该更改。我也很感谢你向我解释新闻/新闻,这让我感到有点困惑,因为我为什么玩这个游戏对前面的代码没有影响。 – WebweaverD 2012-02-06 15:34:44