intelligrape_productlable - Version 1.0.0.1

Version Notes

New

Download this release

Release Info

Developer Amatya
Extension intelligrape_productlable
Version 1.0.0.1
Comparing to
See all releases


Version 1.0.0.1

app/code/local/Intelligrape/Productlable/Block/Productlable.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Intelligrape_Productlable_Block_Productlable extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getProductlable()
10
+ {
11
+ if (!$this->hasData('productlable')) {
12
+ $this->setData('productlable', Mage::registry('productlable'));
13
+ }
14
+ return $this->getData('productlable');
15
+
16
+ }
17
+
18
+ public function isNewEnable($_product){
19
+
20
+ if((Mage::getStoreConfig('productlable/sample/enablenew')) && ($_product->news_from_date)){
21
+ return true;
22
+ }
23
+ else{
24
+ return false;
25
+ }
26
+
27
+ }
28
+
29
+ public function getLableImage($fileName){
30
+ //$fileName = Mage::getStoreConfig('productlable/sample/newimage');
31
+ $width = 50;
32
+ $height = 50;
33
+
34
+ $folderURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
35
+ $imageURL = $folderURL . $fileName;
36
+
37
+ $basePath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA).DS.'theme'.DS.$fileName;
38
+ $newPath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . "resized" . DS . $fileName;
39
+ //if width empty then return original size image's URL
40
+ if ($width != '') {
41
+ //if image has already resized then just return URL
42
+ if (file_exists($basePath) && is_file($basePath) && !file_exists($newPath)) {
43
+ $imageObj = new Varien_Image($basePath);
44
+ $imageObj->constrainOnly(TRUE);
45
+ $imageObj->keepAspectRatio(FALSE);
46
+ $imageObj->keepFrame(FALSE);
47
+ $imageObj->keepTransparency(TRUE);
48
+ $imageObj->resize($width, $height);
49
+ $imageObj->save($newPath);
50
+ }
51
+ $resizedURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "resized/".$fileName;
52
+ } else {
53
+ $resizedURL = $imageURL;
54
+ }
55
+ return $resizedURL;
56
+ }
57
+
58
+ public function isProductOutOfStockEnable($_product){
59
+
60
+ if((Mage::getStoreConfig('productlable/sample/enableoutofstock')) && (!$_product->isAvailable())){
61
+ return true;
62
+ }
63
+ else{
64
+ return false;
65
+ }
66
+ }
67
+
68
+ public function getNewImage(){
69
+ $fileName = Mage::getStoreConfig('productlable/sample/newimage');
70
+ $resizedURL = $this->getLableImage($fileName);
71
+ return $resizedURL;
72
+ }
73
+
74
+ public function getSoldOutImage(){
75
+ $fileName = Mage::getStoreConfig('productlable/sample/outofstockimage');
76
+ $resizedURL = $this->getLableImage($fileName);
77
+ return $resizedURL;
78
+ }
79
+
80
+ public function getSaleImage(){
81
+ $fileName = Mage::getStoreConfig('productlable/sample/saleimage');
82
+ $resizedURL = $this->getLableImage($fileName);
83
+ return $resizedURL;
84
+ }
85
+
86
+ public function isSaleEnable($_product){
87
+
88
+ if((Mage::getStoreConfig('productlable/sample/enablesale')) && ($_product->special_price)){
89
+ return true;
90
+ }
91
+ else{
92
+ return false;
93
+ }
94
+
95
+ }
96
+
97
+
98
+ }
app/code/local/Intelligrape/Productlable/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Intelligrape_Productlable_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/Intelligrape/Productlable/etc/config.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Intelligrape
5
+ * @package Intelligrape_Productlable
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Intelligrape_Productlable>
13
+ <version>0.1.0</version>
14
+ </Intelligrape_Productlable>
15
+ </modules>
16
+ <frontend>
17
+ <routers>
18
+ <productlable>
19
+ <use>standard</use>
20
+ <args>
21
+ <module>Intelligrape_Productlable</module>
22
+ <frontName>productlable</frontName>
23
+ </args>
24
+ </productlable>
25
+ </routers>
26
+ <layout>
27
+ <updates>
28
+ <productlable>
29
+ <file>productlable.xml</file>
30
+ </productlable>
31
+ </updates>
32
+ </layout>
33
+ </frontend>
34
+ <admin>
35
+ </admin>
36
+ <adminhtml>
37
+ <acl>
38
+ <resources>
39
+ <all>
40
+ <title>Allow Everything</title>
41
+ </all>
42
+ <admin>
43
+ <children>
44
+ <Intelligrape_Productlable>
45
+ <title>Productlable Module</title>
46
+ <sort_order>10</sort_order>
47
+ </Intelligrape_Productlable>
48
+ <system>
49
+ <children>
50
+ <config>
51
+ <children>
52
+ <productlable>
53
+ <title>Intelligrape</title>
54
+ </productlable>
55
+ </children>
56
+ </config>
57
+ </children>
58
+ </system>
59
+ </children>
60
+ </admin>
61
+ </resources>
62
+ </acl>
63
+ </adminhtml>
64
+ <global>
65
+ <blocks>
66
+ <productlable>
67
+ <class>Intelligrape_Productlable_Block</class>
68
+ </productlable>
69
+ </blocks>
70
+ <helpers>
71
+ <productlable>
72
+ <class>Intelligrape_Productlable_Helper</class>
73
+ </productlable>
74
+ </helpers>
75
+ </global>
76
+ </config>
app/code/local/Intelligrape/Productlable/etc/system.xml ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <intelligrape translate="label">
5
+ <label>Intelligrape</label>
6
+ <sort_order>1</sort_order>
7
+ </intelligrape>
8
+ </tabs>
9
+ <sections>
10
+ <productlable translate="label">
11
+ <label>Product Lables</label>
12
+ <tab>intelligrape</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1000</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
+ <groups>
19
+ <!-- New groups go here -->
20
+ <sample translate="label">
21
+ <label>Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>100</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
+ <!-- New fields go here -->
29
+ <enablenew translate="label comment">
30
+ <label>Enabled New Label</label>
31
+ <!-- <comment><![CDATA[This text appears just beneath the field with a small arrow.<span class="notice">It can contain HTML formatting too!</span>]]></comment>-->
32
+ <frontend_type>select</frontend_type>
33
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ <sort_order>10</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </enablenew>
39
+
40
+ <newimage translate="label comment">
41
+ <label>New Lable Image</label>
42
+ <!-- <comment><![CDATA[This text appears just beneath the field with a small arrow.<span class="notice">It can contain HTML formatting too!</span>]]></comment>-->
43
+ <frontend_type>image</frontend_type>
44
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
45
+ <upload_dir config="system/filesystem/media" scope_info="1">theme</upload_dir>
46
+ <base_url type="media" scope_info="1">theme</base_url>
47
+ <sort_order>11</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
+ </newimage>
52
+
53
+ <enableoutofstock translate="label comment">
54
+ <label>Enabled Out Of Stock Label</label>
55
+ <comment><![CDATA[For this first enable <span class="notice">Display Out of Stock Products</span> from <span class="notice">System > Configuration > Catalog > Inventory > Stock Options.</span>]]></comment>
56
+ <frontend_type>select</frontend_type>
57
+ <source_model>adminhtml/system_config_source_yesno</source_model>
58
+ <sort_order>12</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </enableoutofstock>
63
+
64
+ <outofstockimage translate="label comment">
65
+ <label>Out Of Stock Lable Image</label>
66
+ <!-- <comment><![CDATA[This text appears just beneath the field with a small arrow.<span class="notice">It can contain HTML formatting too!</span>]]></comment>-->
67
+ <frontend_type>image</frontend_type>
68
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
69
+ <upload_dir config="system/filesystem/media" scope_info="1">theme</upload_dir>
70
+ <base_url type="media" scope_info="1">theme</base_url>
71
+ <sort_order>14</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </outofstockimage>
76
+
77
+ <enablesale translate="label comment">
78
+ <label>Enabled Sale Label</label>
79
+ <comment><![CDATA[This will render a "Sale" tag image on product with special price.]]></comment>
80
+ <frontend_type>select</frontend_type>
81
+ <source_model>adminhtml/system_config_source_yesno</source_model>
82
+ <sort_order>15</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ </enablesale>
87
+
88
+ <saleimage translate="label comment">
89
+ <label>Sale Image</label>
90
+ <!-- <comment><![CDATA[This text appears just beneath the field with a small arrow.<span class="notice">It can contain HTML formatting too!</span>]]></comment>-->
91
+ <frontend_type>image</frontend_type>
92
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
93
+ <upload_dir config="system/filesystem/media" scope_info="1">theme</upload_dir>
94
+ <base_url type="media" scope_info="1">theme</base_url>
95
+ <sort_order>16</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ </saleimage>
100
+ </fields>
101
+ </sample>
102
+ </groups>
103
+ </productlable>
104
+ </sections>
105
+ </config>
app/design/frontend/default/default/layout/productlable.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <productlable_index_index>
6
+ <reference name="content">
7
+ <block type="productlable/productlable" name="productlable" template="productlable/productlable.phtml" />
8
+ </reference>
9
+ </productlable_index_index>
10
+
11
+ <catalog_category_default translate="label">
12
+ <reference name="product_list">
13
+ <action method="setTemplate"><template>productlable/list.phtml</template></action>
14
+ </reference>
15
+ </catalog_category_default>
16
+
17
+ <catalog_category_layered translate="label">
18
+ <reference name="product_list">
19
+ <action method="setTemplate"><template>productlable/list.phtml</template></action>
20
+ </reference>
21
+ </catalog_category_layered>
22
+
23
+ <catalog_product_view translate="label">
24
+ <reference name="product.info.media">
25
+ <action method="setTemplate"><template>productlable/media.phtml</template></action>
26
+ </reference>
27
+ </catalog_product_view>
28
+
29
+ <catalogsearch_result_index translate="label">
30
+ <reference name="search_result_list">
31
+ <action method="setTemplate"><template>productlable/list.phtml</template></action>
32
+ </reference>
33
+ </catalogsearch_result_index>
34
+
35
+ </layout>
app/design/frontend/default/default/template/productlable/list.phtml ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Product list template
30
+ *
31
+ * @see Mage_Catalog_Block_Product_List
32
+ */
33
+ ?>
34
+ <?php
35
+ $_productCollection=$this->getLoadedProductCollection();
36
+ $_helper = $this->helper('catalog/output');
37
+
38
+ $productLableObj = $this->getLayout()->createBlock('productlable/productlable');
39
+
40
+ ?>
41
+ <?php if(!$_productCollection->count()): ?>
42
+ <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
43
+ <?php else: ?>
44
+ <div class="category-products">
45
+ <?php echo $this->getToolbarHtml() ?>
46
+ <?php // List mode ?>
47
+ <?php if($this->getMode()!='grid'): ?>
48
+ <?php $_iterator = 0; ?>
49
+ <ol class="products-list" id="products-list">
50
+ <?php foreach ($_productCollection as $_product): ?>
51
+ <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
52
+
53
+ <div style="position: relative;">
54
+
55
+ <?php
56
+
57
+ if($productLableObj->isProductOutOfStockEnable($_product)){
58
+
59
+ ?>
60
+ <div style="position: absolute;z-index: 999;top: 2px;"><img alt="New" src="<?php echo $productLableObj->getSoldOutImage() ?>" /></div>
61
+ <?php
62
+
63
+ }
64
+ elseif($productLableObj->isNewEnable($_product)){
65
+ $date1 = new Zend_Date(now());
66
+ $date2 = new Zend_Date($_product->news_to_date);
67
+ if ($date2->compareDay($date1) <= 0) {
68
+ ?>
69
+ <div style="position: absolute;z-index: 999;top: 2px;"><img alt="New" src="<?php echo $productLableObj->getNewImage() ?>" /></div>
70
+ <?php
71
+
72
+ }
73
+ }
74
+ elseif($productLableObj->isSaleEnable($_product)){
75
+ $date1 = new Zend_Date(now());
76
+ $date2 = new Zend_Date($_product->special_to_date);
77
+ if ($date2->compareDay($date1) >= 0) {
78
+ ?>
79
+ <div style="position: absolute;z-index: 999;top: 2px;"><img alt="New" src="<?php echo $productLableObj->getSaleImage() ?>" /></div>
80
+
81
+ <?php
82
+
83
+ }
84
+ }
85
+
86
+ ?>
87
+
88
+ <?php // Product Image ?>
89
+ <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>
90
+ </div>
91
+
92
+
93
+ <?php // Product description ?>
94
+ <div class="product-shop">
95
+ <div class="f-fix">
96
+ <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
97
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
98
+ <?php if($_product->getRatingSummary()): ?>
99
+ <?php echo $this->getReviewsSummaryHtml($_product) ?>
100
+ <?php endif; ?>
101
+ <?php echo $this->getPriceHtml($_product, true) ?>
102
+ <?php if($_product->isSaleable()): ?>
103
+ <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>
104
+ <?php else: ?>
105
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
106
+ <?php endif; ?>
107
+ <div class="desc std">
108
+ <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
109
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
110
+ </div>
111
+ <ul class="add-to-links">
112
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
113
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
114
+ <?php endif; ?>
115
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
116
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
117
+ <?php endif; ?>
118
+ </ul>
119
+ </div>
120
+ </div>
121
+ </li>
122
+ <?php endforeach; ?>
123
+ </ol>
124
+ <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
125
+
126
+ <?php else: ?>
127
+
128
+ <?php // Grid Mode ?>
129
+ <?php $_collectionSize = $_productCollection->count() ?>
130
+ <?php $_columnCount = $this->getColumnCount(); ?>
131
+ <?php $i=0; foreach ($_productCollection as $_product): ?>
132
+
133
+ <?php if ($i++%$_columnCount==0): ?>
134
+ <ul class="products-grid">
135
+ <?php endif ?>
136
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
137
+ <div style="position: relative;">
138
+
139
+ <?php
140
+
141
+ if($productLableObj->isProductOutOfStockEnable($_product)){
142
+
143
+ ?>
144
+ <div style="position: absolute;z-index: 999;top: 2px;"><img alt="New" src="<?php echo $productLableObj->getSoldOutImage() ?>" /></div>
145
+
146
+ <?php
147
+
148
+ }
149
+ elseif($productLableObj->isNewEnable($_product)){
150
+ $date1 = new Zend_Date(now());
151
+ $date2 = new Zend_Date($_product->news_to_date);
152
+ if ($date2->compareDay($date1) >= 0) {
153
+ ?>
154
+ <div style="position: absolute;z-index: 999;top: 2px;"><img alt="New" src="<?php echo $productLableObj->getNewImage() ?>" /></div>
155
+
156
+ <?php
157
+
158
+ }
159
+ }
160
+ elseif($productLableObj->isSaleEnable($_product)){
161
+ $date1 = new Zend_Date(now());
162
+ $date2 = new Zend_Date($_product->special_to_date);
163
+ if ($date2->compareDay($date1) >= 0) {
164
+ ?>
165
+ <div style="position: absolute;z-index: 999;top: 2px;"><img alt="New" src="<?php echo $productLableObj->getSaleImage() ?>" /></div>
166
+
167
+ <?php
168
+
169
+ }
170
+ }
171
+
172
+ ?>
173
+
174
+ <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>
175
+ </div>
176
+
177
+ <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>
178
+ <?php if($_product->getRatingSummary()): ?>
179
+ <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
180
+ <?php endif; ?>
181
+ <?php echo $this->getPriceHtml($_product, true) ?>
182
+ <div class="actions">
183
+ <?php if($_product->isSaleable()): ?>
184
+ <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>
185
+ <?php else: ?>
186
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
187
+ <?php endif; ?>
188
+ <ul class="add-to-links">
189
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
190
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
191
+ <?php endif; ?>
192
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
193
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
194
+ <?php endif; ?>
195
+ </ul>
196
+ </div>
197
+ </li>
198
+ <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
199
+ </ul>
200
+ <?php endif ?>
201
+ <?php endforeach ?>
202
+ <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
203
+ <?php endif; ?>
204
+
205
+ <div class="toolbar-bottom">
206
+ <?php echo $this->getToolbarHtml() ?>
207
+ </div>
208
+ </div>
209
+ <?php endif; ?>
app/design/frontend/default/default/template/productlable/media.phtml ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Product media data template
29
+ *
30
+ * @see Mage_Catalog_Block_Product_View_Media
31
+ */
32
+ ?>
33
+ <?php
34
+ $_product = $this->getProduct();
35
+ $_helper = $this->helper('catalog/output');
36
+ ?>
37
+ <?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
38
+ <div class="product-image product-image-zoom" style="position: relative;">
39
+
40
+ <?php
41
+
42
+ $productLableObj = $this->getLayout()->createBlock('productlable/productlable');
43
+ if($productLableObj->isProductOutOfStockEnable($_product)){
44
+
45
+ ?>
46
+ <div style="position: absolute;z-index: 999;top: 5px;"><img alt="New" src="<?php echo $productLableObj->getSoldOutImage() ?>" /></div>
47
+ <?php
48
+
49
+ }
50
+ elseif($productLableObj->isNewEnable($_product)){
51
+ $date1 = new Zend_Date(now());
52
+ $date2 = new Zend_Date($_product->news_to_date);
53
+ if ($date2->compareDay($date1) >= 0) {
54
+ ?>
55
+ <div style="position: absolute;z-index: 999;top: 5px;"><img alt="New" src="<?php echo $productLableObj->getNewImage() ?>" /></div>
56
+ <?php
57
+
58
+ }
59
+ }
60
+ elseif($productLableObj->isSaleEnable($_product)){
61
+ $date1 = new Zend_Date(now());
62
+ $date2 = new Zend_Date($_product->special_to_date);
63
+ if ($date2->compareDay($date1) >= 0) {
64
+ ?>
65
+ <div style="position: absolute;z-index: 999;top: 2px;"><img alt="New" src="<?php echo $productLableObj->getSaleImage() ?>" /></div>
66
+
67
+ <?php
68
+
69
+ }
70
+ }
71
+
72
+ ?>
73
+
74
+ <?php
75
+ $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
76
+ echo $_helper->productAttribute($_product, $_img, 'image');
77
+ ?>
78
+ </div>
79
+ <p class="zoom-notice" id="track_hint"><?php echo $this->__('Double click on above image to view full picture') ?></p>
80
+ <div class="zoom">
81
+ <img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" title="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
82
+ <div id="track">
83
+ <div id="handle"></div>
84
+ </div>
85
+ <img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" title="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
86
+ </div>
87
+ <script type="text/javascript">
88
+ //<![CDATA[
89
+ Event.observe(window, 'load', function() {
90
+ product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
91
+ });
92
+ //]]>
93
+ </script>
94
+ <?php else: ?>
95
+ <p class="product-image">
96
+ <?php
97
+ $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
98
+ echo $_helper->productAttribute($_product, $_img, 'image');
99
+ ?>
100
+ </p>
101
+ <?php endif; ?>
102
+ <?php if (count($this->getGalleryImages()) > 0): ?>
103
+ <div class="more-views">
104
+ <h2><?php echo $this->__('More Views') ?></h2>
105
+ <ul>
106
+ <?php foreach ($this->getGalleryImages() as $_image): ?>
107
+ <li>
108
+ <a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
109
+ </li>
110
+ <?php endforeach; ?>
111
+ </ul>
112
+ </div>
113
+ <?php endif; ?>
app/design/frontend/default/default/template/productlable/productlable.phtml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h4><?php echo $this->__('Module List') ?></h4>
2
+ <?php
3
+
4
+ /*
5
+ This shows how to load specific fields from a record in the database.
6
+ 1) Note the load(15), this corresponds to saying "select * from table where table_id = 15"
7
+ 2) You can then just use the get(fieldname) to pull specific data from the table.
8
+ 3) If you have a field named news_id, then it becomes getNewsId, etc.
9
+ */
10
+ /*
11
+ $news = Mage::getModel('productlable/productlable')->load(15);
12
+ echo $news->getNewsId();
13
+ echo $news->getTitle();
14
+ echo $news->getContent();
15
+ echo $news->getStatus();
16
+ */
17
+
18
+ /*
19
+ This shows an alternate way of loading datas from a record using the database the "Magento Way" (using blocks and controller).
20
+ Uncomment blocks in /app/code/local/Namespace/Module/controllers/IndexController.php if you want to use it.
21
+
22
+ */
23
+ /*
24
+ $object = $this->getProductlable();
25
+ echo 'id: '.$object['test_id'].'<br/>';
26
+ echo 'title: '.$object['title'].'<br/>';
27
+ echo 'content: '.$object['content'].'<br/>';
28
+ echo 'status: '.$object['status'].'<br/>';
29
+ */
30
+
31
+
32
+ /*
33
+ This shows how to load multiple rows in a collection and save a change to them.
34
+ 1) The setPageSize function will load only 5 records per page and you can set the current Page with the setCurPage function.
35
+ 2) The $collection->walk('save') allows you to save everything in the collection after all changes have been made.
36
+ */
37
+ /*
38
+ $i = 0;
39
+
40
+ $collection = Mage::getModel('productlable/productlable')->getCollection();
41
+ $collection->setPageSize(5);
42
+ $collection->setCurPage(2);
43
+ $size = $collection->getSize();
44
+ $cnt = count($collection);
45
+ foreach ($collection as $item) {
46
+ $i = $i+1;
47
+ $item->setTitle($i);
48
+ echo $item->getTitle();
49
+ }
50
+
51
+ $collection->walk('save');
52
+ */
53
+
54
+ /*
55
+ This shows how to load a single record and save a change.
56
+ 1) Note the setTitle, this corresponds to the table field name, title, and then you pass it the text to change.
57
+ 2) Call the save() function only on a single record.
58
+ */
59
+ /*
60
+ $object = Mage::getModel('productlable/productlable')->load(1);
61
+ $object->setTitle('This is a changed title');
62
+ $object->save();
63
+ */
64
+
65
+ ?>
app/etc/modules/Intelligrape_Productlable.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Intelligrape
5
+ * @package Intelligrape_Productlable
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Intelligrape_Productlable>
13
+ <active>true</active>
14
+ <codePool>local</codePool>
15
+ </Intelligrape_Productlable>
16
+ </modules>
17
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>intelligrape_productlable</name>
4
+ <version>1.0.0.1</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>intelligrape_productlable</summary>
10
+ <description>intelligrape_productlable</description>
11
+ <notes>New</notes>
12
+ <authors><author><name>Amatya</name><user>intelligrape</user><email>shahid@intelligrape.com</email></author></authors>
13
+ <date>2012-12-22</date>
14
+ <time>01:08:14</time>
15
+ <contents><target name="magelocal"><dir name="Intelligrape"><dir name="Productlable"><dir name="Block"><file name="Productlable.php" hash="7a9d07bd0c4c774e27396ebce6346a5b"/></dir><dir name="Helper"><file name="Data.php" hash="7e56b27ba3b5e18e4b00543880cfd877"/></dir><dir name="etc"><file name="config.xml" hash="5791e8877f841eb7e307d81332b30343"/><file name="system.xml" hash="280d5f982b279bfaee5e7a5544a1c0ca"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Intelligrape_Productlable.xml" hash="95abae7f4db0bc8ad4e35a03ec0b30ec"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="productlable.xml" hash="f45dcf755458d1e3633a5a097b9cb451"/></dir><dir name="template"><dir name="productlable"><file name="list.phtml" hash="7d78fc4d7ca4b471ae3f62567ea191a5"/><file name="media.phtml" hash="c89204bf1edf605b108b5ecba53fce83"/><file name="productlable.phtml" hash="2733016c58ecf6eed2fb78f4f41b7673"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>