Version Notes
Working version
Download this release
Release Info
| Developer | Edvinas Stulpinas |
| Extension | ES_Catproducts |
| Version | 1.1.0 |
| Comparing to | |
| See all releases | |
Version 1.1.0
- app/code/community/ES/Catproducts/Block/Products.php +93 -0
- app/code/community/ES/Catproducts/Helper/Data.php +6 -0
- app/code/community/ES/Catproducts/Helper/Observer.php +12 -0
- app/code/community/ES/Catproducts/Model/System/Config/List.php +12 -0
- app/code/community/ES/Catproducts/etc/adminhtml.xml +23 -0
- app/code/community/ES/Catproducts/etc/config.xml +67 -0
- app/code/community/ES/Catproducts/etc/system.xml +58 -0
- app/design/frontend/base/default/layout/catproducts.xml +8 -0
- app/design/frontend/base/default/template/catproducts/catproducts.phtml +94 -0
- app/etc/modules/ES_Catproducts.xml +9 -0
- package.xml +18 -0
- skin/frontend/base/default/css/style-catproducts.css +14 -0
app/code/community/ES/Catproducts/Block/Products.php
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class ES_Catproducts_Block_Products extends Mage_Catalog_Block_Product_Abstract
|
| 3 |
+
{
|
| 4 |
+
protected $_categoryId = null;
|
| 5 |
+
|
| 6 |
+
protected $_category = null;
|
| 7 |
+
|
| 8 |
+
protected $_products = null;
|
| 9 |
+
|
| 10 |
+
private $_cacheCategoryId;
|
| 11 |
+
|
| 12 |
+
private $_cacheProductId;
|
| 13 |
+
|
| 14 |
+
private $_cacheLifeTime = null;
|
| 15 |
+
|
| 16 |
+
private function init()
|
| 17 |
+
{
|
| 18 |
+
if ($this->_categoryId == null) {
|
| 19 |
+
$this->_categoryId = $this->getCategoryId();
|
| 20 |
+
$this->_cacheLifeTime = Mage::getStoreConfig('catproducts/general/lifetime');
|
| 21 |
+
$this->_cacheCategoryId = 'ES_CatProducts_Block_Products_Category_'.$this->_categoryId;
|
| 22 |
+
$this->_cacheProductId = 'ES_CatProducts_Block_Products_Product_'.$this->_categoryId;
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
protected function getCategory()
|
| 27 |
+
{
|
| 28 |
+
$this->init();
|
| 29 |
+
if ($this->_category == null) {
|
| 30 |
+
$cachedContent = Mage::app()->loadCache($this->_cacheCategoryId);
|
| 31 |
+
$category = unserialize($cachedContent);
|
| 32 |
+
if (!$category) {
|
| 33 |
+
$category = new Mage_Catalog_Model_Category();
|
| 34 |
+
$category->load($this->_categoryId);
|
| 35 |
+
Mage::app()->saveCache(
|
| 36 |
+
serialize($category),
|
| 37 |
+
$this->_cacheCategoryId,
|
| 38 |
+
array(Mage_Catalog_Model_Category::CACHE_TAG),
|
| 39 |
+
$this->_cacheLifeTime
|
| 40 |
+
);
|
| 41 |
+
}
|
| 42 |
+
$this->_category = $category;
|
| 43 |
+
}
|
| 44 |
+
return $this->_category;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
protected function getProducts()
|
| 48 |
+
{
|
| 49 |
+
if ($this->_products == null) {
|
| 50 |
+
if ($this->_category == null)
|
| 51 |
+
$this->getCategory();
|
| 52 |
+
$cachedContent = Mage::app()->loadCache($this->_cacheProductId);
|
| 53 |
+
$products = unserialize($cachedContent);
|
| 54 |
+
if (!$products) {
|
| 55 |
+
$products = $this->_category
|
| 56 |
+
->getProductCollection()
|
| 57 |
+
->addAttributeToSelect('name')
|
| 58 |
+
->addAttributeToSelect('short_description')
|
| 59 |
+
->addAttributeToSelect('price')
|
| 60 |
+
->addAttributeToSelect('special_price')
|
| 61 |
+
->addAttributeToSelect('small_image')
|
| 62 |
+
->addAttributeToFilter('status', 1)
|
| 63 |
+
->addAttributeToFilter('visibility', 4)
|
| 64 |
+
|
| 65 |
+
->setPageSize(Mage::getStoreConfig('catproducts/general/perblock'));
|
| 66 |
+
if ($products) {
|
| 67 |
+
foreach ($products as $product)
|
| 68 |
+
$productList[] = $product;
|
| 69 |
+
}
|
| 70 |
+
Mage::app()->saveCache(
|
| 71 |
+
serialize($productList),
|
| 72 |
+
$this->_cacheProductId,
|
| 73 |
+
array(Mage_Catalog_Model_Product::CACHE_TAG),
|
| 74 |
+
$this->_cacheLifeTime
|
| 75 |
+
);
|
| 76 |
+
}
|
| 77 |
+
$this->_products = $products;
|
| 78 |
+
}
|
| 79 |
+
return $this->_products;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
public function getMode()
|
| 83 |
+
{
|
| 84 |
+
return Mage::getStoreConfig('catproducts/general/list');
|
| 85 |
+
}
|
| 86 |
+
protected function _afterSave()
|
| 87 |
+
{
|
| 88 |
+
Mage::app()->cleanCache(array(
|
| 89 |
+
Mage_Catalog_Model_Category::CACHE_TAG,
|
| 90 |
+
Mage_Catalog_Model_Product::CACHE_TAG
|
| 91 |
+
));
|
| 92 |
+
}
|
| 93 |
+
}
|
app/code/community/ES/Catproducts/Helper/Data.php
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class ES_CatProducts_Helper_Data extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
}
|
app/code/community/ES/Catproducts/Helper/Observer.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class ES_CatProducts_Model_Observer
|
| 4 |
+
{
|
| 5 |
+
public function customer_address_save_before($observer)
|
| 6 |
+
{
|
| 7 |
+
exit('observer :)');
|
| 8 |
+
$address = $observer->getCustomerAddress();
|
| 9 |
+
//echo "<pre>"; print_r($address->getData()); exit;
|
| 10 |
+
// do something here
|
| 11 |
+
}
|
| 12 |
+
}
|
app/code/community/ES/Catproducts/Model/System/Config/List.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class ES_Catproducts_Model_System_Config_List
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array('value' => 'list', 'label'=>Mage::helper('adminhtml')->__('List')),
|
| 9 |
+
array('value' => 'grid', 'label'=>Mage::helper('adminhtml')->__('Grid')),
|
| 10 |
+
);
|
| 11 |
+
}
|
| 12 |
+
}
|
app/code/community/ES/Catproducts/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<acl>
|
| 4 |
+
<resources>
|
| 5 |
+
<admin>
|
| 6 |
+
<children>
|
| 7 |
+
<system>
|
| 8 |
+
<children>
|
| 9 |
+
<config>
|
| 10 |
+
<children>
|
| 11 |
+
<catproducts translate="title" module="Catproducts">
|
| 12 |
+
<title>Zzzzzzzzzzzzzzzzzzz</title>
|
| 13 |
+
<sort_order>60</sort_order>
|
| 14 |
+
</catproducts>
|
| 15 |
+
</children>
|
| 16 |
+
</config>
|
| 17 |
+
</children>
|
| 18 |
+
</system>
|
| 19 |
+
</children>
|
| 20 |
+
</admin>
|
| 21 |
+
</resources>
|
| 22 |
+
</acl>
|
| 23 |
+
</config>
|
app/code/community/ES/Catproducts/etc/config.xml
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
|
| 4 |
+
<global>
|
| 5 |
+
|
| 6 |
+
<modules>
|
| 7 |
+
<ES_Catproducts>
|
| 8 |
+
<version>0.1.0</version>
|
| 9 |
+
</ES_Catproducts>
|
| 10 |
+
</modules>
|
| 11 |
+
|
| 12 |
+
<blocks>
|
| 13 |
+
<catproducts>
|
| 14 |
+
<rewrite>
|
| 15 |
+
<catproducts>ES_Catproducts_Block_Products</catproducts>
|
| 16 |
+
</rewrite>
|
| 17 |
+
</catproducts>
|
| 18 |
+
</blocks>
|
| 19 |
+
|
| 20 |
+
<helpers>
|
| 21 |
+
<Catproducts>
|
| 22 |
+
<class>ES_Catproducts_Helper</class>
|
| 23 |
+
</Catproducts>
|
| 24 |
+
</helpers>
|
| 25 |
+
|
| 26 |
+
<models>
|
| 27 |
+
<catproducts>
|
| 28 |
+
<class>ES_Catproducts_Model</class>
|
| 29 |
+
<resourceModel>catproducts_resource</resourceModel>s
|
| 30 |
+
</catproducts>
|
| 31 |
+
<catproducts_resource>
|
| 32 |
+
<class>ES_Catproducts_Model_Resource</class>
|
| 33 |
+
</catproducts_resource>
|
| 34 |
+
</models>
|
| 35 |
+
|
| 36 |
+
</global>
|
| 37 |
+
|
| 38 |
+
<frontend>
|
| 39 |
+
<routers>
|
| 40 |
+
<catproducts>
|
| 41 |
+
<use>standard</use>
|
| 42 |
+
<args>
|
| 43 |
+
<module>ES_Catproducts</module>
|
| 44 |
+
<frontName>catproducts</frontName>
|
| 45 |
+
</args>
|
| 46 |
+
</catproducts>
|
| 47 |
+
</routers>
|
| 48 |
+
<layout>
|
| 49 |
+
<updates>
|
| 50 |
+
<catproducts>
|
| 51 |
+
<file>catproducts.xml</file>
|
| 52 |
+
</catproducts>
|
| 53 |
+
</updates>
|
| 54 |
+
</layout>
|
| 55 |
+
</frontend>
|
| 56 |
+
|
| 57 |
+
<default>
|
| 58 |
+
<catproducts>
|
| 59 |
+
<general>
|
| 60 |
+
<perblock>2</perblock>
|
| 61 |
+
<lifetime>1</lifetime>
|
| 62 |
+
<list>list</list>
|
| 63 |
+
</general>
|
| 64 |
+
</catproducts>
|
| 65 |
+
</default>
|
| 66 |
+
|
| 67 |
+
</config>
|
app/code/community/ES/Catproducts/etc/system.xml
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<es translate="label" module="Catproducts">
|
| 5 |
+
<label>MageTrend Extensions</label>
|
| 6 |
+
<sort_order>300</sort_order>
|
| 7 |
+
</es>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<catproducts translate="label" module="Catproducts">
|
| 11 |
+
<label>Products from category</label>
|
| 12 |
+
<tab>es</tab>
|
| 13 |
+
<frontend_type>text</frontend_type>
|
| 14 |
+
<sort_order>57</sort_order>
|
| 15 |
+
<show_in_default>1</show_in_default>
|
| 16 |
+
<show_in_website>1</show_in_website>
|
| 17 |
+
<show_in_store>1</show_in_store>
|
| 18 |
+
|
| 19 |
+
<groups>
|
| 20 |
+
<general translate="label">
|
| 21 |
+
<label>General</label>
|
| 22 |
+
<frontend_type>text</frontend_type>
|
| 23 |
+
<sort_order>10</sort_order>
|
| 24 |
+
<show_in_default>1</show_in_default>
|
| 25 |
+
<show_in_website>1</show_in_website>
|
| 26 |
+
<show_in_store>1</show_in_store>
|
| 27 |
+
<fields>
|
| 28 |
+
<perblock translate="label">
|
| 29 |
+
<label>Products in block</label>
|
| 30 |
+
<frontend_type>text</frontend_type>
|
| 31 |
+
<sort_order>2</sort_order>
|
| 32 |
+
<show_in_default>1</show_in_default>
|
| 33 |
+
<show_in_website>1</show_in_website>
|
| 34 |
+
<show_in_store>1</show_in_store>
|
| 35 |
+
</perblock>
|
| 36 |
+
<lifetime translate="label">
|
| 37 |
+
<label>Cache live time</label>
|
| 38 |
+
<frontend_type>text</frontend_type>
|
| 39 |
+
<sort_order>3</sort_order>
|
| 40 |
+
<show_in_default>1</show_in_default>
|
| 41 |
+
<show_in_website>1</show_in_website>
|
| 42 |
+
<show_in_store>1</show_in_store>
|
| 43 |
+
</lifetime>
|
| 44 |
+
<list translate="label">
|
| 45 |
+
<label>List style</label>
|
| 46 |
+
<frontend_type>select</frontend_type>
|
| 47 |
+
<sort_order>1</sort_order>
|
| 48 |
+
<show_in_default>1</show_in_default>
|
| 49 |
+
<show_in_website>1</show_in_website>
|
| 50 |
+
<show_in_store>1</show_in_store>
|
| 51 |
+
<source_model>catproducts/system_config_list</source_model>
|
| 52 |
+
</list>
|
| 53 |
+
</fields>
|
| 54 |
+
</general>
|
| 55 |
+
</groups>
|
| 56 |
+
</catproducts>
|
| 57 |
+
</sections>
|
| 58 |
+
</config>
|
app/design/frontend/base/default/layout/catproducts.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<default>
|
| 4 |
+
<reference name="head">
|
| 5 |
+
<action method="addItem"><type>skin_css</type><name>css/style-catproducts.css</name><params/></action>
|
| 6 |
+
</reference>
|
| 7 |
+
</default>
|
| 8 |
+
</layout>
|
app/design/frontend/base/default/template/catproducts/catproducts.phtml
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$_productCollection = $this->getProducts();
|
| 3 |
+
$_helper = $this->helper('catalog/output');
|
| 4 |
+
?>
|
| 5 |
+
<?php if($_productCollection->count()): ?>
|
| 6 |
+
<div class="page-title category-title">
|
| 7 |
+
<h1><?=$this->getCategory()->getName();?></h1>
|
| 8 |
+
</div>
|
| 9 |
+
|
| 10 |
+
<div class="category-products">
|
| 11 |
+
|
| 12 |
+
<?php if($this->getMode()!='grid'): ?>
|
| 13 |
+
<?php $_iterator = 0; ?>
|
| 14 |
+
<ol class="products-list" id="products-list" >
|
| 15 |
+
<?php foreach ($_productCollection as $_product): ?>
|
| 16 |
+
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
|
| 17 |
+
<?php // Product Image ?>
|
| 18 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
| 19 |
+
<?php // Product description ?>
|
| 20 |
+
<div class="product-shop">
|
| 21 |
+
<div class="f-fix">
|
| 22 |
+
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
|
| 23 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
|
| 24 |
+
<?php if($_product->getRatingSummary()): ?>
|
| 25 |
+
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
| 26 |
+
<?php endif; ?>
|
| 27 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
| 28 |
+
<?php if($_product->isSaleable()): ?>
|
| 29 |
+
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
|
| 30 |
+
<?php else: ?>
|
| 31 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
| 32 |
+
<?php endif; ?>
|
| 33 |
+
<div class="desc std">
|
| 34 |
+
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
|
| 35 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
|
| 36 |
+
</div>
|
| 37 |
+
<ul class="add-to-links">
|
| 38 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
| 39 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
| 40 |
+
<?php endif; ?>
|
| 41 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
| 42 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
| 43 |
+
<?php endif; ?>
|
| 44 |
+
</ul>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
</li>
|
| 48 |
+
<?php endforeach; ?>
|
| 49 |
+
</ol>
|
| 50 |
+
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
|
| 51 |
+
|
| 52 |
+
<?php else: ?>
|
| 53 |
+
|
| 54 |
+
<?php // Grid Mode ?>
|
| 55 |
+
|
| 56 |
+
<?php $_collectionSize = $_productCollection->count() ?>
|
| 57 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
| 58 |
+
<?php $i=0; foreach ($_productCollection as $_product): ?>
|
| 59 |
+
<?php if ($i++%$_columnCount==0): ?>
|
| 60 |
+
<ul class="products-grid">
|
| 61 |
+
<?php endif ?>
|
| 62 |
+
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
|
| 63 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
| 64 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
|
| 65 |
+
<?php if($_product->getRatingSummary()): ?>
|
| 66 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
| 67 |
+
<?php endif; ?>
|
| 68 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
| 69 |
+
<div class="actions">
|
| 70 |
+
<?php if($_product->isSaleable()): ?>
|
| 71 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
| 72 |
+
<?php else: ?>
|
| 73 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
| 74 |
+
<?php endif; ?>
|
| 75 |
+
<ul class="add-to-links">
|
| 76 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
| 77 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
| 78 |
+
<?php endif; ?>
|
| 79 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
| 80 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
| 81 |
+
<?php endif; ?>
|
| 82 |
+
</ul>
|
| 83 |
+
</div>
|
| 84 |
+
</li>
|
| 85 |
+
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
|
| 86 |
+
</ul>
|
| 87 |
+
<?php endif ?>
|
| 88 |
+
<?php endforeach ?>
|
| 89 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
|
| 90 |
+
<?php endif; ?>
|
| 91 |
+
|
| 92 |
+
</div>
|
| 93 |
+
|
| 94 |
+
<?php endif; ?>
|
app/etc/modules/ES_Catproducts.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<ES_Catproducts>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</ES_Catproducts>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>ES_Catproducts</name>
|
| 4 |
+
<version>1.1.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Show products from category in block</summary>
|
| 10 |
+
<description>You can add products from category in home page</description>
|
| 11 |
+
<notes>Working version</notes>
|
| 12 |
+
<authors><author><name>Edvinas Stulpinas</name><user>edas1</user><email>st.edvinas@gmail.com</email></author></authors>
|
| 13 |
+
<date>2013-02-16</date>
|
| 14 |
+
<time>17:52:29</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="ES"><dir name="Catproducts"><dir name="Block"><file name="Products.php" hash="53789bcf5197fa06035808b34810c40f"/></dir><dir name="Helper"><file name="Data.php" hash="7d37396f9e72bedba0735e6a64e7caab"/><file name="Observer.php" hash="c0de18fa4255d34a6392801ab17ad3d0"/></dir><dir name="Model"><dir name="System"><dir name="Config"><file name="List.php" hash="270dd8c5ffca3fbbfb87581c8e3aafef"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="77a901bdbc455555bd5ec00ea85fbf67"/><file name="config.xml" hash="d576c9eb99ab39a8b732016229712276"/><file name="system.xml" hash="d7f243115df220cf345309eb1a0c5323"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ES_Catproducts.xml" hash="101be0dcdd3d8634569779bc51c56c9e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="catproducts"><file name="catproducts.phtml" hash="a46192d19c37aba02a8ee9bfeb1b8b98"/></dir></dir><dir name="layout"><file name="catproducts.xml" hash="39aee9b23f41353ff1aa406e8adb18ee"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="style-catproducts.css" hash="3fa2f0bed6544f24b448c7c5c721c8b7"/></dir></dir></dir></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
skin/frontend/base/default/css/style-catproducts.css
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.std .category-products ol,
|
| 2 |
+
.std .category-products ul {
|
| 3 |
+
list-style: none;
|
| 4 |
+
padding-left: 0;
|
| 5 |
+
}
|
| 6 |
+
.std .category-products ul,
|
| 7 |
+
.std .category-products ol,
|
| 8 |
+
.std .category-products dl,
|
| 9 |
+
.std .category-products p,
|
| 10 |
+
.std .category-products address,
|
| 11 |
+
.std .category-products blockquote {
|
| 12 |
+
margin: 0 ;
|
| 13 |
+
padding: 0;
|
| 14 |
+
}
|
