0
특별 가격이 적용된 제품 컬렉션을 만들었지 만 카탈로그 가격 규칙이 적용될 때 제품 컬렉션을 얻는 방법을 모릅니다. 다음은 Magento : 카탈로그 가격 규칙에 따라 제품 컬렉션을 가져와야합니다.
는public function getSpecialPriceProducts()
{
$categoryID = $this->getCategoryId();
if($categoryID)
{
$category = new Mage_Catalog_Model_Category();
$category->load($categoryID); // this is category id
$collection = $category->getProductCollection();
} else
{
$collection = Mage::getResourceModel('catalog/product_collection');
}
$todayDate = date('m/d/y');
$tomorrow = mktime(0, 0, 0, date('m'), date('d'), date('y'));
$tomorrowDate = date('m/d/y', $tomorrow);
Mage::getModel('catalog/layer')->prepareProductCollection($collection);
$collection->addAttributeToSort('created_at', 'desc');
$collection->addStoreFilter()
->addAttributeToSelect(array('name', 'price', 'short_description','image','small_image','url_key'), 'inner');
$collection->addAttributeToFilter('special_price', array('gt' => 0));
$collection->addAttributeToFilter('special_to_date', array('date' => true, 'to' => $todayDate))
->addAttributeToFilter('special_from_date', array('or'=> array(
0 => array('date' => true, 'from' => $tomorrowDate),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left');
return $collection;
}
사람은 PLS 방법 카탈로그 가격 규칙이 적용되는 제품 목록을하는 저를 인도 할 수, 특별 가격의 제품을 얻을 수있는 코드? 미리 감사드립니다.
안녕하세요. 솔루션에 감사드립니다. 이 코드를 어느 파일에 넣었습니까? – zekia
특정 파일이 없습니다. 이것을 모델/블록 파일에 추가 할 수 있으며이를 사용할 수 있습니다. – shyammtp