Version Notes
1.0.0 First Release
Download this release
Release Info
| Developer | I Gusti Agung Mahendra Putra |
| Extension | Jalak_Zeroprice |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/community/Jalak/Zeroprice/Block/Rewrite/Catalog/Product/Price.php +38 -0
- app/code/community/Jalak/Zeroprice/Exception.php +17 -0
- app/code/community/Jalak/Zeroprice/Helper/Data.php +48 -0
- app/code/community/Jalak/Zeroprice/etc/adminhtml.xml +24 -0
- app/code/community/Jalak/Zeroprice/etc/config.xml +75 -0
- app/code/community/Jalak/Zeroprice/etc/system.xml +61 -0
- app/design/frontend/base/default/layout/jalak_zeroprice.xml +42 -0
- app/design/frontend/base/default/template/jalak_zeroprice/catalog/product/list.phtml +139 -0
- app/design/frontend/base/default/template/jalak_zeroprice/catalog/product/view/addtocart.phtml +44 -0
- app/etc/modules/Jalak_Zeroprice.xml +10 -0
- package.xml +18 -0
app/code/community/Jalak/Zeroprice/Block/Rewrite/Catalog/Product/Price.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Jalak
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
*
|
| 13 |
+
* @category Jalak
|
| 14 |
+
* @package Jalak_Zeroprice
|
| 15 |
+
* @author Hendrathings <hendrathings@gmail.com>
|
| 16 |
+
*/
|
| 17 |
+
class Jalak_Zeroprice_Block_Rewrite_Catalog_Product_Price extends Mage_Catalog_Block_Product_Price {
|
| 18 |
+
|
| 19 |
+
public function getProduct()
|
| 20 |
+
{
|
| 21 |
+
$product = $this->_getData('product');
|
| 22 |
+
if (!$product)
|
| 23 |
+
{
|
| 24 |
+
$product = Mage::registry('product');
|
| 25 |
+
}
|
| 26 |
+
return $product;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
protected function _toHtml()
|
| 30 |
+
{
|
| 31 |
+
$helper = Mage::helper('jalak_zeroprice');
|
| 32 |
+
if ($helper->isEnabled() && !($this->getProduct()->price > $helper->priceValue()))
|
| 33 |
+
return '';
|
| 34 |
+
|
| 35 |
+
return parent::_toHtml();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
}
|
app/code/community/Jalak/Zeroprice/Exception.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Jalak
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
*
|
| 13 |
+
* @category Jalak
|
| 14 |
+
* @package Jalak_Zeroprice
|
| 15 |
+
* @author Hendrathings <hendrathings@gmail.com>
|
| 16 |
+
*/
|
| 17 |
+
class Jalak_Zeroprice_Exception extends Mage_Core_Exception { }
|
app/code/community/Jalak/Zeroprice/Helper/Data.php
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Jalak
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
*
|
| 13 |
+
* @category Jalak
|
| 14 |
+
* @package Jalak_Zeroprice
|
| 15 |
+
* @author Hendrathings <hendrathings@gmail.com>
|
| 16 |
+
*/
|
| 17 |
+
class Jalak_Zeroprice_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 18 |
+
|
| 19 |
+
protected $_model;
|
| 20 |
+
|
| 21 |
+
const XML_MODULE_ENABLED = 'jalak_zeroprice/general/enabled';
|
| 22 |
+
const XML_MODULE_PRICE_VALUE = 'jalak_zeroprice/general/price_value';
|
| 23 |
+
const XML_MODULE_HIDE_CART = 'jalak_zeroprice/general/enabled_hide_cart';
|
| 24 |
+
|
| 25 |
+
public function isEnabled()
|
| 26 |
+
{
|
| 27 |
+
return Mage::getStoreConfig(self::XML_MODULE_ENABLED) ? true : false;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function priceValue()
|
| 31 |
+
{
|
| 32 |
+
return Mage::getStoreConfig(self::XML_MODULE_PRICE_VALUE);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
public function hideAddtoCart()
|
| 36 |
+
{
|
| 37 |
+
return Mage::getStoreConfig(self::XML_MODULE_HIDE_CART) ? true : false;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
public function getCanAddToCart()
|
| 41 |
+
{
|
| 42 |
+
if (!$this->isEnabled())
|
| 43 |
+
return true;
|
| 44 |
+
|
| 45 |
+
return !$this->hideAddtoCart();
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
}
|
app/code/community/Jalak/Zeroprice/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
|
| 3 |
+
<config>
|
| 4 |
+
<acl>
|
| 5 |
+
<resources>
|
| 6 |
+
<admin>
|
| 7 |
+
<children>
|
| 8 |
+
<system>
|
| 9 |
+
<children>
|
| 10 |
+
<config>
|
| 11 |
+
<children>
|
| 12 |
+
<jalak_zeroprice translate="title" module="jalak_zeroprice">
|
| 13 |
+
<title>Jalak Zero Price</title>
|
| 14 |
+
<sort_order>50</sort_order>
|
| 15 |
+
</jalak_zeroprice>
|
| 16 |
+
</children>
|
| 17 |
+
</config>
|
| 18 |
+
</children>
|
| 19 |
+
</system>
|
| 20 |
+
</children>
|
| 21 |
+
</admin>
|
| 22 |
+
</resources>
|
| 23 |
+
</acl>
|
| 24 |
+
</config>
|
app/code/community/Jalak/Zeroprice/etc/config.xml
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
|
| 3 |
+
<config>
|
| 4 |
+
<modules>
|
| 5 |
+
<Jalak_Zeroprice>
|
| 6 |
+
<version>1.0.0</version>
|
| 7 |
+
</Jalak_Zeroprice>
|
| 8 |
+
</modules>
|
| 9 |
+
<global>
|
| 10 |
+
<helpers>
|
| 11 |
+
<jalak_zeroprice>
|
| 12 |
+
<class>Jalak_Zeroprice_Helper</class>
|
| 13 |
+
</jalak_zeroprice>
|
| 14 |
+
</helpers>
|
| 15 |
+
<blocks>
|
| 16 |
+
<jalak_zeroprice>
|
| 17 |
+
<class>Jalak_Zeroprice_Block</class>
|
| 18 |
+
</jalak_zeroprice>
|
| 19 |
+
<catalog>
|
| 20 |
+
<rewrite>
|
| 21 |
+
<product_price>Jalak_Zeroprice_Block_Rewrite_Catalog_Product_Price</product_price>
|
| 22 |
+
</rewrite>
|
| 23 |
+
</catalog>
|
| 24 |
+
</blocks>
|
| 25 |
+
<resources>
|
| 26 |
+
<!-- <jalak_zeroprice_setup>
|
| 27 |
+
<setup>
|
| 28 |
+
<module>Jalak_Zeroprice</module>
|
| 29 |
+
</setup>
|
| 30 |
+
<connection>
|
| 31 |
+
<use>core_setup</use>
|
| 32 |
+
</connection>
|
| 33 |
+
</jalak_zeroprice_setup>-->
|
| 34 |
+
<jalak_zeroprice_write>
|
| 35 |
+
<connection>
|
| 36 |
+
<use>core_write</use>
|
| 37 |
+
</connection>
|
| 38 |
+
</jalak_zeroprice_write>
|
| 39 |
+
<jalak_zeroprice_read>
|
| 40 |
+
<connection>
|
| 41 |
+
<use>core_read</use>
|
| 42 |
+
</connection>
|
| 43 |
+
</jalak_zeroprice_read>
|
| 44 |
+
</resources>
|
| 45 |
+
</global>
|
| 46 |
+
<frontend>
|
| 47 |
+
<layout>
|
| 48 |
+
<updates>
|
| 49 |
+
<jalak_zeroprice module="Jalak_Zeroprice">
|
| 50 |
+
<file>jalak_zeroprice.xml</file>
|
| 51 |
+
</jalak_zeroprice>
|
| 52 |
+
</updates>
|
| 53 |
+
</layout>
|
| 54 |
+
</frontend>
|
| 55 |
+
<admin>
|
| 56 |
+
<routers>
|
| 57 |
+
<jalak_zeroprice>
|
| 58 |
+
<use>admin</use>
|
| 59 |
+
<args>
|
| 60 |
+
<module>Jalak_Zeroprice</module>
|
| 61 |
+
<frontName>jalak_zeroprice</frontName>
|
| 62 |
+
</args>
|
| 63 |
+
</jalak_zeroprice>
|
| 64 |
+
</routers>
|
| 65 |
+
</admin>
|
| 66 |
+
<default>
|
| 67 |
+
<jalak_zeroprice>
|
| 68 |
+
<general>
|
| 69 |
+
<enabled>0</enabled>
|
| 70 |
+
<price_value>0</price_value>
|
| 71 |
+
<enabled_hide_cart>0</enabled_hide_cart>
|
| 72 |
+
</general>
|
| 73 |
+
</jalak_zeroprice>
|
| 74 |
+
</default>
|
| 75 |
+
</config>
|
app/code/community/Jalak/Zeroprice/etc/system.xml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<Jalak translate="label" module="jalak_zeroprice">
|
| 5 |
+
<label>Jalak Module</label>
|
| 6 |
+
<sort_order>200</sort_order>
|
| 7 |
+
</Jalak>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<jalak_zeroprice translate="label" module="jalak_zeroprice">
|
| 11 |
+
<label>Jalak Zeroprice</label>
|
| 12 |
+
<tab>Jalak</tab>
|
| 13 |
+
<frontend_type>text</frontend_type>
|
| 14 |
+
<sort_order>10</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 |
+
<general translate="label">
|
| 20 |
+
<label>General</label>
|
| 21 |
+
<frontend_type>text</frontend_type>
|
| 22 |
+
<sort_order>10</sort_order>
|
| 23 |
+
<show_in_default>1</show_in_default>
|
| 24 |
+
<show_in_website>1</show_in_website>
|
| 25 |
+
<show_in_store>1</show_in_store>
|
| 26 |
+
<fields>
|
| 27 |
+
<enabled translate="label">
|
| 28 |
+
<label>Enable Zeroprice Module</label>
|
| 29 |
+
<frontend_type>select</frontend_type>
|
| 30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 31 |
+
<comment><![CDATA[Enable module]]></comment>
|
| 32 |
+
<sort_order>10</sort_order>
|
| 33 |
+
<show_in_default>1</show_in_default>
|
| 34 |
+
<show_in_website>1</show_in_website>
|
| 35 |
+
<show_in_store>1</show_in_store>
|
| 36 |
+
</enabled>
|
| 37 |
+
<price_value translate="label comment tooltip">
|
| 38 |
+
<label>Price Value</label>
|
| 39 |
+
<frontend_type>text</frontend_type>
|
| 40 |
+
<comment><![CDATA[Hide price with condition value. <br />How it work: if `product price` less than and equal `price value` then `hide the product price` ]]></comment>
|
| 41 |
+
<show_in_default>1</show_in_default>
|
| 42 |
+
<show_in_website>1</show_in_website>
|
| 43 |
+
<sort_order>20</sort_order>
|
| 44 |
+
<validate>validate-number</validate>
|
| 45 |
+
</price_value>
|
| 46 |
+
<enabled_hide_cart translate="label">
|
| 47 |
+
<label>Enable Hide Add to Cart</label>
|
| 48 |
+
<frontend_type>select</frontend_type>
|
| 49 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 50 |
+
<comment><![CDATA[Enable hide add to cart button with condition value.]]></comment>
|
| 51 |
+
<sort_order>30</sort_order>
|
| 52 |
+
<show_in_default>1</show_in_default>
|
| 53 |
+
<show_in_website>1</show_in_website>
|
| 54 |
+
<show_in_store>1</show_in_store>
|
| 55 |
+
</enabled_hide_cart>
|
| 56 |
+
</fields>
|
| 57 |
+
</general>
|
| 58 |
+
</groups>
|
| 59 |
+
</jalak_zeroprice>
|
| 60 |
+
</sections>
|
| 61 |
+
</config>
|
app/design/frontend/base/default/layout/jalak_zeroprice.xml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<catalog_product_view>
|
| 4 |
+
<reference name="product.info.addtocart">
|
| 5 |
+
<action method="setTemplate">
|
| 6 |
+
<name>jalak_zeroprice/catalog/product/view/addtocart.phtml</name>
|
| 7 |
+
</action>
|
| 8 |
+
</reference>
|
| 9 |
+
</catalog_product_view>
|
| 10 |
+
|
| 11 |
+
<review_product_list>
|
| 12 |
+
<reference name="product.info.addtocart">
|
| 13 |
+
<action method="setTemplate">
|
| 14 |
+
<name>jalak_zeroprice/catalog/product/view/addtocart.phtml</name>
|
| 15 |
+
</action>
|
| 16 |
+
</reference>
|
| 17 |
+
</review_product_list>
|
| 18 |
+
|
| 19 |
+
<catalog_category_default>
|
| 20 |
+
<reference name="product_list">
|
| 21 |
+
<action method="setTemplate">
|
| 22 |
+
<name>jalak_zeroprice/catalog/product/list.phtml</name>
|
| 23 |
+
</action>
|
| 24 |
+
</reference>
|
| 25 |
+
</catalog_category_default>
|
| 26 |
+
|
| 27 |
+
<catalog_category_layered>
|
| 28 |
+
<reference name="product_list">
|
| 29 |
+
<action method="setTemplate">
|
| 30 |
+
<name>jalak_zeroprice/catalog/product/list.phtml</name>
|
| 31 |
+
</action>
|
| 32 |
+
</reference>
|
| 33 |
+
</catalog_category_layered>
|
| 34 |
+
|
| 35 |
+
<catalogsearch_result_index>
|
| 36 |
+
<reference name="search_result_list">
|
| 37 |
+
<action method="setTemplate">
|
| 38 |
+
<name>jalak_zeroprice/catalog/product/list.phtml</name>
|
| 39 |
+
</action>
|
| 40 |
+
</reference>
|
| 41 |
+
</catalogsearch_result_index>
|
| 42 |
+
</layout>
|
app/design/frontend/base/default/template/jalak_zeroprice/catalog/product/list.phtml
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Jalak
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Jalak
|
| 13 |
+
* @package Jalak_Zeroprice
|
| 14 |
+
* @author Hendrathings <hendrathings@gmail.com>
|
| 15 |
+
*/
|
| 16 |
+
/**
|
| 17 |
+
* Product list template
|
| 18 |
+
*
|
| 19 |
+
* @see Mage_Catalog_Block_Product_List
|
| 20 |
+
*/
|
| 21 |
+
$_productCollection = $this->getLoadedProductCollection();
|
| 22 |
+
$_helper = $this->helper('catalog/output');
|
| 23 |
+
$_zeroPriceHelper = Mage::helper('jalak_zeroprice');
|
| 24 |
+
?>
|
| 25 |
+
<?php if (!$_productCollection->count()): ?>
|
| 26 |
+
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
|
| 27 |
+
<?php else: ?>
|
| 28 |
+
<div class="category-products">
|
| 29 |
+
<?php echo $this->getToolbarHtml() ?>
|
| 30 |
+
<?php // List mode ?>
|
| 31 |
+
<?php if ($this->getMode() != 'grid'): ?>
|
| 32 |
+
<?php $_iterator = 0; ?>
|
| 33 |
+
<ol class="products-list" id="products-list">
|
| 34 |
+
<?php foreach ($_productCollection as $_product): ?>
|
| 35 |
+
<li class="item<?php if (++$_iterator == sizeof($_productCollection)): ?> last<?php endif; ?>">
|
| 36 |
+
<?php // Product Image ?>
|
| 37 |
+
<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>
|
| 38 |
+
<?php // Product description ?>
|
| 39 |
+
<div class="product-shop">
|
| 40 |
+
<div class="f-fix">
|
| 41 |
+
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
|
| 42 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?></a></h2>
|
| 43 |
+
<?php if ($_product->getRatingSummary()): ?>
|
| 44 |
+
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
| 45 |
+
<?php endif; ?>
|
| 46 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
| 47 |
+
|
| 48 |
+
<?php if ($_zeroPriceHelper->getCanAddToCart()): ?>
|
| 49 |
+
<?php if ($_product->isSaleable()): ?>
|
| 50 |
+
<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>
|
| 51 |
+
<?php else: ?>
|
| 52 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
| 53 |
+
<?php endif; ?>
|
| 54 |
+
<?php else: ?>
|
| 55 |
+
<?php if ($_product->price > $_zeroPriceHelper->priceValue()): ?>
|
| 56 |
+
<?php if ($_product->isSaleable()): ?>
|
| 57 |
+
<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>
|
| 58 |
+
<?php else: ?>
|
| 59 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
| 60 |
+
<?php endif; ?>
|
| 61 |
+
<?php endif; ?>
|
| 62 |
+
<?php endif; ?>
|
| 63 |
+
|
| 64 |
+
<div class="desc std">
|
| 65 |
+
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
|
| 66 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
|
| 67 |
+
</div>
|
| 68 |
+
<ul class="add-to-links">
|
| 69 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
| 70 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
| 71 |
+
<?php endif; ?>
|
| 72 |
+
<?php if ($_compareUrl = $this->getAddToCompareUrl($_product)): ?>
|
| 73 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
| 74 |
+
<?php endif; ?>
|
| 75 |
+
</ul>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
</li>
|
| 79 |
+
<?php endforeach; ?>
|
| 80 |
+
</ol>
|
| 81 |
+
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
|
| 82 |
+
|
| 83 |
+
<?php else: ?>
|
| 84 |
+
|
| 85 |
+
<?php // Grid Mode ?>
|
| 86 |
+
|
| 87 |
+
<?php $_collectionSize = $_productCollection->count() ?>
|
| 88 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
| 89 |
+
<?php
|
| 90 |
+
$i = 0;
|
| 91 |
+
foreach ($_productCollection as $_product):
|
| 92 |
+
?>
|
| 93 |
+
<?php if ($i++ % $_columnCount == 0): ?>
|
| 94 |
+
<ul class="products-grid">
|
| 95 |
+
<?php endif ?>
|
| 96 |
+
<li class="item<?php if (($i - 1) % $_columnCount == 0): ?> first<?php elseif ($i % $_columnCount == 0): ?> last<?php endif; ?>">
|
| 97 |
+
<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>
|
| 98 |
+
<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>
|
| 99 |
+
<?php if ($_product->getRatingSummary()): ?>
|
| 100 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
| 101 |
+
<?php endif; ?>
|
| 102 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
| 103 |
+
<div class="actions">
|
| 104 |
+
<?php if ($_zeroPriceHelper->getCanAddToCart()): ?>
|
| 105 |
+
<?php if ($_product->isSaleable()): ?>
|
| 106 |
+
<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>
|
| 107 |
+
<?php else: ?>
|
| 108 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
| 109 |
+
<?php endif; ?>
|
| 110 |
+
<?php else: ?>
|
| 111 |
+
<?php if ($_product->price > $_zeroPriceHelper->priceValue()): ?>
|
| 112 |
+
<?php if ($_product->isSaleable()): ?>
|
| 113 |
+
<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>
|
| 114 |
+
<?php else: ?>
|
| 115 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
| 116 |
+
<?php endif; ?>
|
| 117 |
+
<?php endif; ?>
|
| 118 |
+
<?php endif; ?>
|
| 119 |
+
<ul class="add-to-links">
|
| 120 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
| 121 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
| 122 |
+
<?php endif; ?>
|
| 123 |
+
<?php if ($_compareUrl = $this->getAddToCompareUrl($_product)): ?>
|
| 124 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
| 125 |
+
<?php endif; ?>
|
| 126 |
+
</ul>
|
| 127 |
+
</div>
|
| 128 |
+
</li>
|
| 129 |
+
<?php if ($i % $_columnCount == 0 || $i == $_collectionSize): ?>
|
| 130 |
+
</ul>
|
| 131 |
+
<?php endif ?>
|
| 132 |
+
<?php endforeach ?>
|
| 133 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd', 'even', 'first', 'last'])</script>
|
| 134 |
+
<?php endif; ?>
|
| 135 |
+
<div class="toolbar-bottom">
|
| 136 |
+
<?php echo $this->getToolbarHtml() ?>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/jalak_zeroprice/catalog/product/view/addtocart.phtml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Jalak
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
*
|
| 12 |
+
* @category Jalak
|
| 13 |
+
* @package Jalak_Zeroprice
|
| 14 |
+
* @author Hendrathings <hendrathings@gmail.com>
|
| 15 |
+
*/
|
| 16 |
+
$_zeroPriceHelper = Mage::helper('jalak_zeroprice');
|
| 17 |
+
?>
|
| 18 |
+
|
| 19 |
+
<?php $_product = $this->getProduct() ?>
|
| 20 |
+
<?php if ($_zeroPriceHelper->getCanAddToCart()): ?>
|
| 21 |
+
<?php if ($_product->isSaleable()): ?>
|
| 22 |
+
<div class="add-to-cart">
|
| 23 |
+
<?php if (!$_product->isGrouped()): ?>
|
| 24 |
+
<label for="qty"><?php echo $this->__('Qty:') ?></label>
|
| 25 |
+
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getMinimalQty($_product) ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
|
| 26 |
+
<?php endif; ?>
|
| 27 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
| 28 |
+
<?php echo $this->getChildHtml('', true, true) ?>
|
| 29 |
+
</div>
|
| 30 |
+
<?php endif; ?>
|
| 31 |
+
<?php else: ?>
|
| 32 |
+
<?php if ($_product->price > $_zeroPriceHelper->priceValue()): ?>
|
| 33 |
+
<div class="add-to-cart">
|
| 34 |
+
<?php if (!$_product->isGrouped()): ?>
|
| 35 |
+
<label for="qty"><?php echo $this->__('Qty:') ?></label>
|
| 36 |
+
<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getMinimalQty($_product) ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
|
| 37 |
+
<?php endif; ?>
|
| 38 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
| 39 |
+
<?php echo $this->getChildHtml('', true, true) ?>
|
| 40 |
+
</div>
|
| 41 |
+
<?php endif; ?>
|
| 42 |
+
<?php endif; ?>
|
| 43 |
+
|
| 44 |
+
|
app/etc/modules/Jalak_Zeroprice.xml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Jalak_Zeroprice>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<version>1.0.0</version>
|
| 8 |
+
</Jalak_Zeroprice>
|
| 9 |
+
</modules>
|
| 10 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Jalak_Zeroprice</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Hide price product and add to cart button with condition price value.</summary>
|
| 10 |
+
<description>Hide price product and add to cart button with condition price value.</description>
|
| 11 |
+
<notes>1.0.0 First Release</notes>
|
| 12 |
+
<authors><author><name>I Gusti Agung Mahendra Putra</name><user>hendrathings</user><email>hendrathings@gmail.com</email></author></authors>
|
| 13 |
+
<date>2014-04-25</date>
|
| 14 |
+
<time>08:26:45</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Jalak"><dir name="Zeroprice"><dir name="Block"><dir name="Rewrite"><dir name="Catalog"><dir name="Product"><file name="Price.php" hash="7d069d6c940c648aebc2e72256a47d95"/></dir></dir></dir></dir><file name="Exception.php" hash="fd6361fe33f604679d24fefeabb52d44"/><dir name="Helper"><file name="Data.php" hash="0c155c0e4c3bf45dc5bac6d2082548df"/></dir><dir name="etc"><file name="adminhtml.xml" hash="54bd1269e41f914cf8536fe54c5eec9d"/><file name="config.xml" hash="a40772b0261631d9294fecc62454f395"/><file name="system.xml" hash="ad0cf62b02eacbe06fdc690e179d0573"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="jalak_zeroprice.xml" hash="dc543646b7dba81031fce0f034031188"/></dir><dir name="template"><dir name="jalak_zeroprice"><dir name="catalog"><dir name="product"><file name="list.phtml" hash="c3c0b133f2a8d294798de5b166e1b067"/><dir name="view"><file name="addtocart.phtml" hash="f968d55e75894f650a195c1665ddb72e"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Jalak_Zeroprice.xml" hash="65ac2e77d3938c0cff55cf1c8cfe9370"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>comunity</channel><min>1.5.0.0</min><max>1.8.0.0</max></package></required></dependencies>
|
| 18 |
+
</package>
|
