Version Notes
Version 1.0.0
Download this release
Release Info
| Developer | Sulopa Sulotion |
| Extension | facebook-mag-ex |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/local/Sulopa/Fbfanbox/Block/Fbfanbox.php +40 -0
- app/code/local/Sulopa/Fbfanbox/Helper/Data.php +6 -0
- app/code/local/Sulopa/Fbfanbox/etc/adminhtml.xml +52 -0
- app/code/local/Sulopa/Fbfanbox/etc/config.xml +104 -0
- app/code/local/Sulopa/Fbfanbox/etc/system.xml +70 -0
- app/code/local/Sulopa/Fbfanbox/sql/fbfanbox_setup/mysql4-install-0.1.0.php +23 -0
- app/code/local/Sulopa/Featuredproduct/Block/Featuredproduct.php +62 -0
- app/code/local/Sulopa/Featuredproduct/Helper/Data.php +6 -0
- app/code/local/Sulopa/Featuredproduct/Model/Config/Direction.php +13 -0
- app/code/local/Sulopa/Featuredproduct/Model/Config/Sort.php +13 -0
- app/code/local/Sulopa/Featuredproduct/etc/adminhtml.xml +33 -0
- app/code/local/Sulopa/Featuredproduct/etc/config.xml +143 -0
- app/code/local/Sulopa/Featuredproduct/etc/system.xml +208 -0
- app/code/local/Sulopa/Featuredproduct/sql/featuredproduct_setup/mysql4-install-0.1.0.php +11 -0
- app/code/local/Sulopa/Newssubscribers/Block/Newssubscribers.php +39 -0
- app/code/local/Sulopa/Newssubscribers/Helper/Data.php +6 -0
- app/code/local/Sulopa/Newssubscribers/Model/Subscriber.php +34 -0
- app/code/local/Sulopa/Newssubscribers/Model/System/Config/Coupon.php +13 -0
- app/code/local/Sulopa/Newssubscribers/Model/System/Config/Couponlist.php +19 -0
- app/code/local/Sulopa/Newssubscribers/Model/System/Config/Template.php +12 -0
- app/code/local/Sulopa/Newssubscribers/controllers/SubscriberController.php +64 -0
- app/code/local/Sulopa/Newssubscribers/etc/adminhtml.xml +23 -0
- app/code/local/Sulopa/Newssubscribers/etc/config.xml +95 -0
- app/code/local/Sulopa/Newssubscribers/etc/system.xml +154 -0
- app/code/local/Sulopa/Producttabs/Block/Adminhtml/Edit.php +69 -0
- app/code/local/Sulopa/Producttabs/Block/Adminhtml/Edit/Grid.php +218 -0
- app/code/local/Sulopa/Producttabs/Block/Adminhtml/Edit/Renderer/Visibility.php +17 -0
- app/code/local/Sulopa/Producttabs/Block/Product/List.php +249 -0
- app/code/local/Sulopa/Producttabs/Block/Producttabs.php +61 -0
- app/code/local/Sulopa/Producttabs/Helper/Data.php +14 -0
- app/code/local/Sulopa/Producttabs/Model/Resource/Product/Bestseller.php +73 -0
- app/code/local/Sulopa/Producttabs/Model/System/Config/Action.php +17 -0
- app/code/local/Sulopa/Producttabs/Model/System/Config/Sort.php +11 -0
- app/code/local/Sulopa/Producttabs/Model/System/Config/Type.php +15 -0
- app/code/local/Sulopa/Producttabs/controllers/Adminhtml/FeaturedController.php +56 -0
- app/code/local/Sulopa/Producttabs/controllers/IndexController.php +12 -0
- app/code/local/Sulopa/Producttabs/etc/adminhtml.xml +22 -0
- app/code/local/Sulopa/Producttabs/etc/config.xml +138 -0
- app/code/local/Sulopa/Producttabs/etc/system.xml +196 -0
- app/code/local/Sulopa/Producttabs/sql/producttabs_setup/mysql4-install-0.1.0.php +26 -0
- app/etc/modules/Sulopa_Fbfanbox.xml +9 -0
- js/tinybox/tinybox.js +126 -0
- package.xml +18 -0
app/code/local/Sulopa/Fbfanbox/Block/Fbfanbox.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Fbfanbox_Block_Fbfanbox extends Mage_Core_Block_Template
|
| 3 |
+
{
|
| 4 |
+
public function _prepareLayout()
|
| 5 |
+
{
|
| 6 |
+
return parent::_prepareLayout();
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
public function getFbfanbox()
|
| 10 |
+
{
|
| 11 |
+
if (!$this->hasData('fbfanbox')) {
|
| 12 |
+
$fbfanbox = array();
|
| 13 |
+
|
| 14 |
+
$enable = Mage::getStoreConfig('fbfanbox/general/enable');
|
| 15 |
+
$fb_page_url = Mage::getStoreConfig('fbfanbox/general/fb_page_url');
|
| 16 |
+
$box_width = Mage::getStoreConfig('fbfanbox/general/box_width');
|
| 17 |
+
$box_height = Mage::getStoreConfig('fbfanbox/general/box_height');
|
| 18 |
+
$connection = Mage::getStoreConfig('fbfanbox/general/connection');
|
| 19 |
+
$stream = Mage::getStoreConfig('fbfanbox/general/stream');
|
| 20 |
+
$header = Mage::getStoreConfig('fbfanbox/general/header');
|
| 21 |
+
|
| 22 |
+
if(!$connection)
|
| 23 |
+
{
|
| 24 |
+
$connection = 10;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
$fbfanbox['enable'] =$enable;
|
| 28 |
+
$fbfanbox['fb_page_url'] = $fb_page_url;
|
| 29 |
+
$fbfanbox['box_width'] =$box_width;
|
| 30 |
+
$fbfanbox['box_height'] =$box_height;
|
| 31 |
+
$fbfanbox['connection'] =$connection;
|
| 32 |
+
$fbfanbox['stream'] =$stream;
|
| 33 |
+
$fbfanbox['header'] =$header;
|
| 34 |
+
|
| 35 |
+
$this->setData('fbfanbox', $fbfanbox);
|
| 36 |
+
}
|
| 37 |
+
return $this->getData('fbfanbox');
|
| 38 |
+
|
| 39 |
+
}
|
| 40 |
+
}
|
app/code/local/Sulopa/Fbfanbox/Helper/Data.php
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Sulopa_Fbfanbox_Helper_Data extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
}
|
app/code/local/Sulopa/Fbfanbox/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<menu>
|
| 4 |
+
<sulopa>
|
| 5 |
+
<title>Sulopa Extension</title>
|
| 6 |
+
<sort_order>71</sort_order>
|
| 7 |
+
<children>
|
| 8 |
+
<fbfanbox module="fbfanbox">
|
| 9 |
+
<title>Fbfanbox</title>
|
| 10 |
+
<sort_order>71</sort_order>
|
| 11 |
+
<children>
|
| 12 |
+
<items module="fbfanbox">
|
| 13 |
+
<title>FbFanBox Setting </title>
|
| 14 |
+
<sort_order>0</sort_order>
|
| 15 |
+
<action>adminhtml/system_config/edit/section/fbfanbox</action>
|
| 16 |
+
</items>
|
| 17 |
+
</children>
|
| 18 |
+
</fbfanbox>
|
| 19 |
+
</children>
|
| 20 |
+
</sulopa>
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
</menu>
|
| 24 |
+
|
| 25 |
+
<acl>
|
| 26 |
+
<resources>
|
| 27 |
+
<all>
|
| 28 |
+
<title>Allow Everything</title>
|
| 29 |
+
</all>
|
| 30 |
+
<admin>
|
| 31 |
+
<children>
|
| 32 |
+
<system>
|
| 33 |
+
<children>
|
| 34 |
+
<config>
|
| 35 |
+
<children>
|
| 36 |
+
<fbfanbox translate="title">
|
| 37 |
+
<title>FBFanBox</title>
|
| 38 |
+
<sort_order>50</sort_order>
|
| 39 |
+
</fbfanbox>
|
| 40 |
+
</children>
|
| 41 |
+
</config>
|
| 42 |
+
</children>
|
| 43 |
+
</system>
|
| 44 |
+
<Sulopa_Fbfanbox>
|
| 45 |
+
<title>Fbfanbox Module</title>
|
| 46 |
+
<sort_order>10</sort_order>
|
| 47 |
+
</Sulopa_Fbfanbox>
|
| 48 |
+
</children>
|
| 49 |
+
</admin>
|
| 50 |
+
</resources>
|
| 51 |
+
</acl>
|
| 52 |
+
</config>
|
app/code/local/Sulopa/Fbfanbox/etc/config.xml
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<default>
|
| 4 |
+
<fbfanbox>
|
| 5 |
+
<general>
|
| 6 |
+
<enable>1</enable>
|
| 7 |
+
<fb_page_url><![CDATA[https://www.facebook.com/sulopastore]]></fb_page_url>
|
| 8 |
+
<header>1</header>
|
| 9 |
+
<box_width>292</box_width>
|
| 10 |
+
<connection>10</connection>
|
| 11 |
+
</general>
|
| 12 |
+
|
| 13 |
+
</fbfanbox>
|
| 14 |
+
</default>
|
| 15 |
+
<modules>
|
| 16 |
+
<Sulopa_Fbfanbox>
|
| 17 |
+
<version>0.1.2</version>
|
| 18 |
+
</Sulopa_Fbfanbox>
|
| 19 |
+
</modules>
|
| 20 |
+
<frontend>
|
| 21 |
+
<routers>
|
| 22 |
+
<fbfanbox>
|
| 23 |
+
<use>standard</use>
|
| 24 |
+
<args>
|
| 25 |
+
<module>Sulopa_Fbfanbox</module>
|
| 26 |
+
<frontName>fbfanbox</frontName>
|
| 27 |
+
</args>
|
| 28 |
+
</fbfanbox>
|
| 29 |
+
</routers>
|
| 30 |
+
<layout>
|
| 31 |
+
<updates>
|
| 32 |
+
<fbfanbox>
|
| 33 |
+
<file>fbfanbox.xml</file>
|
| 34 |
+
</fbfanbox>
|
| 35 |
+
</updates>
|
| 36 |
+
</layout>
|
| 37 |
+
</frontend>
|
| 38 |
+
<admin>
|
| 39 |
+
<routers>
|
| 40 |
+
<fbfanbox>
|
| 41 |
+
<use>admin</use>
|
| 42 |
+
<args>
|
| 43 |
+
<module>Sulopa_Fbfanbox</module>
|
| 44 |
+
<frontName>fbfanbox</frontName>
|
| 45 |
+
</args>
|
| 46 |
+
</fbfanbox>
|
| 47 |
+
</routers>
|
| 48 |
+
</admin>
|
| 49 |
+
<adminhtml>
|
| 50 |
+
<layout>
|
| 51 |
+
<updates>
|
| 52 |
+
<fbfanbox>
|
| 53 |
+
<file>fbfanbox.xml</file>
|
| 54 |
+
</fbfanbox>
|
| 55 |
+
</updates>
|
| 56 |
+
</layout>
|
| 57 |
+
</adminhtml>
|
| 58 |
+
<global>
|
| 59 |
+
<models>
|
| 60 |
+
<fbfanbox>
|
| 61 |
+
<class>Sulopa_Fbfanbox_Model</class>
|
| 62 |
+
<resourceModel>fbfanbox_mysql4</resourceModel>
|
| 63 |
+
</fbfanbox>
|
| 64 |
+
<fbfanbox_mysql4>
|
| 65 |
+
<class>Sulopa_Fbfanbox_Model_Mysql4</class>
|
| 66 |
+
<entities>
|
| 67 |
+
<fbfanbox>
|
| 68 |
+
<table>fbfanbox</table>
|
| 69 |
+
</fbfanbox>
|
| 70 |
+
</entities>
|
| 71 |
+
</fbfanbox_mysql4>
|
| 72 |
+
</models>
|
| 73 |
+
<resources>
|
| 74 |
+
<fbfanbox_setup>
|
| 75 |
+
<setup>
|
| 76 |
+
<module>Sulopa_Fbfanbox</module>
|
| 77 |
+
</setup>
|
| 78 |
+
<connection>
|
| 79 |
+
<use>core_setup</use>
|
| 80 |
+
</connection>
|
| 81 |
+
</fbfanbox_setup>
|
| 82 |
+
<fbfanbox_write>
|
| 83 |
+
<connection>
|
| 84 |
+
<use>core_write</use>
|
| 85 |
+
</connection>
|
| 86 |
+
</fbfanbox_write>
|
| 87 |
+
<fbfanbox_read>
|
| 88 |
+
<connection>
|
| 89 |
+
<use>core_read</use>
|
| 90 |
+
</connection>
|
| 91 |
+
</fbfanbox_read>
|
| 92 |
+
</resources>
|
| 93 |
+
<blocks>
|
| 94 |
+
<fbfanbox>
|
| 95 |
+
<class>Sulopa_Fbfanbox_Block</class>
|
| 96 |
+
</fbfanbox>
|
| 97 |
+
</blocks>
|
| 98 |
+
<helpers>
|
| 99 |
+
<fbfanbox>
|
| 100 |
+
<class>Sulopa_Fbfanbox_Helper</class>
|
| 101 |
+
</fbfanbox>
|
| 102 |
+
</helpers>
|
| 103 |
+
</global>
|
| 104 |
+
</config>
|
app/code/local/Sulopa/Fbfanbox/etc/system.xml
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<sulopa translate="label">
|
| 5 |
+
<label>Sulopa Extension</label>
|
| 6 |
+
<sort_order>400</sort_order>
|
| 7 |
+
</sulopa>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<fbfanbox translate="label" module="fbfanbox">
|
| 11 |
+
<class>separator-top</class>
|
| 12 |
+
<label>FBFanBox</label>
|
| 13 |
+
<tab>sulopa</tab>
|
| 14 |
+
<frontend_type>text</frontend_type>
|
| 15 |
+
<sort_order>300</sort_order>
|
| 16 |
+
<show_in_default>1</show_in_default>
|
| 17 |
+
<show_in_website>1</show_in_website>
|
| 18 |
+
<show_in_store>1</show_in_store>
|
| 19 |
+
<groups> <general translate="label"> <label>FBFanBox Configuration</label> <frontend_type>text</frontend_type> <sort_order>1</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> <fields>
|
| 20 |
+
<enable translate="label">
|
| 21 |
+
<label>Enable FBFanBox</label>
|
| 22 |
+
<frontend_type>select</frontend_type>
|
| 23 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 24 |
+
<sort_order>1</sort_order>
|
| 25 |
+
<show_in_default>1</show_in_default>
|
| 26 |
+
<show_in_website>1</show_in_website>
|
| 27 |
+
<show_in_store>1</show_in_store>
|
| 28 |
+
</enable> <fb_page_url translate="label"> <label>Facebook Page URL</label> <frontend_type>text</frontend_type> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <comment></comment> </fb_page_url> <box_width translate="label"> <label>Width of the box in pixel</label> <frontend_type>text</frontend_type> <sort_order>3</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <comment>Width of the box in pixel</comment> </box_width>
|
| 29 |
+
<box_height translate="label">
|
| 30 |
+
<label>Height of the box in pixel</label>
|
| 31 |
+
<frontend_type>text</frontend_type>
|
| 32 |
+
<sort_order>4</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 |
+
<comment>Height of the box in pixel</comment>
|
| 37 |
+
</box_height>
|
| 38 |
+
<connection translate="label">
|
| 39 |
+
<label>Connections</label>
|
| 40 |
+
<frontend_type>text</frontend_type>
|
| 41 |
+
<sort_order>5</sort_order>
|
| 42 |
+
<show_in_default>1</show_in_default>
|
| 43 |
+
<show_in_website>1</show_in_website>
|
| 44 |
+
<show_in_store>1</show_in_store>
|
| 45 |
+
<comment>Show a sample of this many users who have liked this page</comment>
|
| 46 |
+
</connection>
|
| 47 |
+
<stream translate="label">
|
| 48 |
+
<label>Streams</label>
|
| 49 |
+
<frontend_type>select</frontend_type>
|
| 50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 51 |
+
<sort_order>6</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 |
+
<comment>Show the profile stream for the public profile</comment>
|
| 56 |
+
</stream>
|
| 57 |
+
<header translate="label">
|
| 58 |
+
<label>Header</label>
|
| 59 |
+
<frontend_type>select</frontend_type>
|
| 60 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 61 |
+
<sort_order>7</sort_order>
|
| 62 |
+
<show_in_default>1</show_in_default>
|
| 63 |
+
<show_in_website>1</show_in_website>
|
| 64 |
+
<show_in_store>1</show_in_store>
|
| 65 |
+
<comment>Show the 'find us on Facebook' bar at top</comment>
|
| 66 |
+
</header> </fields> </general>
|
| 67 |
+
</groups>
|
| 68 |
+
</fbfanbox>
|
| 69 |
+
</sections>
|
| 70 |
+
</config>
|
app/code/local/Sulopa/Fbfanbox/sql/fbfanbox_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
|
| 9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('fbfanbox')};
|
| 10 |
+
CREATE TABLE {$this->getTable('fbfanbox')} (
|
| 11 |
+
`fbfanbox_id` int(11) unsigned NOT NULL auto_increment,
|
| 12 |
+
`title` varchar(255) NOT NULL default '',
|
| 13 |
+
`filename` varchar(255) NOT NULL default '',
|
| 14 |
+
`content` text NOT NULL default '',
|
| 15 |
+
`status` smallint(6) NOT NULL default '0',
|
| 16 |
+
`created_time` datetime NULL,
|
| 17 |
+
`update_time` datetime NULL,
|
| 18 |
+
PRIMARY KEY (`fbfanbox_id`)
|
| 19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| 20 |
+
|
| 21 |
+
");
|
| 22 |
+
|
| 23 |
+
$installer->endSetup();
|
app/code/local/Sulopa/Featuredproduct/Block/Featuredproduct.php
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Featuredproduct_Block_Featuredproduct extends Mage_Catalog_Block_Product_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function _prepareLayout()
|
| 5 |
+
{
|
| 6 |
+
return parent::_prepareLayout();
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
public function getFeaturedproduct()
|
| 10 |
+
{
|
| 11 |
+
if (!$this->hasData('featuredproduct')) {
|
| 12 |
+
$this->setData('featuredproduct', Mage::registry('featuredproduct'));
|
| 13 |
+
}
|
| 14 |
+
return $this->getData('featuredproduct');
|
| 15 |
+
}
|
| 16 |
+
public function getProducts()
|
| 17 |
+
{
|
| 18 |
+
$_rootcatID = Mage::app()->getStore()->getRootCategoryId();
|
| 19 |
+
$storeId = Mage::app()->getStore()->getId();
|
| 20 |
+
$products = Mage::getResourceModel('catalog/product_collection')
|
| 21 |
+
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
| 22 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
| 23 |
+
->addMinimalPrice()
|
| 24 |
+
->addUrlRewrite()
|
| 25 |
+
->addTaxPercents()
|
| 26 |
+
->addStoreFilter()
|
| 27 |
+
->addAttributeToFilter('category_id', array('in' => $_rootcatID))
|
| 28 |
+
->addFieldToFilter(array(
|
| 29 |
+
array('attribute'=>'featured','eq'=>'1'),
|
| 30 |
+
));
|
| 31 |
+
|
| 32 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
| 33 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
| 34 |
+
$products->setPageSize($this->getConfig('qty'))->setCurPage(1);
|
| 35 |
+
$this->setProductCollection($products);
|
| 36 |
+
}
|
| 37 |
+
public function getConfig($att)
|
| 38 |
+
{
|
| 39 |
+
$config = Mage::getStoreConfig('featuredproduct');
|
| 40 |
+
if (isset($config['featuredproduct_config']) ) {
|
| 41 |
+
$value = $config['featuredproduct_config'][$att];
|
| 42 |
+
return $value;
|
| 43 |
+
} else {
|
| 44 |
+
throw new Exception($att.' value not set');
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
function cut_string_featuredproduct($string,$number){
|
| 49 |
+
if(strlen($string) <= $number) {
|
| 50 |
+
return $string;
|
| 51 |
+
}
|
| 52 |
+
else {
|
| 53 |
+
if(strpos($string," ",$number) > $number){
|
| 54 |
+
$new_space = strpos($string," ",$number);
|
| 55 |
+
$new_string = substr($string,0,$new_space)."..";
|
| 56 |
+
return $new_string;
|
| 57 |
+
}
|
| 58 |
+
$new_string = substr($string,0,$number)."..";
|
| 59 |
+
return $new_string;
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
}
|
app/code/local/Sulopa/Featuredproduct/Helper/Data.php
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Sulopa_Featuredproduct_Helper_Data extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
}
|
app/code/local/Sulopa/Featuredproduct/Model/Config/Direction.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Featuredproduct_Model_Config_Direction
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array('value'=>'asc', 'label'=>Mage::helper('adminhtml')->__('Ascending')),
|
| 9 |
+
array('value'=>'desc', 'label'=>Mage::helper('adminhtml')->__('Descending'))
|
| 10 |
+
);
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
}
|
app/code/local/Sulopa/Featuredproduct/Model/Config/Sort.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Featuredproduct_Model_Config_Sort
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array('value'=>'name', 'label'=>Mage::helper('adminhtml')->__('Name')),
|
| 9 |
+
array('value'=>'price', 'label'=>Mage::helper('adminhtml')->__('Price'))
|
| 10 |
+
);
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
}
|
app/code/local/Sulopa/Featuredproduct/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<acl>
|
| 4 |
+
<resources>
|
| 5 |
+
<admin>
|
| 6 |
+
<children>
|
| 7 |
+
<system>
|
| 8 |
+
<children>
|
| 9 |
+
<config>
|
| 10 |
+
<children>
|
| 11 |
+
<featuredproduct>
|
| 12 |
+
<title>Featured Products</title>
|
| 13 |
+
</featuredproduct>
|
| 14 |
+
</children>
|
| 15 |
+
</config>
|
| 16 |
+
</children>
|
| 17 |
+
</system>
|
| 18 |
+
<sulopa translate="title" module="featuredproduct">
|
| 19 |
+
<title>Sulopa Store</title>
|
| 20 |
+
<sort_order>71</sort_order>
|
| 21 |
+
<children>
|
| 22 |
+
<featuredproduct translate="title" module="featuredproduct">
|
| 23 |
+
<title>Featured Products Slider</title>
|
| 24 |
+
<sort_order>0</sort_order>
|
| 25 |
+
<action>adminhtml/system_config/edit/section/featuredproduct</action>
|
| 26 |
+
</featuredproduct>
|
| 27 |
+
</children>
|
| 28 |
+
</sulopa>
|
| 29 |
+
</children>
|
| 30 |
+
</admin>
|
| 31 |
+
</resources>
|
| 32 |
+
</acl>
|
| 33 |
+
</config>
|
app/code/local/Sulopa/Featuredproduct/etc/config.xml
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Sulopa_Featuredproduct>
|
| 5 |
+
<version>1.1.3</version>
|
| 6 |
+
</Sulopa_Featuredproduct>
|
| 7 |
+
</modules>
|
| 8 |
+
<frontend>
|
| 9 |
+
<routers>
|
| 10 |
+
<featuredproduct>
|
| 11 |
+
<use>standard</use>
|
| 12 |
+
<args>
|
| 13 |
+
<module>Sulopa_Featuredproduct</module>
|
| 14 |
+
<frontName>featuredproduct</frontName>
|
| 15 |
+
</args>
|
| 16 |
+
</featuredproduct>
|
| 17 |
+
</routers>
|
| 18 |
+
<layout>
|
| 19 |
+
<updates>
|
| 20 |
+
<featuredproduct>
|
| 21 |
+
<file>featuredproduct.xml</file>
|
| 22 |
+
</featuredproduct>
|
| 23 |
+
</updates>
|
| 24 |
+
</layout>
|
| 25 |
+
</frontend>
|
| 26 |
+
<admin>
|
| 27 |
+
<routers>
|
| 28 |
+
<featuredproduct>
|
| 29 |
+
<use>admin</use>
|
| 30 |
+
<args>
|
| 31 |
+
<module>Sulopa_Featuredproduct</module>
|
| 32 |
+
<frontName>featuredproduct</frontName>
|
| 33 |
+
</args>
|
| 34 |
+
</featuredproduct>
|
| 35 |
+
</routers>
|
| 36 |
+
</admin>
|
| 37 |
+
<adminhtml>
|
| 38 |
+
<menu>
|
| 39 |
+
<sulopa translate="title" module="featuredproduct">
|
| 40 |
+
<title>Sulopa Store</title>
|
| 41 |
+
<sort_order>71</sort_order>
|
| 42 |
+
<children>
|
| 43 |
+
<featuredproduct translate="title" module="featuredproduct">
|
| 44 |
+
<title>Featured Products</title>
|
| 45 |
+
<sort_order>0</sort_order>
|
| 46 |
+
<action>adminhtml/system_config/edit/section/featuredproduct</action>
|
| 47 |
+
</featuredproduct>
|
| 48 |
+
</children>
|
| 49 |
+
</sulopa>
|
| 50 |
+
</menu>
|
| 51 |
+
<acl>
|
| 52 |
+
<resources>
|
| 53 |
+
<all>
|
| 54 |
+
<title>Allow Everything</title>
|
| 55 |
+
</all>
|
| 56 |
+
<admin>
|
| 57 |
+
<children>
|
| 58 |
+
<Sulopa_Featuredproduct>
|
| 59 |
+
<title>Featuredproduct Module</title>
|
| 60 |
+
<sort_order>10</sort_order>
|
| 61 |
+
</Sulopa_Featuredproduct>
|
| 62 |
+
</children>
|
| 63 |
+
</admin>
|
| 64 |
+
</resources>
|
| 65 |
+
</acl>
|
| 66 |
+
<layout>
|
| 67 |
+
<updates>
|
| 68 |
+
<featuredproduct>
|
| 69 |
+
<file>featuredproduct.xml</file>
|
| 70 |
+
</featuredproduct>
|
| 71 |
+
</updates>
|
| 72 |
+
</layout>
|
| 73 |
+
</adminhtml>
|
| 74 |
+
<global>
|
| 75 |
+
<models>
|
| 76 |
+
<featuredproduct>
|
| 77 |
+
<class>Sulopa_Featuredproduct_Model</class>
|
| 78 |
+
<resourceModel>featuredproduct_mysql4</resourceModel>
|
| 79 |
+
</featuredproduct>
|
| 80 |
+
<featuredproduct_mysql4>
|
| 81 |
+
<class>Sulopa_Featuredproduct_Model_Mysql4</class>
|
| 82 |
+
<entities>
|
| 83 |
+
<featuredproduct>
|
| 84 |
+
<table>featuredproduct</table>
|
| 85 |
+
</featuredproduct>
|
| 86 |
+
</entities>
|
| 87 |
+
</featuredproduct_mysql4>
|
| 88 |
+
</models>
|
| 89 |
+
<resources>
|
| 90 |
+
<featuredproduct_setup>
|
| 91 |
+
<setup>
|
| 92 |
+
<module>Sulopa_Featuredproduct</module>
|
| 93 |
+
</setup>
|
| 94 |
+
<connection>
|
| 95 |
+
<use>core_setup</use>
|
| 96 |
+
</connection>
|
| 97 |
+
</featuredproduct_setup>
|
| 98 |
+
<featuredproduct_write>
|
| 99 |
+
<connection>
|
| 100 |
+
<use>core_write</use>
|
| 101 |
+
</connection>
|
| 102 |
+
</featuredproduct_write>
|
| 103 |
+
<featuredproduct_read>
|
| 104 |
+
<connection>
|
| 105 |
+
<use>core_read</use>
|
| 106 |
+
</connection>
|
| 107 |
+
</featuredproduct_read>
|
| 108 |
+
</resources>
|
| 109 |
+
<blocks>
|
| 110 |
+
<featuredproduct>
|
| 111 |
+
<class>Sulopa_Featuredproduct_Block</class>
|
| 112 |
+
</featuredproduct>
|
| 113 |
+
</blocks>
|
| 114 |
+
<helpers>
|
| 115 |
+
<featuredproduct>
|
| 116 |
+
<class>Sulopa_Featuredproduct_Helper</class>
|
| 117 |
+
</featuredproduct>
|
| 118 |
+
</helpers>
|
| 119 |
+
</global>
|
| 120 |
+
<default>
|
| 121 |
+
<featuredproduct>
|
| 122 |
+
<featuredproduct_config>
|
| 123 |
+
<enabled>1</enabled>
|
| 124 |
+
<title>Featured Product</title>
|
| 125 |
+
<auto>0</auto>
|
| 126 |
+
<speed>3000</speed>
|
| 127 |
+
<show_price>1</show_price>
|
| 128 |
+
<addtocart>1</addtocart>
|
| 129 |
+
<addtowishlist>0</addtowishlist>
|
| 130 |
+
<addtocompare>0</addtocompare>
|
| 131 |
+
<review>0</review>
|
| 132 |
+
<description>0</description>
|
| 133 |
+
<maxlength></maxlength>
|
| 134 |
+
<qty>9</qty>
|
| 135 |
+
<items_show>4</items_show>
|
| 136 |
+
<width_thumbnail>270</width_thumbnail>
|
| 137 |
+
<height_thumbnail>320</height_thumbnail>
|
| 138 |
+
<next_back>1</next_back>
|
| 139 |
+
<nav_ctrl>0</nav_ctrl>
|
| 140 |
+
</featuredproduct_config>
|
| 141 |
+
</featuredproduct>
|
| 142 |
+
</default>
|
| 143 |
+
</config>
|
app/code/local/Sulopa/Featuredproduct/etc/system.xml
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<sulopa translate="label" module="featuredproduct">
|
| 5 |
+
<label>Sulopa Store</label>
|
| 6 |
+
<sort_order>205</sort_order>
|
| 7 |
+
</sulopa>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<featuredproduct translate="label" module="featuredproduct">
|
| 11 |
+
<label>Featured Product Slider</label>
|
| 12 |
+
<tab>sulopa</tab>
|
| 13 |
+
<sort_order>138</sort_order>
|
| 14 |
+
<show_in_default>1</show_in_default>
|
| 15 |
+
<show_in_website>1</show_in_website>
|
| 16 |
+
<show_in_store>1</show_in_store>
|
| 17 |
+
<groups>
|
| 18 |
+
<featuredproduct_config translate="label">
|
| 19 |
+
<label>Featured Product Slider Config</label>
|
| 20 |
+
<frontend_type>text</frontend_type>
|
| 21 |
+
<sort_order>1</sort_order>
|
| 22 |
+
<show_in_default>1</show_in_default>
|
| 23 |
+
<show_in_website>1</show_in_website>
|
| 24 |
+
<show_in_store>1</show_in_store>
|
| 25 |
+
<fields>
|
| 26 |
+
<enabled translate="label comment">
|
| 27 |
+
<label>Enabled: </label>
|
| 28 |
+
<frontend_type>select</frontend_type>
|
| 29 |
+
<source_model>
|
| 30 |
+
adminhtml/system_config_source_yesno
|
| 31 |
+
</source_model>
|
| 32 |
+
<sort_order>0</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 |
+
<auto translate="label comment">
|
| 38 |
+
<label>Auto slide: </label>
|
| 39 |
+
<frontend_type>select</frontend_type>
|
| 40 |
+
<source_model>
|
| 41 |
+
adminhtml/system_config_source_yesno
|
| 42 |
+
</source_model>
|
| 43 |
+
<sort_order>1</sort_order>
|
| 44 |
+
<show_in_default>1</show_in_default>
|
| 45 |
+
<show_in_website>1</show_in_website>
|
| 46 |
+
<show_in_store>1</show_in_store>
|
| 47 |
+
</auto>
|
| 48 |
+
<title translate="label">
|
| 49 |
+
<label>Title: </label>
|
| 50 |
+
<frontend_type>text</frontend_type>
|
| 51 |
+
<sort_order>2</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 |
+
</title>
|
| 56 |
+
<speed translate="label">
|
| 57 |
+
<label>Slideshow Speed: </label>
|
| 58 |
+
<frontend_type>text</frontend_type>
|
| 59 |
+
<sort_order>16></sort_order>
|
| 60 |
+
<show_in_default>1</show_in_default>
|
| 61 |
+
<show_in_store>1</show_in_store>
|
| 62 |
+
<show_in_website>1</show_in_website>
|
| 63 |
+
</speed>
|
| 64 |
+
<show_price translate="label comment">
|
| 65 |
+
<label>Show Price: </label>
|
| 66 |
+
<frontend_type>select</frontend_type>
|
| 67 |
+
<source_model>
|
| 68 |
+
adminhtml/system_config_source_yesno
|
| 69 |
+
</source_model>
|
| 70 |
+
<sort_order>18</sort_order>
|
| 71 |
+
<show_in_default>1</show_in_default>
|
| 72 |
+
<show_in_website>1</show_in_website>
|
| 73 |
+
<show_in_store>1</show_in_store>
|
| 74 |
+
</show_price>
|
| 75 |
+
<addtocart translate="label comment">
|
| 76 |
+
<label>Show Add To Cart: </label>
|
| 77 |
+
<frontend_type>select</frontend_type>
|
| 78 |
+
<source_model>
|
| 79 |
+
adminhtml/system_config_source_yesno
|
| 80 |
+
</source_model>
|
| 81 |
+
<sort_order>19</sort_order>
|
| 82 |
+
<show_in_default>1</show_in_default>
|
| 83 |
+
<show_in_website>1</show_in_website>
|
| 84 |
+
<show_in_store>1</show_in_store>
|
| 85 |
+
</addtocart>
|
| 86 |
+
<addtowishlist translate="label comment">
|
| 87 |
+
<label>Show Add To Wishlist: </label>
|
| 88 |
+
<frontend_type>select</frontend_type>
|
| 89 |
+
<source_model>
|
| 90 |
+
adminhtml/system_config_source_yesno
|
| 91 |
+
</source_model>
|
| 92 |
+
<sort_order>20</sort_order>
|
| 93 |
+
<show_in_default>1</show_in_default>
|
| 94 |
+
<show_in_website>1</show_in_website>
|
| 95 |
+
<show_in_store>1</show_in_store>
|
| 96 |
+
</addtowishlist>
|
| 97 |
+
<addtocompare translate="label comment">
|
| 98 |
+
<label>Show Add To Compare: </label>
|
| 99 |
+
<frontend_type>select</frontend_type>
|
| 100 |
+
<source_model>
|
| 101 |
+
adminhtml/system_config_source_yesno
|
| 102 |
+
</source_model>
|
| 103 |
+
<sort_order>21</sort_order>
|
| 104 |
+
<show_in_default>1</show_in_default>
|
| 105 |
+
<show_in_website>1</show_in_website>
|
| 106 |
+
<show_in_store>1</show_in_store>
|
| 107 |
+
</addtocompare>
|
| 108 |
+
<review translate="label comment">
|
| 109 |
+
<label>Show Review Rating: </label>
|
| 110 |
+
<frontend_type>select</frontend_type>
|
| 111 |
+
<source_model>
|
| 112 |
+
adminhtml/system_config_source_yesno
|
| 113 |
+
</source_model>
|
| 114 |
+
<sort_order>22</sort_order>
|
| 115 |
+
<show_in_default>1</show_in_default>
|
| 116 |
+
<show_in_website>1</show_in_website>
|
| 117 |
+
<show_in_store>1</show_in_store>
|
| 118 |
+
</review>
|
| 119 |
+
<description translate="label comment">
|
| 120 |
+
<label>Show Short Description: </label>
|
| 121 |
+
<frontend_type>select</frontend_type>
|
| 122 |
+
<source_model>
|
| 123 |
+
adminhtml/system_config_source_yesno
|
| 124 |
+
</source_model>
|
| 125 |
+
<sort_order>23</sort_order>
|
| 126 |
+
<show_in_default>1</show_in_default>
|
| 127 |
+
<show_in_website>1</show_in_website>
|
| 128 |
+
<show_in_store>1</show_in_store>
|
| 129 |
+
</description>
|
| 130 |
+
<maxlength translate="label">
|
| 131 |
+
<label>Short Description Max Length: </label>
|
| 132 |
+
<frontend_type>text</frontend_type>
|
| 133 |
+
<comment>Empty for display all short description.</comment>
|
| 134 |
+
<sort_order>24</sort_order>
|
| 135 |
+
<show_in_default>1</show_in_default>
|
| 136 |
+
<show_in_website>1</show_in_website>
|
| 137 |
+
<show_in_store>1</show_in_store>
|
| 138 |
+
</maxlength>
|
| 139 |
+
<qty translate="label">
|
| 140 |
+
<label>Qty of Product: </label>
|
| 141 |
+
<frontend_type>text</frontend_type>
|
| 142 |
+
<sort_order>25</sort_order>
|
| 143 |
+
<show_in_default>1</show_in_default>
|
| 144 |
+
<show_in_website>1</show_in_website>
|
| 145 |
+
<show_in_store>1</show_in_store>
|
| 146 |
+
</qty>
|
| 147 |
+
<items_show translate="label">
|
| 148 |
+
<label>Number Product Show: </label>
|
| 149 |
+
<frontend_type>text</frontend_type>
|
| 150 |
+
<sort_order>26</sort_order>
|
| 151 |
+
<show_in_default>1</show_in_default>
|
| 152 |
+
<show_in_website>1</show_in_website>
|
| 153 |
+
<show_in_store>1</show_in_store>
|
| 154 |
+
</items_show>
|
| 155 |
+
<row_show translate="label">
|
| 156 |
+
<label>Number Rows Show: </label>
|
| 157 |
+
<frontend_type>text</frontend_type>
|
| 158 |
+
<sort_order>27</sort_order>
|
| 159 |
+
<show_in_default>1</show_in_default>
|
| 160 |
+
<show_in_website>1</show_in_website>
|
| 161 |
+
<show_in_store>1</show_in_store>
|
| 162 |
+
</row_show>
|
| 163 |
+
<width_thumbnail translate="label">
|
| 164 |
+
<label>Width of Thumbnail: </label>
|
| 165 |
+
<frontend_type>text</frontend_type>
|
| 166 |
+
<sort_order>29</sort_order>
|
| 167 |
+
<show_in_default>1</show_in_default>
|
| 168 |
+
<show_in_website>1</show_in_website>
|
| 169 |
+
<show_in_store>1</show_in_store>
|
| 170 |
+
</width_thumbnail>
|
| 171 |
+
<height_thumbnail translate="label">
|
| 172 |
+
<label>Height of Thumbnail: </label>
|
| 173 |
+
<frontend_type>text</frontend_type>
|
| 174 |
+
<sort_order>30</sort_order>
|
| 175 |
+
<show_in_default>1</show_in_default>
|
| 176 |
+
<show_in_website>1</show_in_website>
|
| 177 |
+
<show_in_store>1</show_in_store>
|
| 178 |
+
</height_thumbnail>
|
| 179 |
+
<next_back translate="label">
|
| 180 |
+
<label>Show Next/Back control: </label>
|
| 181 |
+
<frontend_type>select</frontend_type>
|
| 182 |
+
<source_model>
|
| 183 |
+
adminhtml/system_config_source_yesno
|
| 184 |
+
</source_model>
|
| 185 |
+
<sort_order>40</sort_order>
|
| 186 |
+
<show_in_default>1</show_in_default>
|
| 187 |
+
<show_in_website>1</show_in_website>
|
| 188 |
+
<show_in_store>1</show_in_store>
|
| 189 |
+
</next_back>
|
| 190 |
+
<nav_ctrl translate="label">
|
| 191 |
+
<label>Show navigation control: </label>
|
| 192 |
+
<frontend_type>select</frontend_type>
|
| 193 |
+
<source_model>
|
| 194 |
+
adminhtml/system_config_source_yesno
|
| 195 |
+
</source_model>
|
| 196 |
+
<sort_order>42</sort_order>
|
| 197 |
+
<show_in_default>1</show_in_default>
|
| 198 |
+
<show_in_website>1</show_in_website>
|
| 199 |
+
<show_in_store>1</show_in_store>
|
| 200 |
+
</nav_ctrl>
|
| 201 |
+
</fields>
|
| 202 |
+
</featuredproduct_config>
|
| 203 |
+
</groups>
|
| 204 |
+
</featuredproduct>
|
| 205 |
+
</sections>
|
| 206 |
+
</config>
|
| 207 |
+
|
| 208 |
+
|
app/code/local/Sulopa/Featuredproduct/sql/featuredproduct_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
| 3 |
+
$setup->addAttribute('catalog_product', 'featured', array(
|
| 4 |
+
'label' => 'Featured',
|
| 5 |
+
'type' => 'int',
|
| 6 |
+
'input' => 'select',
|
| 7 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
| 8 |
+
'visible' => true,
|
| 9 |
+
'required' => false,
|
| 10 |
+
'position' => 10,
|
| 11 |
+
));
|
app/code/local/Sulopa/Newssubscribers/Block/Newssubscribers.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Newssubscribers_Block_Newssubscribers extends Mage_Core_Block_Template
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
public function getCookieName()
|
| 6 |
+
{
|
| 7 |
+
return Mage::getStoreConfig('newsletter/general/cookiename');
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
public function getCookieLifeTime()
|
| 11 |
+
{
|
| 12 |
+
return Mage::getStoreConfig('newsletter/general/cookielifetime');
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
public function isActivePopUp()
|
| 16 |
+
{
|
| 17 |
+
return Mage::getStoreConfig('newsletter/general/isactive');
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public function getTheme()
|
| 21 |
+
{
|
| 22 |
+
return Mage::getStoreConfig('newsletter/general/theme');
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function getFirstTitle()
|
| 26 |
+
{
|
| 27 |
+
return Mage::getStoreConfig('newsletter/general/firsttitle');
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function getSecondTitle()
|
| 31 |
+
{
|
| 32 |
+
return Mage::getStoreConfig('newsletter/general/secondtitle');
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
public function getText()
|
| 36 |
+
{
|
| 37 |
+
return Mage::getStoreConfig('newsletter/general/message');
|
| 38 |
+
}
|
| 39 |
+
}
|
app/code/local/Sulopa/Newssubscribers/Helper/Data.php
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Sulopa_Newssubscribers_Helper_Data extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
}
|
app/code/local/Sulopa/Newssubscribers/Model/Subscriber.php
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Sulopa_Newssubscribers_Model_Subscriber extends Mage_Newsletter_Model_Subscriber
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function getCouponCode()
|
| 7 |
+
{
|
| 8 |
+
if (!Mage::getStoreConfig('newsletter/coupon/isactive'))
|
| 9 |
+
return '';
|
| 10 |
+
|
| 11 |
+
$model = Mage::getModel('salesrule/rule');
|
| 12 |
+
$model->load(Mage::getStoreConfig('newsletter/coupon/roleid'));
|
| 13 |
+
$massGenerator = $model->getCouponMassGenerator();
|
| 14 |
+
$massGenerator->setData(array(
|
| 15 |
+
'rule_id' => Mage::getStoreConfig('newsletter/coupon/roleid'),
|
| 16 |
+
'qty' => 1,
|
| 17 |
+
'length' => Mage::getStoreConfig('newsletter/coupon/length'),
|
| 18 |
+
'format' => Mage::getStoreConfig('newsletter/coupon/format'),
|
| 19 |
+
'prefix' => Mage::getStoreConfig('newsletter/coupon/prefix'),
|
| 20 |
+
'suffix' => Mage::getStoreConfig('newsletter/coupon/suffix'),
|
| 21 |
+
'dash' => Mage::getStoreConfig('newsletter/coupon/dash'),
|
| 22 |
+
'uses_per_coupon' => 1,
|
| 23 |
+
'uses_per_customer' => 1
|
| 24 |
+
));
|
| 25 |
+
$massGenerator->generatePool();
|
| 26 |
+
$generated = $massGenerator->getGeneratedCount();
|
| 27 |
+
$latestCuopon = max($model->getCoupons());
|
| 28 |
+
$couponData = $latestCuopon->getData();
|
| 29 |
+
if ($generated != 1)
|
| 30 |
+
Mage::throwException($this->__('There was a problem with coupon generation.'));
|
| 31 |
+
|
| 32 |
+
return $couponData['code'];
|
| 33 |
+
}
|
| 34 |
+
}
|
app/code/local/Sulopa/Newssubscribers/Model/System/Config/Coupon.php
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Sulopa_Newssubscribers_Model_System_Config_Coupon
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array('value' => 'alphanum', 'label'=>Mage::helper('adminhtml')->__('Alphanumeric')),
|
| 9 |
+
array('value' => 'alpha', 'label'=>Mage::helper('adminhtml')->__('Alphabetical')),
|
| 10 |
+
array('value' => 'num', 'label'=>Mage::helper('adminhtml')->__('Numeric')),
|
| 11 |
+
);
|
| 12 |
+
}
|
| 13 |
+
}
|
app/code/local/Sulopa/Newssubscribers/Model/System/Config/Couponlist.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Sulopa_Newssubscribers_Model_System_Config_Couponlist
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
$rules = Mage::getResourceModel('salesrule/rule_collection')->load();
|
| 8 |
+
$list = array(
|
| 9 |
+
'' => Mage::helper('adminhtml')->__('Please choose rule')
|
| 10 |
+
);
|
| 11 |
+
if ($rules) {
|
| 12 |
+
foreach ($rules as $rule) {
|
| 13 |
+
if ($rule->getCouponType()==2)
|
| 14 |
+
$list[$rule->getId()] = $rule->getName();
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
return $list;
|
| 18 |
+
}
|
| 19 |
+
}
|
app/code/local/Sulopa/Newssubscribers/Model/System/Config/Template.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Sulopa_Newssubscribers_Model_System_Config_Template
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array('value' => 'default', 'label'=>Mage::helper('adminhtml')->__('Default')),
|
| 9 |
+
array('value' => 'label', 'label'=>Mage::helper('adminhtml')->__('Label')),
|
| 10 |
+
);
|
| 11 |
+
}
|
| 12 |
+
}
|
app/code/local/Sulopa/Newssubscribers/controllers/SubscriberController.php
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
include_once('Mage/Newsletter/controllers/SubscriberController.php');
|
| 4 |
+
|
| 5 |
+
class Sulopa_Newssubscribers_SubscriberController extends Mage_Newsletter_SubscriberController
|
| 6 |
+
{
|
| 7 |
+
|
| 8 |
+
public function newAction()
|
| 9 |
+
{
|
| 10 |
+
parent::newAction();
|
| 11 |
+
|
| 12 |
+
if (!Mage::getStoreConfig('newsletter/common/isactive'))
|
| 13 |
+
return '';
|
| 14 |
+
|
| 15 |
+
$session = Mage::getSingleton('core/session');
|
| 16 |
+
$errorMsg = '';
|
| 17 |
+
$errors = $session->getMessages(false)->getErrors();
|
| 18 |
+
$email = (string) $this->getRequest()->getPost('email');
|
| 19 |
+
if ($errors)
|
| 20 |
+
$errorMsg = $errors[0]->getText();
|
| 21 |
+
|
| 22 |
+
if (!$errorMsg) {
|
| 23 |
+
try {
|
| 24 |
+
|
| 25 |
+
/*$mailTemplate = Mage::getModel('core/email_template');
|
| 26 |
+
$mailTemplate->sendTransactional(1, array(
|
| 27 |
+
'name' => Mage::getStoreConfig('trans_email/ident_general/name'),
|
| 28 |
+
'email' => Mage::getStoreConfig('trans_email/ident_general/email')
|
| 29 |
+
), $email, 'newsletter_subscr_coupon', array(
|
| 30 |
+
'couponCode' => $couponData['code']
|
| 31 |
+
));*/
|
| 32 |
+
|
| 33 |
+
}
|
| 34 |
+
catch (Mage_Core_Exception $e) {
|
| 35 |
+
$session->addException($e, $this->__('There was a problem with the subscription: %s', $e->getMessage()));
|
| 36 |
+
}
|
| 37 |
+
catch (Exception $e) {
|
| 38 |
+
$session->addException($e, $this->__('There was a problem with the subscription.'));
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
public function newajaxAction()
|
| 44 |
+
{
|
| 45 |
+
$this->newAction();
|
| 46 |
+
$session = Mage::getSingleton('core/session');
|
| 47 |
+
$messages = $session->getMessages(true);
|
| 48 |
+
$errors = $messages->getErrors();
|
| 49 |
+
$response = array(
|
| 50 |
+
'errorMsg' => '',
|
| 51 |
+
'successMsg' => ''
|
| 52 |
+
);
|
| 53 |
+
|
| 54 |
+
if ($errors) {
|
| 55 |
+
$response['errorMsg'] = $errors[0]->getText();
|
| 56 |
+
} else {
|
| 57 |
+
$success = $messages->getItemsByType('success');
|
| 58 |
+
$response['successMsg'] = $success[0]->getText();
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
echo Mage::helper('core')->jsonEncode($response);
|
| 62 |
+
exit;
|
| 63 |
+
}
|
| 64 |
+
}
|
app/code/local/Sulopa/Newssubscribers/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 |
+
<newsletter translate="title" module="newssubscribers">
|
| 12 |
+
<title></title>
|
| 13 |
+
<sort_order>60</sort_order>
|
| 14 |
+
</newsletter>
|
| 15 |
+
</children>
|
| 16 |
+
</config>
|
| 17 |
+
</children>
|
| 18 |
+
</system>
|
| 19 |
+
</children>
|
| 20 |
+
</admin>
|
| 21 |
+
</resources>
|
| 22 |
+
</acl>
|
| 23 |
+
</config>
|
app/code/local/Sulopa/Newssubscribers/etc/config.xml
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Sulopa_Newssubscribers>
|
| 5 |
+
<version>0.1.0</version>
|
| 6 |
+
</Sulopa_Newssubscribers>
|
| 7 |
+
</modules>
|
| 8 |
+
|
| 9 |
+
<frontend>
|
| 10 |
+
<routers>
|
| 11 |
+
<newsletter>
|
| 12 |
+
<args>
|
| 13 |
+
<modules>
|
| 14 |
+
<Sulopa_Newssubscribers before="Mage_Newsletter">Sulopa_Newssubscribers</Sulopa_Newssubscribers>
|
| 15 |
+
</modules>
|
| 16 |
+
</args>
|
| 17 |
+
</newsletter>
|
| 18 |
+
</routers>
|
| 19 |
+
|
| 20 |
+
<layout>
|
| 21 |
+
<updates>
|
| 22 |
+
<newssubscribers>
|
| 23 |
+
<file>newssubscribers.xml</file>
|
| 24 |
+
</newssubscribers>
|
| 25 |
+
</updates>
|
| 26 |
+
</layout>
|
| 27 |
+
|
| 28 |
+
<translate>
|
| 29 |
+
<modules>
|
| 30 |
+
<Sulopa_Newssubscribers>
|
| 31 |
+
<files>
|
| 32 |
+
<default>Sulopa_Newssubscribers.csv</default>
|
| 33 |
+
</files>
|
| 34 |
+
</Sulopa_Newssubscribers>
|
| 35 |
+
</modules>
|
| 36 |
+
</translate>
|
| 37 |
+
</frontend>
|
| 38 |
+
|
| 39 |
+
<adminhtml>
|
| 40 |
+
<translate>
|
| 41 |
+
<modules>
|
| 42 |
+
<Sulopa_Newssubscribers>
|
| 43 |
+
<files>
|
| 44 |
+
<default>Sulopa_Adminhtml_Newssubscribers.csv</default>
|
| 45 |
+
</files>
|
| 46 |
+
</Sulopa_Newssubscribers>
|
| 47 |
+
</modules>
|
| 48 |
+
</translate>
|
| 49 |
+
</adminhtml>
|
| 50 |
+
|
| 51 |
+
<global>
|
| 52 |
+
<blocks>
|
| 53 |
+
<newssubscribers>
|
| 54 |
+
<class>Sulopa_Newssubscribers_Block</class>
|
| 55 |
+
</newssubscribers>
|
| 56 |
+
</blocks>
|
| 57 |
+
|
| 58 |
+
<helpers>
|
| 59 |
+
<newssubscribers>
|
| 60 |
+
<class>Sulopa_Newssubscribers_Helper</class>
|
| 61 |
+
</newssubscribers>
|
| 62 |
+
</helpers>
|
| 63 |
+
|
| 64 |
+
<models>
|
| 65 |
+
<newssubscribers>
|
| 66 |
+
<class>Sulopa_Newssubscribers_Model</class>
|
| 67 |
+
</newssubscribers>
|
| 68 |
+
<newsletter>
|
| 69 |
+
<rewrite>
|
| 70 |
+
<subscriber>Sulopa_Newssubscribers_Model_Subscriber</subscriber>
|
| 71 |
+
</rewrite>
|
| 72 |
+
</newsletter>
|
| 73 |
+
</models>
|
| 74 |
+
|
| 75 |
+
</global>
|
| 76 |
+
|
| 77 |
+
<default>
|
| 78 |
+
<newsletter>
|
| 79 |
+
<general>
|
| 80 |
+
<isactive>1</isactive>
|
| 81 |
+
<cookielifetime>60</cookielifetime>
|
| 82 |
+
<cookiename>su_newssubscribers</cookiename>
|
| 83 |
+
<theme>default</theme>
|
| 84 |
+
<firsttitle>Newsletter Sign Up</firsttitle>
|
| 85 |
+
<secondtitle></secondtitle>
|
| 86 |
+
<message>Would you like to be one of the first to receive exclusive information about the latest collections, offers and events from this online shop? Then just subscribe to our free newsletter now.</message>
|
| 87 |
+
</general>
|
| 88 |
+
<coupon>
|
| 89 |
+
<isactive>0</isactive>
|
| 90 |
+
<format>alphanum</format>
|
| 91 |
+
<length>8</length>
|
| 92 |
+
</coupon>
|
| 93 |
+
</newsletter>
|
| 94 |
+
</default>
|
| 95 |
+
</config>
|
app/code/local/Sulopa/Newssubscribers/etc/system.xml
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<newsletter translate="label" module="newssubscribers">
|
| 5 |
+
<groups>
|
| 6 |
+
<general translate="label">
|
| 7 |
+
<label>"Newsletter subscription with gift" Popup settings</label>
|
| 8 |
+
<frontend_type>text</frontend_type>
|
| 9 |
+
<sort_order>10</sort_order>
|
| 10 |
+
<show_in_default>1</show_in_default>
|
| 11 |
+
<show_in_website>1</show_in_website>
|
| 12 |
+
<show_in_store>1</show_in_store>
|
| 13 |
+
<fields>
|
| 14 |
+
<isactive translate="label">
|
| 15 |
+
<label>Show Popup</label>
|
| 16 |
+
<frontend_type>select</frontend_type>
|
| 17 |
+
<sort_order>1</sort_order>
|
| 18 |
+
<show_in_default>1</show_in_default>
|
| 19 |
+
<show_in_website>1</show_in_website>
|
| 20 |
+
<show_in_store>1</show_in_store>
|
| 21 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 22 |
+
</isactive>
|
| 23 |
+
<theme translate="label">
|
| 24 |
+
<label>Theme</label>
|
| 25 |
+
<frontend_type>select</frontend_type>
|
| 26 |
+
<sort_order>1</sort_order>
|
| 27 |
+
<show_in_default>1</show_in_default>
|
| 28 |
+
<show_in_website>1</show_in_website>
|
| 29 |
+
<show_in_store>1</show_in_store>
|
| 30 |
+
<source_model>newssubscribers/system_config_template</source_model>
|
| 31 |
+
</theme>
|
| 32 |
+
<firsttitle translate="label">
|
| 33 |
+
<label>Title row 1</label>
|
| 34 |
+
<frontend_type>text</frontend_type>
|
| 35 |
+
<sort_order>2</sort_order>
|
| 36 |
+
<show_in_default>1</show_in_default>
|
| 37 |
+
<show_in_website>1</show_in_website>
|
| 38 |
+
<show_in_store>1</show_in_store>
|
| 39 |
+
</firsttitle>
|
| 40 |
+
<secondtitle translate="label">
|
| 41 |
+
<label>Title row 2</label>
|
| 42 |
+
<frontend_type>text</frontend_type>
|
| 43 |
+
<sort_order>3</sort_order>
|
| 44 |
+
<show_in_default>1</show_in_default>
|
| 45 |
+
<show_in_website>1</show_in_website>
|
| 46 |
+
<show_in_store>1</show_in_store>
|
| 47 |
+
</secondtitle>
|
| 48 |
+
<message translate="label">
|
| 49 |
+
<label>Text</label>
|
| 50 |
+
<frontend_type>Textarea</frontend_type>
|
| 51 |
+
<sort_order>4</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 |
+
</message>
|
| 56 |
+
<cookiename translate="label">
|
| 57 |
+
<label>Cookie Name</label>
|
| 58 |
+
<frontend_type>text</frontend_type>
|
| 59 |
+
<sort_order>5</sort_order>
|
| 60 |
+
<show_in_default>1</show_in_default>
|
| 61 |
+
<show_in_website>1</show_in_website>
|
| 62 |
+
<show_in_store>1</show_in_store>
|
| 63 |
+
<comment>If you change this name, popup show again for all customers</comment>
|
| 64 |
+
</cookiename>
|
| 65 |
+
<cookielifetime translate="label">
|
| 66 |
+
<label>Cookie Life Time (days)</label>
|
| 67 |
+
<frontend_type>text</frontend_type>
|
| 68 |
+
<sort_order>7</sort_order>
|
| 69 |
+
<show_in_default>1</show_in_default>
|
| 70 |
+
<show_in_website>1</show_in_website>
|
| 71 |
+
<show_in_store>1</show_in_store>
|
| 72 |
+
<comment>After days popup show again</comment>
|
| 73 |
+
</cookielifetime>
|
| 74 |
+
</fields>
|
| 75 |
+
</general>
|
| 76 |
+
|
| 77 |
+
<coupon translate="label">
|
| 78 |
+
<label>"Newsletter subscription with gift" Coupon settings</label>
|
| 79 |
+
<frontend_type>text</frontend_type>
|
| 80 |
+
<sort_order>20</sort_order>
|
| 81 |
+
<show_in_default>1</show_in_default>
|
| 82 |
+
<show_in_website>1</show_in_website>
|
| 83 |
+
<show_in_store>1</show_in_store>
|
| 84 |
+
<fields>
|
| 85 |
+
<isactive translate="label">
|
| 86 |
+
<label>Send coupon</label>
|
| 87 |
+
<frontend_type>select</frontend_type>
|
| 88 |
+
<sort_order>1</sort_order>
|
| 89 |
+
<show_in_default>1</show_in_default>
|
| 90 |
+
<show_in_website>1</show_in_website>
|
| 91 |
+
<show_in_store>1</show_in_store>
|
| 92 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 93 |
+
</isactive>
|
| 94 |
+
<roleid translate="label">
|
| 95 |
+
<label>Shopping Cart Price Rule</label>
|
| 96 |
+
<frontend_type>select</frontend_type>
|
| 97 |
+
<sort_order>1</sort_order>
|
| 98 |
+
<show_in_default>1</show_in_default>
|
| 99 |
+
<show_in_website>1</show_in_website>
|
| 100 |
+
<show_in_store>1</show_in_store>
|
| 101 |
+
<comment>Add new rule: "Admin -> Promotion -> Shopping Cart Price Rule" </comment>
|
| 102 |
+
<source_model>newssubscribers/system_config_couponlist</source_model>
|
| 103 |
+
</roleid>
|
| 104 |
+
<length translate="label">
|
| 105 |
+
<label>Length</label>
|
| 106 |
+
<frontend_type>text</frontend_type>
|
| 107 |
+
<sort_order>2</sort_order>
|
| 108 |
+
<show_in_default>1</show_in_default>
|
| 109 |
+
<show_in_website>1</show_in_website>
|
| 110 |
+
<show_in_store>1</show_in_store>
|
| 111 |
+
<comment>Excluding prefix, suffix and separators.</comment>
|
| 112 |
+
</length>
|
| 113 |
+
<format translate="label">
|
| 114 |
+
<label>Format</label>
|
| 115 |
+
<frontend_type>select</frontend_type>
|
| 116 |
+
<source_model>newssubscribers/system_config_coupon</source_model>
|
| 117 |
+
<sort_order>3</sort_order>
|
| 118 |
+
<show_in_default>1</show_in_default>
|
| 119 |
+
<show_in_website>1</show_in_website>
|
| 120 |
+
<show_in_store>1</show_in_store>
|
| 121 |
+
</format>
|
| 122 |
+
<prefix translate="label">
|
| 123 |
+
<label>Prefix</label>
|
| 124 |
+
<frontend_type>text</frontend_type>
|
| 125 |
+
<sort_order>4</sort_order>
|
| 126 |
+
<show_in_default>1</show_in_default>
|
| 127 |
+
<show_in_website>1</show_in_website>
|
| 128 |
+
<show_in_store>1</show_in_store>
|
| 129 |
+
</prefix>
|
| 130 |
+
<suffix translate="label">
|
| 131 |
+
<label>Suffix</label>
|
| 132 |
+
<frontend_type>text</frontend_type>
|
| 133 |
+
<sort_order>5</sort_order>
|
| 134 |
+
<show_in_default>1</show_in_default>
|
| 135 |
+
<show_in_website>1</show_in_website>
|
| 136 |
+
<show_in_store>1</show_in_store>
|
| 137 |
+
</suffix>
|
| 138 |
+
<dash translate="label">
|
| 139 |
+
<label>Dash</label>
|
| 140 |
+
<frontend_type>text</frontend_type>
|
| 141 |
+
<sort_order>6</sort_order>
|
| 142 |
+
<show_in_default>1</show_in_default>
|
| 143 |
+
<show_in_website>1</show_in_website>
|
| 144 |
+
<show_in_store>1</show_in_store>
|
| 145 |
+
<comment>If empty no separation.</comment>
|
| 146 |
+
</dash>
|
| 147 |
+
</fields>
|
| 148 |
+
</coupon>
|
| 149 |
+
</groups>
|
| 150 |
+
</newsletter>
|
| 151 |
+
</sections>
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
</config>
|
app/code/local/Sulopa/Producttabs/Block/Adminhtml/Edit.php
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Block_Adminhtml_Edit extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
| 3 |
+
protected $_saveButtonLabel = 'Save Featured Products';
|
| 4 |
+
public function __construct() {
|
| 5 |
+
$this->_blockGroup = 'producttabs';
|
| 6 |
+
$this->_controller = 'adminhtml_edit';
|
| 7 |
+
$this->_headerText = Mage::helper('adminhtml')->__('Featured products');
|
| 8 |
+
parent::__construct();
|
| 9 |
+
$this->_removeButton('add');
|
| 10 |
+
$this->_addButton('save', array(
|
| 11 |
+
'label' => $this->_saveButtonLabel,
|
| 12 |
+
'onclick' => 'categorySubmit(\'' . $this->getSaveUrl() . '\')',
|
| 13 |
+
'class' => 'Save',
|
| 14 |
+
));
|
| 15 |
+
}
|
| 16 |
+
public function getSaveUrl() {
|
| 17 |
+
return $this->getUrl('*/*/save', array('store' => $this->getRequest()->getParam('store')));
|
| 18 |
+
}
|
| 19 |
+
protected function _afterToHtml($html) {
|
| 20 |
+
return $this->_prependHtml() . parent::_afterToHtml($html) . $this->_appendHtml();
|
| 21 |
+
}
|
| 22 |
+
private function _prependHtml() {
|
| 23 |
+
$html = '
|
| 24 |
+
<form id="featured_edit_form" action="' . $this->getSaveUrl() . '" method="post" enctype="multipart/form-data">
|
| 25 |
+
<input name="form_key" type="hidden" value="' . $this->getFormKey() . '" />
|
| 26 |
+
<div class="no-display">
|
| 27 |
+
<input type="hidden" name="featured_products" id="in_featured_products" value="" />
|
| 28 |
+
</div>
|
| 29 |
+
</form>
|
| 30 |
+
';
|
| 31 |
+
return $html;
|
| 32 |
+
}
|
| 33 |
+
private function _appendHtml() {
|
| 34 |
+
$html =
|
| 35 |
+
'
|
| 36 |
+
<style type="text/css">
|
| 37 |
+
<!--
|
| 38 |
+
#logo_wrapp a{
|
| 39 |
+
display:block;
|
| 40 |
+
width:75px;
|
| 41 |
+
float:right;
|
| 42 |
+
padding:0px 0px 0px 0px;
|
| 43 |
+
margin:5px 0px 0px 0px;
|
| 44 |
+
background:url(' . $this->getSkinUrl('images/logo.png') . ') no-repeat 0px 0px;
|
| 45 |
+
text-indent: -9999px;
|
| 46 |
+
font-size: 0px;
|
| 47 |
+
line-height: 0px;
|
| 48 |
+
height:13px;
|
| 49 |
+
}
|
| 50 |
+
#logo_wrapp a:hover {background:url(' . $this->getSkinUrl('images/logo.png') . ') no-repeat 0px -13px; }
|
| 51 |
+
-->
|
| 52 |
+
</style>
|
| 53 |
+
<div style="text-align:right;">Community version of <a href="' . $this->homeUrl . '/ecommerce/magento/featured-products-on-magento-frontpage/" target="_blank">Featured Products Extension</a></div>
|
| 54 |
+
<div id="logo_wrapp"><a href="' . $this->homeUrl . '" target="_blank">SulopaStore</a></div>
|
| 55 |
+
';
|
| 56 |
+
return $html;
|
| 57 |
+
}
|
| 58 |
+
public function getHeaderHtml() {
|
| 59 |
+
return '<h3 style="background-image: url(' . $this->getSkinUrl('images/product_rating_full_star.gif') . ');" class="' . $this->getHeaderCssClass() . '">' . $this->getHeaderText() . '</h3>';
|
| 60 |
+
}
|
| 61 |
+
protected function _prepareLayout() {
|
| 62 |
+
$this->setChild('store_switcher', $this->getLayout()->createBlock('adminhtml/store_switcher', 'store_switcher')->setUseConfirm(false)
|
| 63 |
+
);
|
| 64 |
+
return parent::_prepareLayout();
|
| 65 |
+
}
|
| 66 |
+
public function getGridHtml() {
|
| 67 |
+
return $this->getChildHtml('store_switcher') . $this->getChildHtml('grid');
|
| 68 |
+
}
|
| 69 |
+
}
|
app/code/local/Sulopa/Producttabs/Block/Adminhtml/Edit/Grid.php
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Block_Adminhtml_Edit_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
| 3 |
+
public function __construct() {
|
| 4 |
+
parent::__construct();
|
| 5 |
+
$this->setId('su_featured_products');
|
| 6 |
+
$this->setDefaultSort('entity_id');
|
| 7 |
+
$this->setUseAjax(true);
|
| 8 |
+
$this->setRowClickCallback('FeaturedRowClick');
|
| 9 |
+
}
|
| 10 |
+
public function getProduct() {
|
| 11 |
+
return Mage::registry('product');
|
| 12 |
+
}
|
| 13 |
+
protected function _getStore() {
|
| 14 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
| 15 |
+
return Mage::app()->getStore($storeId);
|
| 16 |
+
}
|
| 17 |
+
protected function _addColumnFilterToCollection($column) {
|
| 18 |
+
if ($this->getCollection()) {
|
| 19 |
+
if ($column->getId() == 'websites') {
|
| 20 |
+
$this->getCollection()->joinField('websites', 'catalog/product_website', 'website_id', 'product_id=entity_id', null, 'left');
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
if ($column->getId() == "featured") {
|
| 24 |
+
$productIds = $this->_getSelectedProducts();
|
| 25 |
+
if (empty($productIds)) {
|
| 26 |
+
$productIds = 0;
|
| 27 |
+
}
|
| 28 |
+
if ($column->getFilter()->getValue()) {
|
| 29 |
+
$this->getCollection()->addFieldToFilter('entity_id', array('in' => $productIds));
|
| 30 |
+
} elseif (!empty($productIds)) {
|
| 31 |
+
$this->getCollection()->addFieldToFilter('entity_id', array('nin' => $productIds));
|
| 32 |
+
}
|
| 33 |
+
} else {
|
| 34 |
+
parent::_addColumnFilterToCollection($column);
|
| 35 |
+
}
|
| 36 |
+
return $this;
|
| 37 |
+
}
|
| 38 |
+
protected function _prepareCollection() {
|
| 39 |
+
$store = $this->_getStore();
|
| 40 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
| 41 |
+
->addAttributeToSelect('name')
|
| 42 |
+
->addAttributeToSelect('sku')
|
| 43 |
+
->addAttributeToSelect('su_featured_product')
|
| 44 |
+
->addAttributeToSelect('type_id')
|
| 45 |
+
->addAttributeToFilter('visibility', array('nin' => array(1,3)));
|
| 46 |
+
if ($store->getId()) {
|
| 47 |
+
$collection->addStoreFilter($store);
|
| 48 |
+
$collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId());
|
| 49 |
+
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId());
|
| 50 |
+
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', 1, 'inner', $store->getId());
|
| 51 |
+
$collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store->getId());
|
| 52 |
+
} else {
|
| 53 |
+
$collection->addAttributeToSelect('price');
|
| 54 |
+
$collection->addAttributeToSelect('status');
|
| 55 |
+
$collection->addAttributeToSelect('visibility');
|
| 56 |
+
}
|
| 57 |
+
$this->setCollection($collection);
|
| 58 |
+
parent::_prepareCollection();
|
| 59 |
+
$this->getCollection()->addWebsiteNamesToResult();
|
| 60 |
+
return $this;
|
| 61 |
+
}
|
| 62 |
+
protected function _prepareColumns() {
|
| 63 |
+
$this->addColumn('featured', array(
|
| 64 |
+
'header_css_class' => 'a-center',
|
| 65 |
+
'type' => 'checkbox',
|
| 66 |
+
'name' => 'featured',
|
| 67 |
+
'values' => $this->_getSelectedProducts(),
|
| 68 |
+
'align' => 'center',
|
| 69 |
+
'index' => 'entity_id'
|
| 70 |
+
));
|
| 71 |
+
$this->addColumn('entity_id', array(
|
| 72 |
+
'header' => Mage::helper('catalog')->__('ID'),
|
| 73 |
+
'sortable' => true,
|
| 74 |
+
'width' => '60',
|
| 75 |
+
'index' => 'entity_id'
|
| 76 |
+
));
|
| 77 |
+
$this->addColumn('name', array(
|
| 78 |
+
'header' => Mage::helper('catalog')->__('Name'),
|
| 79 |
+
'index' => 'name'
|
| 80 |
+
));
|
| 81 |
+
$this->addColumn('type',
|
| 82 |
+
array(
|
| 83 |
+
'header'=> Mage::helper('catalog')->__('Type'),
|
| 84 |
+
'width' => '60px',
|
| 85 |
+
'index' => 'type_id',
|
| 86 |
+
'type' => 'options',
|
| 87 |
+
'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
|
| 88 |
+
));
|
| 89 |
+
$this->addColumn('sku', array(
|
| 90 |
+
'header' => Mage::helper('catalog')->__('SKU'),
|
| 91 |
+
'width' => '140',
|
| 92 |
+
'index' => 'sku'
|
| 93 |
+
));
|
| 94 |
+
$this->addColumn('visibility', array(
|
| 95 |
+
'header' => Mage::helper('catalog')->__('Visibility'),
|
| 96 |
+
'width' => '140',
|
| 97 |
+
'index' => 'visibility',
|
| 98 |
+
'filter' => false,
|
| 99 |
+
'renderer' => 'producttabs/adminhtml_edit_renderer_visibility',
|
| 100 |
+
));
|
| 101 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
| 102 |
+
$this->addColumn('websites', array(
|
| 103 |
+
'header' => Mage::helper('catalog')->__('Websites'),
|
| 104 |
+
'width' => '100px',
|
| 105 |
+
'sortable' => false,
|
| 106 |
+
'index' => 'websites',
|
| 107 |
+
'type' => 'options',
|
| 108 |
+
'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
|
| 109 |
+
));
|
| 110 |
+
}
|
| 111 |
+
$store = $this->_getStore();
|
| 112 |
+
$this->addColumn('price',
|
| 113 |
+
array(
|
| 114 |
+
'header'=> Mage::helper('catalog')->__('Price'),
|
| 115 |
+
'type' => 'price',
|
| 116 |
+
'currency_code' => $store->getBaseCurrency()->getCode(),
|
| 117 |
+
'index' => 'price',
|
| 118 |
+
));
|
| 119 |
+
return parent::_prepareColumns();
|
| 120 |
+
}
|
| 121 |
+
public function getGridUrl() {
|
| 122 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
| 123 |
+
}
|
| 124 |
+
protected function _getSelectedProducts($json=false) {
|
| 125 |
+
$temp = $this->getRequest()->getPost('featured_ids');
|
| 126 |
+
$store = $this->_getStore();
|
| 127 |
+
if ($temp) {
|
| 128 |
+
parse_str($temp, $featured_ids);
|
| 129 |
+
}
|
| 130 |
+
$_prod = Mage::getModel('catalog/product')->getCollection()
|
| 131 |
+
->joinAttribute('su_featured_product', 'catalog_product/su_featured_product', 'entity_id', null, 'left', $store->getId())
|
| 132 |
+
->addAttributeToFilter('su_featured_product', '1');
|
| 133 |
+
$products = $_prod->getColumnValues('entity_id');
|
| 134 |
+
$selected_products = array();
|
| 135 |
+
if ($json == true) {
|
| 136 |
+
foreach ($products as $key => $value) {
|
| 137 |
+
$selected_products[$value] = '1';
|
| 138 |
+
}
|
| 139 |
+
return Zend_Json::encode($selected_products);
|
| 140 |
+
} else {
|
| 141 |
+
foreach ($products as $key => $value) {
|
| 142 |
+
if ((isset($featured_ids[$value])) && ($featured_ids[$value] == 0)) {
|
| 143 |
+
}else
|
| 144 |
+
$selected_products[$value] = '0';
|
| 145 |
+
}
|
| 146 |
+
if (isset($featured_ids))
|
| 147 |
+
foreach ($featured_ids as $key => $value) {
|
| 148 |
+
if ($value == 1)
|
| 149 |
+
$selected_products[$key] = '0';
|
| 150 |
+
}
|
| 151 |
+
return array_keys($selected_products);
|
| 152 |
+
}
|
| 153 |
+
return $products;
|
| 154 |
+
}
|
| 155 |
+
//add javascript before/after grid html
|
| 156 |
+
protected function _afterToHtml($html) {
|
| 157 |
+
return $this->_prependHtml() . parent::_afterToHtml($html) . $this->_appendHtml();
|
| 158 |
+
}
|
| 159 |
+
private function _prependHtml() {
|
| 160 |
+
$gridName = $this->getJsObjectName();
|
| 161 |
+
$html =
|
| 162 |
+
<<<EndHTML
|
| 163 |
+
<script type="text/javascript">
|
| 164 |
+
//<![CDATA[
|
| 165 |
+
categoryForm = new varienForm('featured_edit_form');
|
| 166 |
+
categoryForm.submit= function (url) {
|
| 167 |
+
this._submit();
|
| 168 |
+
return true;
|
| 169 |
+
};
|
| 170 |
+
function categorySubmit(url) {
|
| 171 |
+
var params = {};
|
| 172 |
+
var fields = $('featured_edit_form').getElementsBySelector('input', 'select');
|
| 173 |
+
categoryForm.submit();
|
| 174 |
+
}
|
| 175 |
+
function FeaturedRowClick(grid, event)
|
| 176 |
+
{
|
| 177 |
+
var trElement = Event.findElement(event, 'tr');
|
| 178 |
+
var isInput = Event.element(event).tagName == 'INPUT';
|
| 179 |
+
var checkbox = Element.getElementsBySelector(trElement, 'input.checkbox').first();
|
| 180 |
+
if(!checkbox) return;
|
| 181 |
+
if(checkbox.checked) checkBoxes.set(checkbox.value, 1);
|
| 182 |
+
else checkBoxes.set(checkbox.value, 0);
|
| 183 |
+
//else checkBoxes.unset(checkbox.value);
|
| 184 |
+
$("in_featured_products").value = checkBoxes.toQueryString();
|
| 185 |
+
//console.log("Products", checkBoxes);
|
| 186 |
+
$gridName.reloadParams = {'featured_ids':checkBoxes.toQueryString()};
|
| 187 |
+
}
|
| 188 |
+
//]]>
|
| 189 |
+
</script>
|
| 190 |
+
EndHTML;
|
| 191 |
+
return $html;
|
| 192 |
+
}
|
| 193 |
+
private function _appendHtml() {
|
| 194 |
+
$html =
|
| 195 |
+
'
|
| 196 |
+
<script type="text/javascript">
|
| 197 |
+
var checkBoxes = $H();
|
| 198 |
+
var checkbox_all = $$("#su_featured_products_table thead input.checkbox").first();
|
| 199 |
+
var everycheckbox = $$("#su_featured_products_table tbody input.checkbox");
|
| 200 |
+
checkbox_all.observe("click", function(event) {
|
| 201 |
+
if(checkbox_all.checked)
|
| 202 |
+
{
|
| 203 |
+
everycheckbox.each(function(element, index) {
|
| 204 |
+
checkBoxes.set(element.value, 1)
|
| 205 |
+
});
|
| 206 |
+
} else
|
| 207 |
+
{
|
| 208 |
+
everycheckbox.each(function(element, index) {
|
| 209 |
+
checkBoxes.set(element.value, 0)
|
| 210 |
+
});
|
| 211 |
+
}
|
| 212 |
+
$("in_featured_products").value = checkBoxes.toQueryString();
|
| 213 |
+
});
|
| 214 |
+
</script>
|
| 215 |
+
';
|
| 216 |
+
return $html;
|
| 217 |
+
}
|
| 218 |
+
}
|
app/code/local/Sulopa/Producttabs/Block/Adminhtml/Edit/Renderer/Visibility.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Block_Adminhtml_Edit_Renderer_Visibility extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 3 |
+
{
|
| 4 |
+
protected $_values;
|
| 5 |
+
/**
|
| 6 |
+
* Renders grid column
|
| 7 |
+
*
|
| 8 |
+
* @param Varien_Object $row
|
| 9 |
+
* @return string
|
| 10 |
+
*/
|
| 11 |
+
public function render(Varien_Object $row)
|
| 12 |
+
{
|
| 13 |
+
$this->_values = Mage::getModel('catalog/product_visibility')->getOptionArray();
|
| 14 |
+
$html = $this->_values[$row->getData($this->getColumn()->getIndex())];
|
| 15 |
+
return $html;
|
| 16 |
+
}
|
| 17 |
+
}
|
app/code/local/Sulopa/Producttabs/Block/Product/List.php
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Block_Product_List extends Mage_Catalog_Block_Product_List
|
| 3 |
+
{
|
| 4 |
+
public function getTabCfg($cfg)
|
| 5 |
+
{
|
| 6 |
+
return Mage::helper('producttabs')->getTabCfg($cfg);
|
| 7 |
+
}
|
| 8 |
+
public function getProductCfg($cfg)
|
| 9 |
+
{
|
| 10 |
+
return Mage::helper('producttabs')->getProductCfg($cfg);
|
| 11 |
+
}
|
| 12 |
+
public function useFlatCatalogProduct()
|
| 13 |
+
{
|
| 14 |
+
return Mage::getStoreConfig('catalog/frontend/flat_catalog_product');
|
| 15 |
+
}
|
| 16 |
+
public function getColumnCount()
|
| 17 |
+
{
|
| 18 |
+
return $this->getNumProduct();
|
| 19 |
+
}
|
| 20 |
+
public function getNumProduct()
|
| 21 |
+
{
|
| 22 |
+
return $this->getProductCfg('product_number');
|
| 23 |
+
}
|
| 24 |
+
public function getCategoryId()
|
| 25 |
+
{
|
| 26 |
+
$categoryId = (int) $this->getRequest()->getPost('category_id');
|
| 27 |
+
return $categoryId;
|
| 28 |
+
}
|
| 29 |
+
protected function _getProductCollection()
|
| 30 |
+
{
|
| 31 |
+
$productType = $this->getRequest()->getParam('type');
|
| 32 |
+
switch ($productType) {
|
| 33 |
+
case 'bestseller':
|
| 34 |
+
$Collection = $this->getBestsellerProducts();
|
| 35 |
+
$this->_TitleProduct = $this->__('Bestseller');
|
| 36 |
+
break;
|
| 37 |
+
case 'featured':
|
| 38 |
+
$Collection = $this->getFeaturedProducts();
|
| 39 |
+
break;
|
| 40 |
+
case 'mostviewed':
|
| 41 |
+
$Collection = $this->getMostviewedProducts();
|
| 42 |
+
break;
|
| 43 |
+
case 'newproduct':
|
| 44 |
+
$Collection = $this->getNewProducts();
|
| 45 |
+
break;
|
| 46 |
+
case 'random':
|
| 47 |
+
$Collection = $this->getRandomProducts();
|
| 48 |
+
break;
|
| 49 |
+
case 'saleproduct':
|
| 50 |
+
$Collection = $this->getSaleProducts();
|
| 51 |
+
break;
|
| 52 |
+
case 'specialproduct':
|
| 53 |
+
$Collection = $this->getSpecialProducts();
|
| 54 |
+
break;
|
| 55 |
+
default:
|
| 56 |
+
$Collection = $this->getFeaturedProducts();
|
| 57 |
+
break;
|
| 58 |
+
}
|
| 59 |
+
return $Collection;
|
| 60 |
+
}
|
| 61 |
+
public function getBestsellerProducts(){
|
| 62 |
+
$_rootcatID = Mage::app()->getStore()->getRootCategoryId();
|
| 63 |
+
$collection = Mage::getResourceModel('producttabs/product_bestseller');
|
| 64 |
+
$collection = $this->_addProductAttributesAndPrices($collection)
|
| 65 |
+
->addOrderedQty()
|
| 66 |
+
->addMinimalPrice()
|
| 67 |
+
->setOrder('ordered_qty', 'desc');
|
| 68 |
+
$collection->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
| 69 |
+
->addAttributeToFilter('category_id', array('in' => $_rootcatID));
|
| 70 |
+
$collection->setPageSize($this->getNumProduct()); // require before foreach
|
| 71 |
+
if($this->useFlatCatalogProduct())
|
| 72 |
+
{
|
| 73 |
+
// fix error mat image vs name while Enable useFlatCatalogProduct
|
| 74 |
+
foreach ($collection as $product)
|
| 75 |
+
{
|
| 76 |
+
$productId = $product->_data['entity_id'];
|
| 77 |
+
$_product = Mage::getModel('catalog/product')->load($productId); //Product ID
|
| 78 |
+
$product->_data['name'] = $_product->getName();
|
| 79 |
+
$product->_data['thumbnail'] = $_product->getThumbnail();
|
| 80 |
+
$product->_data['small_image'] = $_product->getSmallImage();
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
return $collection;
|
| 84 |
+
}
|
| 85 |
+
public function getFeaturedProducts(){
|
| 86 |
+
$_rootcatID = Mage::app()->getStore()->getRootCategoryId();
|
| 87 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
| 88 |
+
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
| 89 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
| 90 |
+
->addAttributeToFilter('su_featured_product', 1, 'left')
|
| 91 |
+
->addMinimalPrice()
|
| 92 |
+
->addTaxPercents()
|
| 93 |
+
->addStoreFilter()
|
| 94 |
+
->addAttributeToFilter('category_id', array('in' => $_rootcatID));
|
| 95 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
| 96 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
|
| 97 |
+
// getNumProduct
|
| 98 |
+
$collection->setPageSize($this->getNumProduct());
|
| 99 |
+
return $collection;
|
| 100 |
+
}
|
| 101 |
+
public function getMostviewedProducts(){
|
| 102 |
+
//Magento get popular products by total number of views
|
| 103 |
+
$_rootcatID = Mage::app()->getStore()->getRootCategoryId();
|
| 104 |
+
$collection = Mage::getResourceModel('reports/product_collection')
|
| 105 |
+
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
| 106 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
| 107 |
+
->addViewsCount()
|
| 108 |
+
->addMinimalPrice()
|
| 109 |
+
->addTaxPercents()
|
| 110 |
+
->addStoreFilter()
|
| 111 |
+
->addAttributeToFilter('category_id', array('in' => $_rootcatID));
|
| 112 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
| 113 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
|
| 114 |
+
// getNumProduct
|
| 115 |
+
$collection->setPageSize($this->getNumProduct()); // require before foreach
|
| 116 |
+
if($this->useFlatCatalogProduct())
|
| 117 |
+
{
|
| 118 |
+
// fix error mat image vs name while Enable useFlatCatalogProduct
|
| 119 |
+
foreach ($collection as $product)
|
| 120 |
+
{
|
| 121 |
+
$productId = $product->_data['entity_id'];
|
| 122 |
+
$_product = Mage::getModel('catalog/product')->load($productId); //Product ID
|
| 123 |
+
$product->_data['name'] = $_product->getName();
|
| 124 |
+
$product->_data['thumbnail'] = $_product->getThumbnail();
|
| 125 |
+
$product->_data['small_image'] = $_product->getSmallImage();
|
| 126 |
+
}
|
| 127 |
+
}
|
| 128 |
+
return $collection;
|
| 129 |
+
}
|
| 130 |
+
public function getNewProducts() {
|
| 131 |
+
$_rootcatID = Mage::app()->getStore()->getRootCategoryId();
|
| 132 |
+
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
|
| 133 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
| 134 |
+
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
| 135 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
| 136 |
+
->addAttributeToSelect('*') //Need this so products show up correctly in product listing
|
| 137 |
+
->addAttributeToFilter('news_from_date', array('or'=> array(
|
| 138 |
+
0 => array('date' => true, 'to' => $todayDate),
|
| 139 |
+
1 => array('is' => new Zend_Db_Expr('null')))
|
| 140 |
+
), 'left')
|
| 141 |
+
->addAttributeToFilter('news_to_date', array('or'=> array(
|
| 142 |
+
0 => array('date' => true, 'from' => $todayDate),
|
| 143 |
+
1 => array('is' => new Zend_Db_Expr('null')))
|
| 144 |
+
), 'left')
|
| 145 |
+
->addAttributeToFilter(
|
| 146 |
+
array(
|
| 147 |
+
array('attribute' => 'news_from_date', 'is'=>new Zend_Db_Expr('not null')),
|
| 148 |
+
array('attribute' => 'news_to_date', 'is'=>new Zend_Db_Expr('not null'))
|
| 149 |
+
)
|
| 150 |
+
)
|
| 151 |
+
->addAttributeToSort('news_from_date', 'desc')
|
| 152 |
+
->addMinimalPrice()
|
| 153 |
+
->addTaxPercents()
|
| 154 |
+
->addStoreFilter()
|
| 155 |
+
->addAttributeToFilter('category_id', array('in' => $_rootcatID));
|
| 156 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
| 157 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
|
| 158 |
+
// getNumProduct
|
| 159 |
+
$collection->setPageSize($this->getNumProduct());
|
| 160 |
+
return $collection;
|
| 161 |
+
}
|
| 162 |
+
public function getRandomProducts() {
|
| 163 |
+
$_rootcatID = Mage::app()->getStore()->getRootCategoryId();
|
| 164 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
| 165 |
+
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
| 166 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
| 167 |
+
->addMinimalPrice()
|
| 168 |
+
->addTaxPercents()
|
| 169 |
+
->addStoreFilter()
|
| 170 |
+
->addAttributeToFilter('category_id', array('in' => $_rootcatID));
|
| 171 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
| 172 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
|
| 173 |
+
$collection->getSelect()->order('rand()');
|
| 174 |
+
// getNumProduct
|
| 175 |
+
$collection->setPageSize($this->getNumProduct());
|
| 176 |
+
return $collection;
|
| 177 |
+
}
|
| 178 |
+
public function getSaleProducts(){
|
| 179 |
+
$_rootcatID = Mage::app()->getStore()->getRootCategoryId();
|
| 180 |
+
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
|
| 181 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
| 182 |
+
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
| 183 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
| 184 |
+
->addAttributeToFilter('special_from_date', array('or'=> array(
|
| 185 |
+
0 => array('date' => true, 'to' => $todayDate),
|
| 186 |
+
1 => array('is' => new Zend_Db_Expr('null')))
|
| 187 |
+
), 'left')
|
| 188 |
+
->addAttributeToFilter('special_to_date', array('or'=> array(
|
| 189 |
+
0 => array('date' => true, 'from' => $todayDate),
|
| 190 |
+
1 => array('is' => new Zend_Db_Expr('null')))
|
| 191 |
+
), 'left')
|
| 192 |
+
->addAttributeToFilter(
|
| 193 |
+
array(
|
| 194 |
+
array('attribute' => 'special_from_date', 'is'=>new Zend_Db_Expr('not null')),
|
| 195 |
+
array('attribute' => 'special_to_date', 'is'=>new Zend_Db_Expr('not null'))
|
| 196 |
+
)
|
| 197 |
+
)
|
| 198 |
+
->addAttributeToSort('special_to_date','desc')
|
| 199 |
+
->addTaxPercents()
|
| 200 |
+
->addStoreFilter()
|
| 201 |
+
->addAttributeToFilter('category_id', array('in' => $_rootcatID));
|
| 202 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
| 203 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
|
| 204 |
+
// get Sale off
|
| 205 |
+
foreach ($collection as $key => $product) {
|
| 206 |
+
if($product->getSpecialPrice() == '') $collection->removeItemByKey($key); // remove product not set SpecialPrice
|
| 207 |
+
if($product->getSpecialPrice() && $product->getSpecialPrice() >= $product->getPrice())
|
| 208 |
+
{
|
| 209 |
+
$collection->removeItemByKey($key); // remove product price increase
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
// getNumProduct
|
| 213 |
+
$collection->setPageSize($this->getNumProduct());
|
| 214 |
+
return $collection;
|
| 215 |
+
}
|
| 216 |
+
public function getSpecialProducts() {
|
| 217 |
+
$_rootcatID = Mage::app()->getStore()->getRootCategoryId();
|
| 218 |
+
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
|
| 219 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
| 220 |
+
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
| 221 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
|
| 222 |
+
->addAttributeToFilter('special_from_date', array('or'=> array(
|
| 223 |
+
0 => array('date' => true, 'to' => $todayDate),
|
| 224 |
+
1 => array('is' => new Zend_Db_Expr('null')))
|
| 225 |
+
), 'left')
|
| 226 |
+
->addAttributeToFilter('special_to_date', array('or'=> array(
|
| 227 |
+
0 => array('date' => true, 'from' => $todayDate),
|
| 228 |
+
1 => array('is' => new Zend_Db_Expr('null')))
|
| 229 |
+
), 'left')
|
| 230 |
+
->addAttributeToFilter(
|
| 231 |
+
array(
|
| 232 |
+
array('attribute' => 'special_from_date', 'is'=>new Zend_Db_Expr('not null')),
|
| 233 |
+
array('attribute' => 'special_to_date', 'is'=>new Zend_Db_Expr('not null'))
|
| 234 |
+
)
|
| 235 |
+
)
|
| 236 |
+
->addAttributeToSort('special_to_date','desc')
|
| 237 |
+
->addTaxPercents()
|
| 238 |
+
->addStoreFilter()
|
| 239 |
+
->addAttributeToFilter('category_id', array('in' => $_rootcatID));
|
| 240 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
| 241 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
|
| 242 |
+
// CategoryFilter
|
| 243 |
+
$Category = Mage::getModel('catalog/category')->load($this->getCategoryId());
|
| 244 |
+
$collection->addCategoryFilter($Category);
|
| 245 |
+
// getNumProduct
|
| 246 |
+
$collection->setPageSize($this->getNumProduct());
|
| 247 |
+
return $collection;
|
| 248 |
+
}
|
| 249 |
+
}
|
app/code/local/Sulopa/Producttabs/Block/Producttabs.php
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Block_Producttabs extends Mage_Core_Block_Template
|
| 3 |
+
{
|
| 4 |
+
public function getProducttabsCfg($cfg)
|
| 5 |
+
{
|
| 6 |
+
return Mage::helper('producttabs')->getProducttabsCfg($cfg);
|
| 7 |
+
}
|
| 8 |
+
public function getProductCfg($cfg)
|
| 9 |
+
{
|
| 10 |
+
return Mage::helper('producttabs')->getProductCfg($cfg);
|
| 11 |
+
}
|
| 12 |
+
public function getTypeDefault()
|
| 13 |
+
{
|
| 14 |
+
$cfg = $this->getProductCfg('product_type');
|
| 15 |
+
$cfg = explode(',', $cfg);
|
| 16 |
+
return $cfg[0];
|
| 17 |
+
}
|
| 18 |
+
public function sortTabs()
|
| 19 |
+
{
|
| 20 |
+
return $this->getProducttabsCfg('sort_name');
|
| 21 |
+
}
|
| 22 |
+
public function getTabs()
|
| 23 |
+
{
|
| 24 |
+
$types = Mage::getSingleton("producttabs/system_config_type")->toOptionArray();
|
| 25 |
+
$cfg = $this->getProductCfg('product_type');
|
| 26 |
+
$cfg = explode(',', $cfg);
|
| 27 |
+
$tabs = array();
|
| 28 |
+
foreach ($types as $type) {
|
| 29 |
+
if(in_array($type['value'], $cfg)){
|
| 30 |
+
$tabs[$type['value']] = $type['label'];
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
return $tabs;
|
| 34 |
+
}
|
| 35 |
+
public function setBxslider()
|
| 36 |
+
{
|
| 37 |
+
$auto = (int) $this->getProducttabsCfg('auto');
|
| 38 |
+
$speed = (int) $this->getProducttabsCfg('speed');
|
| 39 |
+
$video = (int) $this->getProducttabsCfg('video');
|
| 40 |
+
$pager = (int) $this->getProducttabsCfg('pager');
|
| 41 |
+
$vertical = (int) $this->getProducttabsCfg('vertical');
|
| 42 |
+
$minSlides = (int) $this->getProducttabsCfg('minslides');
|
| 43 |
+
$maxSlides = (int) $this->getProducttabsCfg('maxslides');
|
| 44 |
+
$moveSlides = (int) $this->getProducttabsCfg('moveslides');
|
| 45 |
+
$startSlide = (int) $this->getProducttabsCfg('startslide');
|
| 46 |
+
$slideWidth = (int) $this->getProducttabsCfg('slidewidth');
|
| 47 |
+
$slideMargin = (int) $this->getProducttabsCfg('slidemargin');
|
| 48 |
+
$script = 'infiniteLoop:false,';
|
| 49 |
+
if($auto) $script .= "auto: $auto,";
|
| 50 |
+
if($speed) $script .= "speed: $speed,";
|
| 51 |
+
if(!$pager) $script .= "pager: $pager,";
|
| 52 |
+
if($vertical) $script .= "mode: 'vertical',";
|
| 53 |
+
if($minSlides) $script .= "minSlides: $minSlides,";
|
| 54 |
+
if($maxSlides) $script .= "maxSlides: $maxSlides,";
|
| 55 |
+
if($moveSlides) $script .= "moveSlides: $moveSlides,";
|
| 56 |
+
if($startSlide) $script .= "startSlide: $startSlide,";
|
| 57 |
+
if($slideWidth) $script .= "slideWidth: $slideWidth,";
|
| 58 |
+
if($slideMargin) $script .= "slideMargin: $slideMargin,";
|
| 59 |
+
return $script;
|
| 60 |
+
}
|
| 61 |
+
}
|
app/code/local/Sulopa/Producttabs/Helper/Data.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Helper_Data extends Mage_Core_Helper_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function getProducttabsCfg($cfg)
|
| 5 |
+
{
|
| 6 |
+
$config = Mage::getStoreConfig('producttabs/producttabs_config');
|
| 7 |
+
if(isset($config[$cfg])) return $config[$cfg];
|
| 8 |
+
}
|
| 9 |
+
public function getProductCfg($cfg)
|
| 10 |
+
{
|
| 11 |
+
$config = Mage::getStoreConfig('producttabs/product_show');
|
| 12 |
+
if(isset($config[$cfg])) return $config[$cfg];
|
| 13 |
+
}
|
| 14 |
+
}
|
app/code/local/Sulopa/Producttabs/Model/Resource/Product/Bestseller.php
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Model_Resource_Product_Bestseller extends Mage_Reports_Model_Resource_Product_Collection
|
| 3 |
+
{
|
| 4 |
+
public function addOrderedQty($from = '', $to = '') // rewirte method addOrderedQty
|
| 5 |
+
{
|
| 6 |
+
$adapter = $this->getConnection();
|
| 7 |
+
$orderTableAliasName = $adapter->quoteIdentifier('order');
|
| 8 |
+
$orderJoinCondition = array(
|
| 9 |
+
$orderTableAliasName . '.entity_id = order_items.order_id',
|
| 10 |
+
$adapter->quoteInto("{$orderTableAliasName}.state <> ?",
|
| 11 |
+
Mage_Sales_Model_Order::STATE_CANCELED),
|
| 12 |
+
);
|
| 13 |
+
$productJoinCondition = array(
|
| 14 |
+
'e.entity_id = T1.final_product_id',
|
| 15 |
+
$adapter->quoteInto('e.entity_type_id = ?',
|
| 16 |
+
$this->getProductEntityTypeId())
|
| 17 |
+
);
|
| 18 |
+
if ($from != '' && $to != '')
|
| 19 |
+
{
|
| 20 |
+
$fieldName = $orderTableAliasName . '.created_at';
|
| 21 |
+
$orderJoinCondition[] = $this->_prepareBetweenSql($fieldName, $from, $to);
|
| 22 |
+
}
|
| 23 |
+
$subSelect = $this->getSelect()->reset()
|
| 24 |
+
->from( array('order_items' => $this->getTable('sales/order_item')),
|
| 25 |
+
array( 'qty_ordered',
|
| 26 |
+
'name',
|
| 27 |
+
'final_product_id' => new Zend_Db_Expr(
|
| 28 |
+
"IF(parent_id IS NOT NULL AND visibility != " . Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH . ", parent_id, order_items.product_id)"
|
| 29 |
+
),
|
| 30 |
+
)
|
| 31 |
+
)
|
| 32 |
+
->joinInner(array('order' => $this->getTable('sales/order')),
|
| 33 |
+
implode(' AND ', $orderJoinCondition),
|
| 34 |
+
array()
|
| 35 |
+
)
|
| 36 |
+
->joinLeft( array('cpr' => $this->getTable('catalog/product_relation')),
|
| 37 |
+
'cpr.child_id = order_items.product_id',
|
| 38 |
+
array( 'parent_id',)
|
| 39 |
+
)
|
| 40 |
+
->joinLeft( array('cat_index' => $this->getTable('catalog/category_product_index')),
|
| 41 |
+
'cat_index.product_id = order_items.product_id',
|
| 42 |
+
array( 'store_id', 'visibility', 'category_id', )
|
| 43 |
+
)
|
| 44 |
+
->where('parent_item_id IS NULL')
|
| 45 |
+
->where('cat_index.store_id = ?',
|
| 46 |
+
Mage::app()->getStore()->getId()
|
| 47 |
+
)
|
| 48 |
+
->where('category_id = ?',
|
| 49 |
+
Mage::app()->getStore()->getRootCategoryId()
|
| 50 |
+
);
|
| 51 |
+
$subSelectString = '(' . $subSelect->__toString() . ')';
|
| 52 |
+
$this->getSelect()->reset()
|
| 53 |
+
->from( array('T1' => new Zend_Db_Expr($subSelectString)),
|
| 54 |
+
array( 'ordered_qty' => 'SUM(qty_ordered)',
|
| 55 |
+
'order_items_name' => 'name',
|
| 56 |
+
'entity_id' => 'final_product_id',
|
| 57 |
+
)
|
| 58 |
+
)
|
| 59 |
+
->joinLeft( array('e' => $this->getProductEntityTableName()),
|
| 60 |
+
implode(' AND ', $productJoinCondition),
|
| 61 |
+
array( 'entity_type_id' => 'e.entity_type_id',
|
| 62 |
+
'attribute_set_id' => 'e.attribute_set_id',
|
| 63 |
+
'type_id' => 'e.type_id',
|
| 64 |
+
'sku' => 'e.sku',
|
| 65 |
+
'has_options' => 'e.has_options',
|
| 66 |
+
'required_options' => 'e.required_options',
|
| 67 |
+
'created_at' => 'e.created_at',
|
| 68 |
+
'updated_at' => 'e.updated_at' )
|
| 69 |
+
)
|
| 70 |
+
->group('final_product_id');
|
| 71 |
+
return $this;
|
| 72 |
+
}
|
| 73 |
+
}
|
app/code/local/Sulopa/Producttabs/Model/System/Config/Action.php
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Model_System_Config_Action
|
| 3 |
+
{
|
| 4 |
+
public function toOptionArray()
|
| 5 |
+
{
|
| 6 |
+
return array(
|
| 7 |
+
array('value'=>'0', 'label'=>Mage::helper('adminhtml')->__('None')),
|
| 8 |
+
array('value'=>'cart', 'label'=>Mage::helper('adminhtml')->__('Add to Cart')),
|
| 9 |
+
array('value'=>'compare', 'label'=>Mage::helper('adminhtml')->__('Add to Compare')),
|
| 10 |
+
array('value'=>'wishlist', 'label'=>Mage::helper('adminhtml')->__('Wishlist')),
|
| 11 |
+
array('value'=>'cart,compare', 'label'=>Mage::helper('adminhtml')->__('Cart with Compare')),
|
| 12 |
+
array('value'=>'cart,wishlist', 'label'=>Mage::helper('adminhtml')->__('Cart with Wishlist')),
|
| 13 |
+
array('value'=>'compare,wishlist', 'label'=>Mage::helper('adminhtml')->__('Compare with Wishlist')),
|
| 14 |
+
array('value'=>'compare,cart,wishlist', 'label'=>Mage::helper('adminhtml')->__('Display all')),
|
| 15 |
+
);
|
| 16 |
+
}
|
| 17 |
+
}
|
app/code/local/Sulopa/Producttabs/Model/System/Config/Sort.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Model_System_Config_Sort
|
| 3 |
+
{
|
| 4 |
+
public function toOptionArray()
|
| 5 |
+
{
|
| 6 |
+
return array(
|
| 7 |
+
array('value'=>'asc', 'label'=>Mage::helper('adminhtml')->__('Ascending')),
|
| 8 |
+
array('value'=>'desc', 'label'=>Mage::helper('adminhtml')->__('Descending'))
|
| 9 |
+
);
|
| 10 |
+
}
|
| 11 |
+
}
|
app/code/local/Sulopa/Producttabs/Model/System/Config/Type.php
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Model_System_Config_Type
|
| 3 |
+
{
|
| 4 |
+
public function toOptionArray()
|
| 5 |
+
{
|
| 6 |
+
return array(
|
| 7 |
+
array('value' => 'bestseller', 'label'=>Mage::helper('adminhtml')->__('Bestseller')),
|
| 8 |
+
array('value' => 'featured', 'label'=>Mage::helper('adminhtml')->__('Featured Products')),
|
| 9 |
+
array('value' => 'mostviewed', 'label'=>Mage::helper('adminhtml')->__('Most Viewed')),
|
| 10 |
+
array('value' => 'newproduct', 'label'=>Mage::helper('adminhtml')->__('New Products')),
|
| 11 |
+
array('value' => 'random', 'label'=>Mage::helper('adminhtml')->__('Random Products')),
|
| 12 |
+
array('value' => 'saleproduct', 'label'=>Mage::helper('adminhtml')->__('Sale Products')),
|
| 13 |
+
);
|
| 14 |
+
}
|
| 15 |
+
}
|
app/code/local/Sulopa/Producttabs/controllers/Adminhtml/FeaturedController.php
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_Adminhtml_FeaturedController extends Mage_Adminhtml_Controller_Action
|
| 3 |
+
{
|
| 4 |
+
protected function _initProduct()
|
| 5 |
+
{
|
| 6 |
+
$product = Mage::getModel('catalog/product')
|
| 7 |
+
->setStoreId($this->getRequest()->getParam('store', 0));
|
| 8 |
+
if ($setId = (int) $this->getRequest()->getParam('set')) {
|
| 9 |
+
$product->setAttributeSetId($setId);
|
| 10 |
+
}
|
| 11 |
+
if ($typeId = $this->getRequest()->getParam('type')) {
|
| 12 |
+
$product->setTypeId($typeId);
|
| 13 |
+
}
|
| 14 |
+
$product->setData('_edit_mode', true);
|
| 15 |
+
Mage::register('product', $product);
|
| 16 |
+
return $product;
|
| 17 |
+
}
|
| 18 |
+
public function indexAction()
|
| 19 |
+
{
|
| 20 |
+
$this->_initProduct();
|
| 21 |
+
$this->loadLayout()->_setActiveMenu('producttabs/featuredproduct');
|
| 22 |
+
$this->_addContent($this->getLayout()->createBlock('producttabs/adminhtml_edit'));
|
| 23 |
+
$this->renderLayout();
|
| 24 |
+
}
|
| 25 |
+
public function gridAction()
|
| 26 |
+
{
|
| 27 |
+
$this->getResponse()->setBody(
|
| 28 |
+
$this->getLayout()->createBlock('producttabs/adminhtml_edit_grid')->toHtml()
|
| 29 |
+
);
|
| 30 |
+
}
|
| 31 |
+
public function saveAction()
|
| 32 |
+
{
|
| 33 |
+
$data = $this->getRequest()->getPost();
|
| 34 |
+
$collection = Mage::getModel('catalog/product')->getCollection();
|
| 35 |
+
$storeId = $this->getRequest()->getParam('store', 0);
|
| 36 |
+
parse_str($data['featured_products'], $featured_products);
|
| 37 |
+
$collection->addIdFilter(array_keys($featured_products));
|
| 38 |
+
try {
|
| 39 |
+
foreach($collection->getItems() as $product)
|
| 40 |
+
{
|
| 41 |
+
$product->setData('su_featured_product',$featured_products[$product->getEntityId()]);
|
| 42 |
+
$product->setStoreId($storeId);
|
| 43 |
+
$product->save();
|
| 44 |
+
}
|
| 45 |
+
$this->_getSession()->addSuccess($this->__('Featured product was successfully saved.'));
|
| 46 |
+
$this->_redirect('*/*/index', array('store'=> $this->getRequest()->getParam('store')));
|
| 47 |
+
}catch (Exception $e){
|
| 48 |
+
$this->_getSession()->addError($e->getMessage());
|
| 49 |
+
$this->_redirect('*/*/index', array('store'=> $this->getRequest()->getParam('store')));
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
protected function _validateSecretKey()
|
| 53 |
+
{
|
| 54 |
+
return true;
|
| 55 |
+
}
|
| 56 |
+
}
|
app/code/local/Sulopa/Producttabs/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Sulopa_Producttabs_IndexController extends Mage_Core_Controller_Front_Action
|
| 3 |
+
{
|
| 4 |
+
public function resultAction()
|
| 5 |
+
{
|
| 6 |
+
if ($this->getRequest()->isAjax()) {
|
| 7 |
+
$this->loadLayout();
|
| 8 |
+
$this->renderLayout();
|
| 9 |
+
return $this;
|
| 10 |
+
}
|
| 11 |
+
}
|
| 12 |
+
}
|
app/code/local/Sulopa/Producttabs/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<acl>
|
| 4 |
+
<resources>
|
| 5 |
+
<admin>
|
| 6 |
+
<children>
|
| 7 |
+
<system>
|
| 8 |
+
<children>
|
| 9 |
+
<config>
|
| 10 |
+
<children>
|
| 11 |
+
<producttabs>
|
| 12 |
+
<title>Product Tabs</title>
|
| 13 |
+
</producttabs>
|
| 14 |
+
</children>
|
| 15 |
+
</config>
|
| 16 |
+
</children>
|
| 17 |
+
</system>
|
| 18 |
+
</children>
|
| 19 |
+
</admin>
|
| 20 |
+
</resources>
|
| 21 |
+
</acl>
|
| 22 |
+
</config>
|
app/code/local/Sulopa/Producttabs/etc/config.xml
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Sulopa_Producttabs>
|
| 5 |
+
<version>0.1.0</version>
|
| 6 |
+
</Sulopa_Producttabs>
|
| 7 |
+
</modules>
|
| 8 |
+
<frontend>
|
| 9 |
+
<routers>
|
| 10 |
+
<producttabs>
|
| 11 |
+
<use>standard</use>
|
| 12 |
+
<args>
|
| 13 |
+
<module>Sulopa_Producttabs</module>
|
| 14 |
+
<frontName>producttabs</frontName>
|
| 15 |
+
</args>
|
| 16 |
+
</producttabs>
|
| 17 |
+
</routers>
|
| 18 |
+
<layout>
|
| 19 |
+
<updates>
|
| 20 |
+
<producttabs>
|
| 21 |
+
<file>producttabs.xml</file>
|
| 22 |
+
</producttabs>
|
| 23 |
+
</updates>
|
| 24 |
+
</layout>
|
| 25 |
+
</frontend>
|
| 26 |
+
<admin>
|
| 27 |
+
<routers>
|
| 28 |
+
<producttabs>
|
| 29 |
+
<use>admin</use>
|
| 30 |
+
<args>
|
| 31 |
+
<module>Sulopa_Producttabs</module>
|
| 32 |
+
<frontName>producttabs</frontName>
|
| 33 |
+
</args>
|
| 34 |
+
</producttabs>
|
| 35 |
+
<adminhtml>
|
| 36 |
+
<args>
|
| 37 |
+
<modules>
|
| 38 |
+
<productslide before="Mage_Adminhtml">Sulopa_Producttabs_Adminhtml</productslide>
|
| 39 |
+
</modules>
|
| 40 |
+
</args>
|
| 41 |
+
</adminhtml>
|
| 42 |
+
</routers>
|
| 43 |
+
</admin>
|
| 44 |
+
<adminhtml>
|
| 45 |
+
<acl>
|
| 46 |
+
<resources>
|
| 47 |
+
<all>
|
| 48 |
+
<title>Allow Everything</title>
|
| 49 |
+
</all>
|
| 50 |
+
<admin>
|
| 51 |
+
<children>
|
| 52 |
+
<Sulopa_Producttabs>
|
| 53 |
+
<title>Producttabs Module</title>
|
| 54 |
+
<sort_order>10</sort_order>
|
| 55 |
+
</Sulopa_Producttabs>
|
| 56 |
+
</children>
|
| 57 |
+
</admin>
|
| 58 |
+
</resources>
|
| 59 |
+
</acl>
|
| 60 |
+
<layout>
|
| 61 |
+
<updates>
|
| 62 |
+
<producttabs>
|
| 63 |
+
<file>producttabs.xml</file>
|
| 64 |
+
</producttabs>
|
| 65 |
+
</updates>
|
| 66 |
+
</layout>
|
| 67 |
+
</adminhtml>
|
| 68 |
+
<global>
|
| 69 |
+
<models>
|
| 70 |
+
<producttabs>
|
| 71 |
+
<class>Sulopa_Producttabs_Model</class>
|
| 72 |
+
<resourceModel>producttabs_resource</resourceModel>
|
| 73 |
+
</producttabs>
|
| 74 |
+
<producttabs_resource>
|
| 75 |
+
<class>Sulopa_Producttabs_Model_Resource</class>
|
| 76 |
+
</producttabs_resource>
|
| 77 |
+
</models>
|
| 78 |
+
<resources>
|
| 79 |
+
<producttabs_setup>
|
| 80 |
+
<setup>
|
| 81 |
+
<module>Sulopa_Producttabs</module>
|
| 82 |
+
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
|
| 83 |
+
</setup>
|
| 84 |
+
<connection>
|
| 85 |
+
<use>core_setup</use>
|
| 86 |
+
</connection>
|
| 87 |
+
</producttabs_setup>
|
| 88 |
+
<producttabs_write>
|
| 89 |
+
<connection>
|
| 90 |
+
<use>core_write</use>
|
| 91 |
+
</connection>
|
| 92 |
+
</producttabs_write>
|
| 93 |
+
<producttabs_read>
|
| 94 |
+
<connection>
|
| 95 |
+
<use>core_read</use>
|
| 96 |
+
</connection>
|
| 97 |
+
</producttabs_read>
|
| 98 |
+
</resources>
|
| 99 |
+
<blocks>
|
| 100 |
+
<producttabs>
|
| 101 |
+
<class>Sulopa_Producttabs_Block</class>
|
| 102 |
+
</producttabs>
|
| 103 |
+
</blocks>
|
| 104 |
+
<helpers>
|
| 105 |
+
<producttabs>
|
| 106 |
+
<class>Sulopa_Producttabs_Helper</class>
|
| 107 |
+
</producttabs>
|
| 108 |
+
</helpers>
|
| 109 |
+
</global>
|
| 110 |
+
<default>
|
| 111 |
+
<producttabs>
|
| 112 |
+
<producttabs_config>
|
| 113 |
+
<enabled>1</enabled>
|
| 114 |
+
<jquery>1</jquery>
|
| 115 |
+
<title>Product Tabs</title>
|
| 116 |
+
<auto>0</auto>
|
| 117 |
+
<speed>3000</speed>
|
| 118 |
+
<minslides>3</minslides>
|
| 119 |
+
<maxslides>5</maxslides>
|
| 120 |
+
<sort_name>asc</sort_name>
|
| 121 |
+
<slidewidth>270</slidewidth>
|
| 122 |
+
<width_thumbnail>272</width_thumbnail>
|
| 123 |
+
<height_thumbnail>272</height_thumbnail> <width_large_thumbnail>569</width_large_thumbnail> <height_large_thumbnail>569</height_large_thumbnail>
|
| 124 |
+
<product_review>0</product_review>
|
| 125 |
+
</producttabs_config>
|
| 126 |
+
<featured_product>
|
| 127 |
+
<title>Featured Products</title>
|
| 128 |
+
<heading_block>Featured Products</heading_block>
|
| 129 |
+
<enable_featuredproduct>1</enable_featuredproduct>
|
| 130 |
+
</featured_product>
|
| 131 |
+
<product_show>
|
| 132 |
+
<product_type>featured,bestseller</product_type>
|
| 133 |
+
<product_number>10</product_number>
|
| 134 |
+
<product_action>compare,cart,wishlist</product_action>
|
| 135 |
+
</product_show>
|
| 136 |
+
</producttabs>
|
| 137 |
+
</default>
|
| 138 |
+
</config>
|
app/code/local/Sulopa/Producttabs/etc/system.xml
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<sulopa translate="label">
|
| 5 |
+
<label>Sulopa Extension</label>
|
| 6 |
+
<sort_order>300</sort_order>
|
| 7 |
+
</sulopa>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<producttabs translate="label" module="producttabs">
|
| 11 |
+
<label>Product Tabs</label>
|
| 12 |
+
<tab>sulopa</tab>
|
| 13 |
+
<sort_order>200</sort_order>
|
| 14 |
+
<show_in_default>1</show_in_default>
|
| 15 |
+
<show_in_website>1</show_in_website>
|
| 16 |
+
<show_in_store>1</show_in_store>
|
| 17 |
+
<groups>
|
| 18 |
+
<producttabs_config translate="label">
|
| 19 |
+
<label>Product Tabs Config</label>
|
| 20 |
+
<frontend_type>text</frontend_type>
|
| 21 |
+
<sort_order>1</sort_order>
|
| 22 |
+
<show_in_default>1</show_in_default>
|
| 23 |
+
<show_in_website>1</show_in_website>
|
| 24 |
+
<show_in_store>1</show_in_store>
|
| 25 |
+
<fields>
|
| 26 |
+
<enabled translate="label comment">
|
| 27 |
+
<label>Enabled: </label>
|
| 28 |
+
<frontend_type>select</frontend_type>
|
| 29 |
+
<source_model>
|
| 30 |
+
adminhtml/system_config_source_yesno
|
| 31 |
+
</source_model>
|
| 32 |
+
<sort_order>0</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 |
+
<auto translate="label comment">
|
| 38 |
+
<label>Auto slide: </label>
|
| 39 |
+
<frontend_type>select</frontend_type>
|
| 40 |
+
<source_model>
|
| 41 |
+
adminhtml/system_config_source_yesno
|
| 42 |
+
</source_model>
|
| 43 |
+
<sort_order>1</sort_order>
|
| 44 |
+
<show_in_default>1</show_in_default>
|
| 45 |
+
<show_in_website>1</show_in_website>
|
| 46 |
+
<show_in_store>1</show_in_store>
|
| 47 |
+
</auto>
|
| 48 |
+
<title translate="label">
|
| 49 |
+
<label>Title: </label>
|
| 50 |
+
<frontend_type>text</frontend_type>
|
| 51 |
+
<sort_order>2</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 |
+
</title>
|
| 56 |
+
<speed translate="label">
|
| 57 |
+
<label>Slide Speed: </label>
|
| 58 |
+
<frontend_type>text</frontend_type>
|
| 59 |
+
<sort_order>16></sort_order>
|
| 60 |
+
<show_in_default>1</show_in_default>
|
| 61 |
+
<show_in_store>1</show_in_store>
|
| 62 |
+
<show_in_website>1</show_in_website>
|
| 63 |
+
</speed>
|
| 64 |
+
<minslides translate="label">
|
| 65 |
+
<label>Min Item Slider: </label>
|
| 66 |
+
<frontend_type>text</frontend_type>
|
| 67 |
+
<sort_order>18</sort_order>
|
| 68 |
+
<show_in_default>1</show_in_default>
|
| 69 |
+
<show_in_website>1</show_in_website>
|
| 70 |
+
<show_in_store>1</show_in_store>
|
| 71 |
+
</minslides>
|
| 72 |
+
<maxslides translate="label">
|
| 73 |
+
<label>Max Item Slider: </label>
|
| 74 |
+
<frontend_type>text</frontend_type>
|
| 75 |
+
<sort_order>20</sort_order>
|
| 76 |
+
<show_in_default>1</show_in_default>
|
| 77 |
+
<show_in_website>1</show_in_website>
|
| 78 |
+
<show_in_store>1</show_in_store>
|
| 79 |
+
</maxslides>
|
| 80 |
+
<pager translate="label comment">
|
| 81 |
+
<label>Show navigation control: </label>
|
| 82 |
+
<frontend_type>select</frontend_type>
|
| 83 |
+
<source_model>
|
| 84 |
+
adminhtml/system_config_source_yesno
|
| 85 |
+
</source_model>
|
| 86 |
+
<sort_order>21</sort_order>
|
| 87 |
+
<show_in_default>1</show_in_default>
|
| 88 |
+
<show_in_website>1</show_in_website>
|
| 89 |
+
<show_in_store>1</show_in_store>
|
| 90 |
+
</pager>
|
| 91 |
+
<slidewidth translate="label">
|
| 92 |
+
<label>Width of Item: </label>
|
| 93 |
+
<frontend_type>text</frontend_type>
|
| 94 |
+
<sort_order>27</sort_order>
|
| 95 |
+
<show_in_default>1</show_in_default>
|
| 96 |
+
<show_in_website>1</show_in_website>
|
| 97 |
+
<show_in_store>1</show_in_store>
|
| 98 |
+
</slidewidth>
|
| 99 |
+
<width_thumbnail translate="label">
|
| 100 |
+
<label>Width of Thumbnail: </label>
|
| 101 |
+
<frontend_type>text</frontend_type>
|
| 102 |
+
<sort_order>28</sort_order>
|
| 103 |
+
<show_in_default>1</show_in_default>
|
| 104 |
+
<show_in_website>1</show_in_website>
|
| 105 |
+
<show_in_store>1</show_in_store>
|
| 106 |
+
</width_thumbnail>
|
| 107 |
+
<height_thumbnail translate="label">
|
| 108 |
+
<label>Height of Thumbnail: </label>
|
| 109 |
+
<frontend_type>text</frontend_type>
|
| 110 |
+
<sort_order>30</sort_order>
|
| 111 |
+
<show_in_default>1</show_in_default>
|
| 112 |
+
<show_in_website>1</show_in_website>
|
| 113 |
+
<show_in_store>1</show_in_store>
|
| 114 |
+
</height_thumbnail> <width_large_thumbnail translate="label"> <label>Width (Large) of Thumbnail: </label> <frontend_type>text</frontend_type> <sort_order>31</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </width_large_thumbnail> <height_large_thumbnail translate="label"> <label>Height (Large Item) of Thumbnail: </label> <frontend_type>text</frontend_type> <sort_order>32</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </height_large_thumbnail>
|
| 115 |
+
<product_review>
|
| 116 |
+
<label>Review</label>
|
| 117 |
+
<frontend_type>select</frontend_type>
|
| 118 |
+
<source_model>
|
| 119 |
+
adminhtml/system_config_source_yesno
|
| 120 |
+
</source_model>
|
| 121 |
+
<sort_order>33</sort_order>
|
| 122 |
+
<show_in_default>1</show_in_default>
|
| 123 |
+
<show_in_website>1</show_in_website>
|
| 124 |
+
<show_in_store>1</show_in_store>
|
| 125 |
+
</product_review>
|
| 126 |
+
</fields>
|
| 127 |
+
</producttabs_config>
|
| 128 |
+
<featured_product translate="label">
|
| 129 |
+
<label>Featured Product Setting</label>
|
| 130 |
+
<frontend_type>text</frontend_type>
|
| 131 |
+
<sort_order>3</sort_order>
|
| 132 |
+
<show_in_default>1</show_in_default>
|
| 133 |
+
<show_in_website>1</show_in_website>
|
| 134 |
+
<show_in_store>1</show_in_store>
|
| 135 |
+
<fields>
|
| 136 |
+
<enable_featuredproduct translate="label">
|
| 137 |
+
<label>Enable Featured Products</label>
|
| 138 |
+
<frontend_type>select</frontend_type>
|
| 139 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 140 |
+
<sort_order>0</sort_order>
|
| 141 |
+
<show_in_default>1</show_in_default>
|
| 142 |
+
<show_in_website>1</show_in_website>
|
| 143 |
+
<show_in_store>1</show_in_store>
|
| 144 |
+
</enable_featuredproduct>
|
| 145 |
+
<title translate="label comment">
|
| 146 |
+
<label>Title</label>
|
| 147 |
+
<frontend_type>text</frontend_type>
|
| 148 |
+
<sort_order>5</sort_order>
|
| 149 |
+
<show_in_default>1</show_in_default>
|
| 150 |
+
<show_in_website>1</show_in_website>
|
| 151 |
+
<show_in_store>1</show_in_store>
|
| 152 |
+
</title>
|
| 153 |
+
</fields>
|
| 154 |
+
</featured_product>
|
| 155 |
+
<product_show>
|
| 156 |
+
<label>Product show</label>
|
| 157 |
+
<frontend_type>text</frontend_type>
|
| 158 |
+
<sort_order>10</sort_order>
|
| 159 |
+
<show_in_default>1</show_in_default>
|
| 160 |
+
<show_in_website>1</show_in_website>
|
| 161 |
+
<show_in_store>1</show_in_store>
|
| 162 |
+
<fields>
|
| 163 |
+
<product_type translate="label comment">
|
| 164 |
+
<label>Show Type Product: </label>
|
| 165 |
+
<frontend_type>multiselect</frontend_type>
|
| 166 |
+
<source_model>
|
| 167 |
+
producttabs/system_config_type
|
| 168 |
+
</source_model>
|
| 169 |
+
<sort_order>0</sort_order>
|
| 170 |
+
<show_in_default>1</show_in_default>
|
| 171 |
+
<show_in_website>1</show_in_website>
|
| 172 |
+
<show_in_store>1</show_in_store>
|
| 173 |
+
</product_type>
|
| 174 |
+
<product_number translate="label">
|
| 175 |
+
<label>Number Product Show: </label>
|
| 176 |
+
<frontend_type>text</frontend_type>
|
| 177 |
+
<sort_order>20</sort_order>
|
| 178 |
+
<show_in_default>1</show_in_default>
|
| 179 |
+
<show_in_website>1</show_in_website>
|
| 180 |
+
<show_in_store>1</show_in_store>
|
| 181 |
+
</product_number>
|
| 182 |
+
<product_action translate="label">
|
| 183 |
+
<label>Show Action Product: </label>
|
| 184 |
+
<frontend_type>select</frontend_type>
|
| 185 |
+
<source_model>producttabs/system_config_action</source_model>
|
| 186 |
+
<sort_order>40</sort_order>
|
| 187 |
+
<show_in_default>1</show_in_default>
|
| 188 |
+
<show_in_website>1</show_in_website>
|
| 189 |
+
<show_in_store>1</show_in_store>
|
| 190 |
+
</product_action>
|
| 191 |
+
</fields>
|
| 192 |
+
</product_show>
|
| 193 |
+
</groups>
|
| 194 |
+
</producttabs>
|
| 195 |
+
</sections>
|
| 196 |
+
</config>
|
app/code/local/Sulopa/Producttabs/sql/producttabs_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$this->startSetup();
|
| 3 |
+
$this->addAttribute('catalog_product', 'su_featured_product', array(
|
| 4 |
+
'group' => 'General',
|
| 5 |
+
'type' => 'int',
|
| 6 |
+
'backend' => '',
|
| 7 |
+
'frontend' => '',
|
| 8 |
+
'label' => 'Featured product',
|
| 9 |
+
'input' => 'boolean',
|
| 10 |
+
'class' => '',
|
| 11 |
+
'source' => '',
|
| 12 |
+
'is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
| 13 |
+
'visible' => true,
|
| 14 |
+
'required' => false,
|
| 15 |
+
'user_defined' => false,
|
| 16 |
+
'default' => '0',
|
| 17 |
+
'searchable' => false,
|
| 18 |
+
'filterable' => false,
|
| 19 |
+
'comparable' => false,
|
| 20 |
+
'visible_on_front' => false,
|
| 21 |
+
'unique' => false,
|
| 22 |
+
'apply_to' => 'simple,configurable,virtual,bundle,downloadable',
|
| 23 |
+
'is_configurable' => false,
|
| 24 |
+
'used_in_product_listing', '1'
|
| 25 |
+
));
|
| 26 |
+
$this->endSetup();
|
app/etc/modules/Sulopa_Fbfanbox.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Sulopa_Fbfanbox>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>local</codePool>
|
| 7 |
+
</Sulopa_Fbfanbox>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
js/tinybox/tinybox.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var TINY={};
|
| 2 |
+
|
| 3 |
+
function T$(i){return document.getElementById(i)}
|
| 4 |
+
|
| 5 |
+
TINY.box=function(){
|
| 6 |
+
var p,m,b,fn,ic,iu,iw,ih,ia,f=0;
|
| 7 |
+
return{
|
| 8 |
+
show:function(c,u,w,h,a,t){
|
| 9 |
+
if(!f){
|
| 10 |
+
p=document.createElement('div'); p.id='tinybox';
|
| 11 |
+
m=document.createElement('div'); m.id='tinymask';
|
| 12 |
+
b=document.createElement('div'); b.id='tinycontent';
|
| 13 |
+
document.body.appendChild(m); document.body.appendChild(p); p.appendChild(b);
|
| 14 |
+
m.onclick=TINY.box.hide; window.onresize=TINY.box.resize; f=1
|
| 15 |
+
}
|
| 16 |
+
if(!a&&!u){
|
| 17 |
+
p.style.width=w?w+'px':'auto'; p.style.height=h?h+'px':'auto';
|
| 18 |
+
p.style.backgroundImage='none'; b.innerHTML=c
|
| 19 |
+
}else{
|
| 20 |
+
b.style.display='none'; p.style.width=p.style.height='100px'
|
| 21 |
+
}
|
| 22 |
+
this.mask();
|
| 23 |
+
ic=c; iu=u; iw=w; ih=h; ia=a; this.alpha(m,1,80,3);
|
| 24 |
+
if(t){setTimeout(function(){TINY.box.hide()},1000*t)}
|
| 25 |
+
},
|
| 26 |
+
fill:function(c,u,w,h,a){
|
| 27 |
+
if(u){
|
| 28 |
+
p.style.backgroundImage='';
|
| 29 |
+
var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
|
| 30 |
+
x.onreadystatechange=function(){
|
| 31 |
+
if(x.readyState==4&&x.status==200){TINY.box.psh(x.responseText,w,h,a)}
|
| 32 |
+
};
|
| 33 |
+
x.open('GET',c,1); x.send(null)
|
| 34 |
+
}else{
|
| 35 |
+
this.psh(c,w,h,a)
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
psh:function(c,w,h,a){
|
| 39 |
+
if(a){
|
| 40 |
+
if(!w||!h){
|
| 41 |
+
var x=p.style.width, y=p.style.height; b.innerHTML=c;
|
| 42 |
+
p.style.width=w?w+'px':''; p.style.height=h?h+'px':'';
|
| 43 |
+
b.style.display='';
|
| 44 |
+
w=parseInt(b.offsetWidth); h=parseInt(b.offsetHeight);
|
| 45 |
+
b.style.display='none'; p.style.width=x; p.style.height=y;
|
| 46 |
+
}else{
|
| 47 |
+
b.innerHTML=c
|
| 48 |
+
}
|
| 49 |
+
this.size(p,w,h)
|
| 50 |
+
}else{
|
| 51 |
+
p.style.backgroundImage='none'
|
| 52 |
+
}
|
| 53 |
+
},
|
| 54 |
+
hide:function(){
|
| 55 |
+
TINY.box.alpha(p,-1,0,3)
|
| 56 |
+
},
|
| 57 |
+
resize:function(){
|
| 58 |
+
TINY.box.pos(); TINY.box.mask()
|
| 59 |
+
},
|
| 60 |
+
mask:function(){
|
| 61 |
+
m.style.height=TINY.page.total(1)+'px';
|
| 62 |
+
m.style.width=''; m.style.width=TINY.page.total(0)+'px'
|
| 63 |
+
},
|
| 64 |
+
pos:function(){
|
| 65 |
+
var t=(TINY.page.height()/2)-(p.offsetHeight/2); t=t<10?10:t;
|
| 66 |
+
p.style.top=(t+TINY.page.top())+'px';
|
| 67 |
+
p.style.left=(TINY.page.width()/2)-(p.offsetWidth/2)+'px'
|
| 68 |
+
},
|
| 69 |
+
alpha:function(e,d,a){
|
| 70 |
+
clearInterval(e.ai);
|
| 71 |
+
if(d==1){
|
| 72 |
+
e.style.opacity=0; e.style.filter='alpha(opacity=0)';
|
| 73 |
+
e.style.display='block'; this.pos()
|
| 74 |
+
}
|
| 75 |
+
e.ai=setInterval(function(){TINY.box.ta(e,a,d)},20)
|
| 76 |
+
},
|
| 77 |
+
ta:function(e,a,d){
|
| 78 |
+
var o=Math.round(e.style.opacity*100);
|
| 79 |
+
if(o==a){
|
| 80 |
+
clearInterval(e.ai);
|
| 81 |
+
if(d==-1){
|
| 82 |
+
e.style.display='none';
|
| 83 |
+
e==p?TINY.box.alpha(m,-1,0,2):b.innerHTML=p.style.backgroundImage=''
|
| 84 |
+
}else{
|
| 85 |
+
e==m?this.alpha(p,1,100):TINY.box.fill(ic,iu,iw,ih,ia)
|
| 86 |
+
}
|
| 87 |
+
}else{
|
| 88 |
+
var n=Math.ceil((o+((a-o)*.5))); n=n==1?0:n;
|
| 89 |
+
e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')'
|
| 90 |
+
}
|
| 91 |
+
},
|
| 92 |
+
size:function(e,w,h){
|
| 93 |
+
e=typeof e=='object'?e:T$(e); clearInterval(e.si);
|
| 94 |
+
var ow=e.offsetWidth, oh=e.offsetHeight,
|
| 95 |
+
wo=ow-parseInt(e.style.width), ho=oh-parseInt(e.style.height);
|
| 96 |
+
var wd=ow-wo>w?0:1, hd=(oh-ho>h)?0:1;
|
| 97 |
+
e.si=setInterval(function(){TINY.box.ts(e,w,wo,wd,h,ho,hd)},20)
|
| 98 |
+
},
|
| 99 |
+
ts:function(e,w,wo,wd,h,ho,hd){
|
| 100 |
+
var ow=e.offsetWidth-wo, oh=e.offsetHeight-ho;
|
| 101 |
+
if(ow==w&&oh==h){
|
| 102 |
+
clearInterval(e.si); p.style.backgroundImage='none'; b.style.display='block'
|
| 103 |
+
}else{
|
| 104 |
+
if(ow!=w){var n=ow+((w-ow)*.5); e.style.width=wd?Math.ceil(n)+'px':Math.floor(n)+'px'}
|
| 105 |
+
if(oh!=h){var n=oh+((h-oh)*.5); e.style.height=hd?Math.ceil(n)+'px':Math.floor(n)+'px'}
|
| 106 |
+
this.pos()
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
}();
|
| 111 |
+
|
| 112 |
+
TINY.page=function(){
|
| 113 |
+
return{
|
| 114 |
+
top:function(){return document.documentElement.scrollTop||document.body.scrollTop},
|
| 115 |
+
width:function(){return self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},
|
| 116 |
+
height:function(){return self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},
|
| 117 |
+
total:function(d){
|
| 118 |
+
var b=document.body, e=document.documentElement;
|
| 119 |
+
return d?Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight)):
|
| 120 |
+
Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth))
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
}();
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>facebook-mag-ex</name>
|
| 4 |
+
<version>1.0.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>Fanbox is a free extension that enables you to show a box of Fanpage on your site.</summary>
|
| 10 |
+
<description>Facebook is the most popular social networking site these days. To sell more products and connect to network citizens, many companies, organizations and stores have created their own Facebook fan page. But how to attract a lot of facebook users to join you? We would like to introduce an easy way to achieve that goal; that is using our free Magento extension Facebook fanbox. The fanbox of your Facebook fanpage will appear right in your website, enabling visitors to click “like” to become a fan and keep up with your store’s updates.</description>
|
| 11 |
+
<notes>Version 1.0.0</notes>
|
| 12 |
+
<authors><author><name>Sulopa Sulotion</name><user>sulopa</user><email>info@sulopa.com</email></author></authors>
|
| 13 |
+
<date>2015-08-03</date>
|
| 14 |
+
<time>08:01:41</time>
|
| 15 |
+
<contents><target name="magelocal"><dir name="Sulopa"><dir name="Fbfanbox"><dir name="Block"><file name="Fbfanbox.php" hash="76bf6e399d86304dc08c3336fdd8899d"/></dir><dir name="Helper"><file name="Data.php" hash="733b5deccba10fc896fb28176c763889"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8c1436ed4c187e1f266fdb831edd0505"/><file name="config.xml" hash="0ea0f3ff50005950457bdb2e5c4031fc"/><file name="system.xml" hash="d4b16877368ebff6fd5fd42383f109b9"/></dir><dir name="sql"><dir name="fbfanbox_setup"><file name="mysql4-install-0.1.0.php" hash="a3c7f4644d12a2696f421b8d1d86e548"/></dir></dir></dir><dir name="Featuredproduct"><dir name="Block"><file name="Featuredproduct.php" hash="f17bae730adba396eaab630fa6552ef2"/></dir><dir name="Helper"><file name="Data.php" hash="76d53ff0206ecc190a225be4eddc941a"/></dir><dir name="Model"><dir name="Config"><file name="Direction.php" hash="374cbe2ef865efe0a6864475cb0a8aae"/><file name="Sort.php" hash="6483687753647d19a9cc8010e1cb44d3"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="3a9946ab6f70c3315a78f7f624d77f55"/><file name="config.xml" hash="a59c2a674ff1d23ccad409a032e72840"/><file name="system.xml" hash="082315def4910781d3de26a560d67368"/></dir><dir name="sql"><dir name="featuredproduct_setup"><file name="mysql4-install-0.1.0.php" hash="a6edcbc6aff141cda4518363476adbfe"/></dir></dir></dir><dir name="Newssubscribers"><dir name="Block"><file name="Newssubscribers.php" hash="7e3e66ae5a9322598166c5e9e5f03fa4"/></dir><dir name="Helper"><file name="Data.php" hash="891bd04d325cbb13babcbbcc8cbd3c32"/></dir><dir name="Model"><file name="Subscriber.php" hash="88a254863e8d77cfc66073a2bf4a26c3"/><dir name="System"><dir name="Config"><file name="Coupon.php" hash="51bb46e223fb15980a182a67542b2b47"/><file name="Couponlist.php" hash="a327dfd388bd6c619633702f24f3c3b6"/><file name="Template.php" hash="a60ec6cef1593ea81b31f4d8c013a9a4"/></dir></dir></dir><dir name="controllers"><file name="SubscriberController.php" hash="d7f19c081ab70af849c6ff5368eb0478"/></dir><dir name="etc"><file name="adminhtml.xml" hash="60bc14247201f67f9ec06f7f6a7ddcf9"/><file name="config.xml" hash="f232e97cec9b9b754b9f15184e290758"/><file name="system.xml" hash="be13b69f577d4b844dd83a2d3d044c60"/></dir></dir><dir name="Producttabs"><dir name="Block"><dir name="Adminhtml"><dir name="Edit"><file name="Grid.php" hash="88eef9c023b26d11c8da411fd6775605"/><dir name="Renderer"><file name="Visibility.php" hash="fec7470ada4d065a37f6da7555666e24"/></dir></dir><file name="Edit.php" hash="6bfe4efc0d7902b6a20d2c5103799edb"/></dir><dir name="Product"><file name="List.php" hash="a496a8f6b37e0d5b0c88cd1b695b6d32"/></dir><file name="Producttabs.php" hash="6870b1b5b97a1f04f444d17978b5835b"/></dir><dir name="Helper"><file name="Data.php" hash="ad57074b2fdaaa044a6fc0c9807ae81d"/></dir><dir name="Model"><dir name="Resource"><dir name="Product"><file name="Bestseller.php" hash="10e631131fb2ea1d7956590b4394f601"/></dir></dir><dir name="System"><dir name="Config"><file name="Action.php" hash="c6fe0fecd5ae38b91bc95fe1dc7c64f2"/><file name="Sort.php" hash="484833d9e93c9ae9ee3fb22e998b3c48"/><file name="Type.php" hash="2a0511f6ebcef0f959ad23dd87754b04"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FeaturedController.php" hash="9e7174afbb5b0a84c87920fa260be1aa"/></dir><file name="IndexController.php" hash="4d082fc5bb085e10661dfb3c7d16469b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="dbe25da4cc537d318be3134aeb596781"/><file name="config.xml" hash="789aee3d805df7c7e7969f72526f2032"/><file name="system.xml" hash="9caf0fcc0d369d5cbfe3783c545563a7"/></dir><dir name="sql"><dir name="producttabs_setup"><file name="mysql4-install-0.1.0.php" hash="0a0bc915fc3022c8fd48dee6214e6434"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sulopa_Fbfanbox.xml" hash="0f7dd5cbb14e44d7efb927beb73e4d02"/></dir></target><target name="mage"><dir name="js"><dir name="tinybox"><file name="tinybox.js" hash="2ca7fcb7fefc5e8d85887f3c6dc6e315"/></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>
|
