AdvertiseUpsellProducts - Version 1.0.0

Version Notes

v1.0.0 - This is the first release of upsell products.

Download this release

Release Info

Developer Michael
Extension AdvertiseUpsellProducts
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

README-Advertise-Up-Sell.txt ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Step 1
2
+ ======
3
+ Find the template file upsell.phtml used by your theme. You should find it in:
4
+ app/design/frontend/<theme-package>/<theme-name>/template/catalog/product/list
5
+
6
+ Add these lines at the top of the file:
7
+ <div id="advupsell">
8
+ <script type="text/javascript">if(adv_upsell_reload){loadAdvertiseUpsellProducts();adv_upsell_reload=false;}</script>
9
+
10
+ And add this line at the end of the file:
11
+ </div>
12
+
13
+ Step 2
14
+ ======
15
+ Find the template file head.phtml used by your theme. You should find it in:
16
+ app/design/frontend/<theme-package>/<theme-name>/template/page/html
17
+
18
+ Add this script tag within the head:
19
+ <script type="text/javascript"><?php echo Mage::helper('advertise_retailintelligence')->getAdvertiseHeaderScript(); ?></script>
app/code/community/Advertise/UpsellProducts/Block/Adminhtml/UpsellProducts.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * UpsellProducts.php
4
+ *
5
+ * Backend block
6
+ *
7
+ * @package Advertise_UpsellProducts
8
+ */
9
+ class Advertise_UpsellProducts_Block_Adminhtml_UpsellProducts extends Mage_Adminhtml_Block_Template
10
+ {
11
+ const ADVERTISE_EMAIL = 'advertise_settings/settings/settings_email';
12
+
13
+ public function getAdvertiseEmail() {
14
+ return Mage::getStoreConfig(self::ADVERTISE_EMAIL);
15
+ }
16
+
17
+ /**
18
+ * Get the base url
19
+ *
20
+ * @return string
21
+ */
22
+ public function getBaseUrl()
23
+ {
24
+ return str_replace('http://', '', Mage::getStoreConfig('web/unsecure/base_url'));
25
+ }
26
+
27
+ }
28
+ ?>
app/code/community/Advertise/UpsellProducts/Block/Index.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Index.php
4
+ *
5
+ * @package Advertise_UpsellProducts
6
+ */
7
+ class Advertise_UpsellProducts_Block_Index extends Mage_Core_Block_Template{
8
+
9
+ }
app/code/community/Advertise/UpsellProducts/Block/Upsell.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Advertise
4
+ * Catalog product upsell items block
5
+ *
6
+ * @category Advertise
7
+ * @package Advertise_UpsellProducts
8
+ */
9
+
10
+ class Advertise_UpsellProducts_Block_Upsell extends Mage_Catalog_Block_Product_List_Upsell
11
+ {
12
+ /**
13
+ * Default MAP renderer type
14
+ *
15
+ * @var string
16
+ */
17
+ protected $_mapRenderer = 'msrp_noform';
18
+
19
+ protected $_itemCollection;
20
+
21
+ protected function _prepareData() {
22
+ // Get product
23
+ //$product = Mage::registry('product');
24
+ $prodid = $this->getRequest()->getParam('id');
25
+ $product = Mage::getModel('catalog/product')->load($prodid);
26
+
27
+ // Get upsell product IDs from request
28
+ $ids = $this->getRequest()->getParam('ids');
29
+ if (!$ids) {
30
+ $ids = array();
31
+ }
32
+ array_push($ids, '0');
33
+
34
+ // Get count of upsell products required
35
+ $upsellCount = Mage::getStoreConfig('advertise_upsellproducts_options/advertise_upsell_products/advertise_prod_count');
36
+
37
+ // Get collection of products
38
+ $upsells = Mage::getResourceModel('catalog/product_collection');
39
+
40
+ // Select which fields to load into the product
41
+ // * will load all fields but it is possible to pass an array of select fields to load
42
+ $upsells->addAttributeToSelect('*');
43
+
44
+ // Add list of IDs to select
45
+ $i = 0;
46
+ $conditions = array();
47
+ foreach ($ids as $id) {
48
+ if ($i < $upsellCount) {
49
+ array_push($conditions, array('attribute' => 'entity_id', 'eq' => $id));
50
+ } else {
51
+ // Have enough upsell products
52
+ break;
53
+ }
54
+ $i++;
55
+ }
56
+ $upsells->addAttributeToFilter($conditions);
57
+
58
+ // Ensure the product is enabled
59
+ $upsells->addAttributeToFilter('status', 1);
60
+
61
+ // For DEBUG: Print out the SQL query generated by the collection object so far
62
+ // Mage::log('SELECT QUERY: ' . $upsells->getSelect());
63
+
64
+ // Load the collection
65
+ $upsells->load();
66
+
67
+ $this->_itemCollection = new Varien_Data_Collection();
68
+ foreach ($upsells as $item) {
69
+ $this->_itemCollection->addItem($item);
70
+ }
71
+
72
+ // If we've got enough upsell products then we're done.
73
+ if (count($this->_itemCollection) == $upsellCount) {
74
+ foreach ($this->_itemCollection as $product) {
75
+ $product->setDoNotUseCategoryId(true);
76
+ }
77
+ return $this;
78
+ }
79
+
80
+ // Not enough upsell products yet so look in Magento DB to see if any are set for product.
81
+ // This section based on base Magento code from Upsell.php
82
+ $upsells2 = $product->getUpSellProductCollection()
83
+ ->setPositionOrder()
84
+ ->addStoreFilter()
85
+ ;
86
+
87
+ if (Mage::helper('catalog')->isModuleEnabled('Mage_Checkout')) {
88
+ Mage::getResourceSingleton('checkout/cart')->addExcludeProductFilter($upsells2,
89
+ Mage::getSingleton('checkout/session')->getQuoteId()
90
+ );
91
+ $this->_addProductAttributesAndPrices($upsells2);
92
+ }
93
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($upsells2);
94
+ if ($this->getItemLimit('upsell') > 0) {
95
+ $upsells2->setPageSize($this->getItemLimit('upsell'));
96
+ }
97
+ $upsells2->load();
98
+
99
+ /**
100
+ * Updating collection with desired items
101
+ */
102
+ // TODO: Check why this is here for Upsells but not Related Products.
103
+ // TODO: Check if this causes problems for e.g. recognising the items added earlier by Adverti.se
104
+ Mage::dispatchEvent('catalog_product_upsell', array(
105
+ 'product' => $product,
106
+ 'collection' => $this->_itemCollection,
107
+ 'limit' => $this->getItemLimit()
108
+ ));
109
+
110
+ // Add items from DB to related products
111
+ foreach ($upsells2 as $item) {
112
+ $this->_itemCollection->addItem($item);
113
+ // If we've got enough upsell products then we're done.
114
+ if (count($this->_itemCollection) == $upsellCount) {
115
+ foreach ($this->_itemCollection as $product) {
116
+ $product->setDoNotUseCategoryId(true);
117
+ }
118
+ return $this;
119
+ }
120
+ }
121
+
122
+ // Still haven't got the required number of upsell products so fill up with random products
123
+ $numRandomsToGet = $upsellCount - count($this->_itemCollection);
124
+
125
+ // Get random products
126
+ $randCollection = Mage::getResourceModel('catalog/product_collection');
127
+ Mage::getModel('catalog/layer')->prepareProductCollection($randCollection);
128
+ $randCollection->getSelect()->order('rand()');
129
+ $randCollection->addStoreFilter();
130
+ $randCollection->setPage(1, $numRandomsToGet);
131
+ // Don't get items we already have
132
+ $exclude = $this->_itemCollection->getAllIds();
133
+ $toexclude = array();
134
+ foreach($exclude as $ex) {
135
+ $toexclude[] = $ex;
136
+ }
137
+ // Don't include the current item as an upsell product
138
+ $id = $this->getRequest()->getParam('id');
139
+ if ($id) {
140
+ $toexclude[] = $id;
141
+ }
142
+ // Don't include basket items as upsell products
143
+ $session = Mage::getSingleton('checkout/session');
144
+ foreach ($session->getQuote()->getAllVisibleItems() as $item) {
145
+ $toexclude[] = $item->getProductId();
146
+ }
147
+ $randCollection->addIdFilter($toexclude, true);
148
+ foreach($randCollection as $randProduct)
149
+ {
150
+ $this->_itemCollection->addItem($randProduct);
151
+ }
152
+
153
+ foreach ($this->_itemCollection as $product) {
154
+ $product->setDoNotUseCategoryId(true);
155
+ }
156
+ return $this;
157
+
158
+ }
159
+
160
+ }
app/code/community/Advertise/UpsellProducts/Helper/Data.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Data.php
4
+ *
5
+ * Advertise UpsellProducts Helper
6
+ *
7
+ * @package Advertise_UpsellProducts
8
+ */
9
+ class Advertise_UpsellProducts_Helper_Data extends Mage_Core_Helper_Abstract
10
+ {
11
+
12
+ }
13
+
14
+ ?>
app/code/community/Advertise/UpsellProducts/Model/Config.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Config.php
4
+ *
5
+ * @package Advertise_UpsellProducts
6
+ */
7
+ class Advertise_UpsellProducts_Model_Config extends Varien_Object
8
+ {
9
+ /**
10
+ * Config keys
11
+ */
12
+ //const ENABLED = 'importer/importer_group/enabled';
13
+ const PRODUCT_COUNT = 'advertise_upsellproducts_options/advertise_upsell_products/advertise_prod_count';
14
+ const UPSELL_HEADING = 'advertise_upsellproducts_options/advertise_upsell_products/advertise_upsell_text';
15
+ const ADVERTISE_EMAIL = 'advertise_settings/settings/settings_email';
16
+
17
+ /**
18
+ * Is the module enabled?
19
+ *
20
+ * @return bool
21
+ */
22
+ public function getIsEnabled()
23
+ {
24
+ return (bool) Mage::getStoreConfig(self::ENABLED);
25
+ }
26
+
27
+ /**
28
+ * Get the advertise Email settings.
29
+ *
30
+ * @return string
31
+ */
32
+ public function getAdvertiseEmail()
33
+ {
34
+ return Mage::getStoreConfig(self::ADVERTISE_EMAIL);
35
+ }
36
+
37
+ /**
38
+ * Get the feed download url
39
+ *
40
+ * @return string
41
+ */
42
+ public function getAdvertiseFeed()
43
+ {
44
+ $restore = Mage::getSingleton('core/app') -> getRequest() -> getParam('restore', null);
45
+ $url = 'http://i.adverti.se/feeds/magento/email:' .
46
+ $this->getAdvertiseEmail() .
47
+ '/site:' . $this->getBaseUrl() . 'restore:' . $restore; // No slash before restore as BaseUrl has a trailing slash already
48
+ return $url;
49
+ }
50
+
51
+ /**
52
+ * Get the base url
53
+ *
54
+ * @return string
55
+ */
56
+ public function getBaseUrl()
57
+ {
58
+ return str_replace('http://', '', Mage::getStoreConfig('web/unsecure/base_url'));
59
+ }
60
+
61
+ /**
62
+ * Get our file download url
63
+ *
64
+ * Get from the advertise module if available with fallback to our own settings.
65
+ * Leaving this in because during dev we don't have the other mod installed.
66
+ *
67
+ * @return string
68
+ */
69
+ public function getDownloadUrl()
70
+ {
71
+ // THIS IS FOR LOCAL TESTING ONLY
72
+ //if (true) {
73
+ // return "http://advertise.local/feeds/magento/email:new-magento@adverti.se/site:magento.adverti.se/restore:true";
74
+ //}
75
+
76
+ Mage::log("Upsell Products getDownloadURL self::DOWNLOAD_URL=".Mage::getStoreConfig(self::DOWNLOAD_URL));
77
+ // FOR PRODUCTION
78
+ $advertiseEmail = $this->getAdvertiseEmail();
79
+ if( ! empty($advertiseEmail)) {
80
+ Mage::log("Upsell Products getDownloadURL returning (1): ".$this->getAdvertiseFeed());
81
+ return $this->getAdvertiseFeed();
82
+ }
83
+ Mage::log("Upsell Products getDownloadURL returning (2): ".Mage::getStoreConfig(self::DOWNLOAD_URL));
84
+ return Mage::getStoreConfig(self::DOWNLOAD_URL);
85
+ }
86
+ }
87
+
88
+ ?>
app/code/community/Advertise/UpsellProducts/Model/Resource/Setup.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Custom class for setup of module
4
+ class Advertise_UpsellProducts_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
5
+ }
6
+
7
+ ?>
app/code/community/Advertise/UpsellProducts/controllers/Adminhtml/UpsellProductsController.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * UpsellProductsController.php
4
+ *
5
+ * Backend controller
6
+ *
7
+ * @package Advertise_UpsellProducts
8
+ */
9
+ class Advertise_Importer_Adminhtml_UpsellProductsController extends Mage_Adminhtml_Controller_Action
10
+ {
11
+ /**
12
+ * Default Action
13
+ */
14
+ public function indexAction()
15
+ {
16
+ $this->loadLayout();
17
+ $this->_title($this->__("Upsell Products"));
18
+ $this->renderLayout();
19
+ }
20
+
21
+ public function postAction()
22
+ {
23
+ }
24
+ }
app/code/community/Advertise/UpsellProducts/controllers/IndexController.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Advertise_UpsellProducts Index Controller
4
+ */
5
+ class Advertise_UpsellProducts_IndexController extends Mage_Core_Controller_Front_Action{
6
+ /**
7
+ * Default Action
8
+ * Path to this method: /upsellproducts/index/index
9
+ */
10
+ public function indexAction(){
11
+ // Effectively redirects to home page of store
12
+ $this->loadLayout();
13
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
14
+ $breadcrumbs->addCrumb("home", array(
15
+ "label" => $this->__("Home Page"),
16
+ "title" => $this->__("Home Page"),
17
+ "link" => Mage::getBaseUrl()
18
+ ));
19
+ $this->renderLayout();
20
+ }
21
+
22
+ // Path to this method: /upsellproducts/index/upsellproducts
23
+ public function upsellproductsAction() {
24
+
25
+ }
26
+
27
+ }
28
+ ?>
app/code/community/Advertise/UpsellProducts/controllers/UpsellProductsController.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Advertise_UpsellProducts_UpsellProductsController extends Mage_Core_Controller_Front_Action {
3
+ /**
4
+ * Default Action
5
+ * // Path to this method: /upsellproducts/UpsellProducts/index
6
+ */
7
+ public function indexAction()
8
+ {
9
+ $this->loadLayout();
10
+ $this->_title($this->__("Adverti.se Upsell Products"));
11
+ $this->renderLayout();
12
+ }
13
+
14
+ // Path to this method: /upsellproducts/UpsellProducts/getupsell
15
+ public function getupsellAction() {
16
+ // Create upsell products block with IDs in request
17
+ echo $this->getLayout()->createBlock('catalog/product_list_upsell')->setTemplate('catalog/product/list/upsell.phtml')->toHtml();
18
+ }
19
+
20
+ public function postAction()
21
+ {
22
+
23
+ }
24
+
25
+ }
26
+
27
+ ?>
app/code/community/Advertise/UpsellProducts/data/upsellproducts_setup/data-install-1.0.0.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Setup db
4
+ *
5
+ * @package Advertise_UpsellProducts
6
+ */
7
+
8
+ // No data install required
app/code/community/Advertise/UpsellProducts/etc/config.xml ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <!-- Define module and version number-->
4
+ <modules>
5
+ <Advertise_UpsellProducts>
6
+ <version>1.0.0</version>
7
+ </Advertise_UpsellProducts>
8
+ </modules>
9
+
10
+ <!-- Default values for Module Configuration -->
11
+ <default>
12
+ <advertise_upsellproducts_options>
13
+ <advertise_upsell_products>
14
+ <advertise_prod_count>4</advertise_prod_count>
15
+ <advertise_upsell_text>Upsell Products</advertise_upsell_text>
16
+ </advertise_upsell_products>
17
+ </advertise_upsellproducts_options>
18
+ </default>
19
+
20
+ <admin>
21
+ <routers>
22
+ <upsellproducts>
23
+ <use>admin</use>
24
+ <args>
25
+ <module>Advertise_UpsellProducts</module>
26
+ <frontName>advertise_upsell</frontName>
27
+ </args>
28
+ </upsellproducts>
29
+ </routers>
30
+ </admin>
31
+
32
+ <adminhtml>
33
+ <!-- Add Advertise settings section to ACL -->
34
+ <acl>
35
+ <resources>
36
+ <admin>
37
+ <children>
38
+ <system>
39
+ <children>
40
+ <config>
41
+ <children>
42
+ <!-- Specific to this Adverti.se module -->
43
+ <advertise_upsellproducts_options>
44
+ <title>Adverti.se Upsell Products Module Section</title>
45
+ <sort_order>4</sort_order>
46
+ </advertise_upsellproducts_options>
47
+
48
+ <!-- These two are for the general Adverti.se settings & license -->
49
+ <advertise_settings translate="title">
50
+ <title>Advertise Section</title>
51
+ <sort_order>1</sort_order>
52
+ </advertise_settings>
53
+ <advertise translate="title">
54
+ <title>Advertise</title>
55
+ <sort_order>2</sort_order>
56
+ </advertise>
57
+ </children>
58
+ </config>
59
+ </children>
60
+ </system>
61
+ </children>
62
+ </admin>
63
+ </resources>
64
+ </acl>
65
+ </adminhtml>
66
+
67
+ <global>
68
+ <!-- Define setup resources to run on install e.g. run SQL and data scripts -->
69
+ <resources>
70
+ <upsellproducts_setup>
71
+ <setup>
72
+ <module>Advertise_UpsellProducts</module>
73
+ <class>Advertise_UpsellProducts_Model_Resource_Setup</class>
74
+ </setup>
75
+ </upsellproducts_setup>
76
+ </resources>
77
+
78
+ <!-- Redirect calls to core Mage_Catalog_Block_Product_List_Upsell with Advertise upsell product list -->
79
+ <blocks>
80
+ <catalog>
81
+ <rewrite>
82
+ <product_list_upsell>Advertise_UpsellProducts_Block_Upsell</product_list_upsell>
83
+ </rewrite>
84
+ </catalog>
85
+ </blocks>
86
+
87
+ <!-- Set Helper class -->
88
+ <helpers>
89
+ <advertise_upsellproducts>
90
+ <class>Advertise_UpsellProducts_Helper</class>
91
+ </advertise_upsellproducts>
92
+ </helpers>
93
+
94
+ <!-- Set necessary Models -->
95
+ <models>
96
+ <upsellproducts>
97
+ <class>Advertise_UpsellProducts_Model</class>
98
+ </upsellproducts>
99
+ </models>
100
+ </global>
101
+
102
+ <frontend>
103
+ <routers>
104
+ <!-- the <upsellproducts> tagname appears to be arbitrary, but by
105
+ convention is should match the frontName tag below-->
106
+ <upsellproducts>
107
+ <use>standard</use>
108
+ <args>
109
+ <module>Advertise_UpsellProducts</module>
110
+ <frontName>upsellproducts</frontName>
111
+ </args>
112
+ </upsellproducts>
113
+ </routers>
114
+
115
+ <!-- Add to default page layout -->
116
+ <layout>
117
+ <updates>
118
+ <upsellproducts>
119
+ <file>advertiseupsellproducts.xml</file>
120
+ </upsellproducts>
121
+ </updates>
122
+ </layout>
123
+
124
+ </frontend>
125
+
126
+ </config>
127
+
app/code/community/Advertise/UpsellProducts/etc/system.xml ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <!-- This Adverti.se tab is used by all Adverti.se extensions for config menu!
4
+ So if you change it then need to change in ALL extensions! -->
5
+
6
+ <!-- Top Level Tab -->
7
+ <tabs>
8
+ <Advertise translate="label">
9
+ <label>Advertise</label>
10
+ <sort_order>405</sort_order>
11
+ </Advertise>
12
+ </tabs>
13
+
14
+ <!-- Sections under Adverti.se tab -->
15
+ <sections>
16
+ <!-- Adds config settings input boxes in the Advertise config section -->
17
+ <!-- Access these settings using, e.g.:
18
+ Mage::getStoreConfig('advertise_upsellproducts_options/advertise_upsell_products/advertise_prod_count');
19
+ ANY CHANGES TO THESE KEYS NEEDS TO BE REFLECTED IN Config.php -->
20
+ <advertise_upsellproducts_options translate="label">
21
+ <tab>Advertise</tab>
22
+ <label>Upsell Products</label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>410</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
+ <groups>
29
+ <advertise_upsell_products translate="label">
30
+ <label>Adverti.se Upsell Products</label>
31
+ <frontend_type>text</frontend_type>
32
+ <!--sort_order>1</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
+ <fields>
37
+ <advertise_prod_count translate="label">
38
+ <label>Number of products to display</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>1</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </advertise_prod_count>
45
+
46
+ <advertise_upsell_text translate="label">
47
+ <label>Upsell heading text</label>
48
+ <frontend_type>text</frontend_type>
49
+ <sort_order>2</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </advertise_upsell_text>
54
+ </fields>
55
+ </advertise_upsell_products>
56
+ </groups>
57
+ </advertise_upsellproducts_options>
58
+
59
+ <!-- This 'advertise' node is for the Adverti.se license and should be the same in all extensions -->
60
+ <advertise translate="label">
61
+ <label>License</label>
62
+ <tab>Advertise</tab>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>900</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ <groups>
69
+ <advertise translate="label">
70
+ <label>Adverti.se License</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>1</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <fields>
77
+ <version translate="label comment">
78
+ <label>Extension version</label>
79
+ <frontend_type>Link</frontend_type>
80
+ <sort_order>0</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>0</show_in_website>
83
+ <show_in_store>0</show_in_store>
84
+ </version>
85
+
86
+ <get_online_license translate="label comment">
87
+ <label>Get online license :</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>adminhtml/system_config_source_yesno</source_model>
90
+ <sort_order>1</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>0</show_in_website>
93
+ <show_in_store>0</show_in_store>
94
+ </get_online_license>
95
+
96
+ <license translate="label comment">
97
+ <label>License</label>
98
+ <frontend_type>Advertiselicense</frontend_type>
99
+ <sort_order>2</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>0</show_in_website>
102
+ <show_in_store>0</show_in_store>
103
+ </license>
104
+
105
+ <activated translate="label comment">
106
+ <label>Activate this store :</label>
107
+ <frontend_type>select</frontend_type>
108
+ <source_model>adminhtml/system_config_source_yesno</source_model>
109
+ <sort_order>1</sort_order>
110
+ <show_in_default>0</show_in_default>
111
+ <show_in_website>0</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ </activated>
114
+ </fields>
115
+ </advertise>
116
+ </groups>
117
+ </advertise>
118
+
119
+ <!-- This 'advertise_settings' node is for the general Adverti.se settings (e.g. email) and should be the same in all extensions -->
120
+ <advertise_settings translate="label">
121
+ <class>separator-top</class>
122
+ <label>Settings</label>
123
+ <tab>Advertise</tab>
124
+ <sort_order>130</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ <groups>
129
+ <settings translate="label">
130
+ <label>Settings</label>
131
+ <frontend_type>text</frontend_type>
132
+ <sort_order>5</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ <fields>
137
+ <settings_email translate="label">
138
+ <label>Email</label>
139
+ <frontend_type>text</frontend_type>
140
+ <backend_model>account/config</backend_model>
141
+ <sort_order>30</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
+ </settings_email>
146
+ </fields>
147
+ </settings>
148
+ </groups>
149
+ </advertise_settings>
150
+ </sections>
151
+ </config>
app/code/community/Advertise/UpsellProducts/sql/relatedproducts_setup/install-1.0.0.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Setup db
4
+ *
5
+ * @package Advertise_UpsellProducts
6
+ */
7
+
8
+ $installer = $this;
9
+ $installer->startSetup();
10
+
11
+ // Add individual SQL queries for table setup in "run" blocks like this:
12
+ /*
13
+ $installer->run("
14
+
15
+ ");
16
+ */
17
+
18
+ $installer->endSetup();
app/design/frontend/base/default/layout/advertiseupsellproducts.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <!-- Add Adverti.se scripts and css to head of product pages (handle for product pages is 'catalog_product_view') -->
4
+ <catalog_product_view>
5
+ <reference name="head">
6
+ <!-- jQuery from Google -->
7
+ <block type="core/text" name="google.cdn.jquery">
8
+ <action method="setText">
9
+ <text><![CDATA[<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script><script type="text/javascript">jQuery.noConflict();</script>]]></text>
10
+ </action>
11
+ </block>
12
+
13
+ <!-- Adverti.se JavaScript for upsell products -->
14
+ <block type="core/text" name="adverti.se.retailintelligence.js">
15
+ <action method="setText">
16
+ <text><![CDATA[<script type="text/javascript" src="http://retail.adverti.se/js/retailintelligence-1_0_0.js"></script>]]></text>
17
+ </action>
18
+ </block>
19
+
20
+ <!-- Adverti.se CSS for upsell products -->
21
+ <block type="core/text" name="adverti.se.retailintelligence.css">
22
+ <action method="setText">
23
+ <text><![CDATA[<link rel="stylesheet" type="text/css" href="http://retail.adverti.se/css/retailintelligence-1_0_0.css" media="all" />]]></text>
24
+ </action>
25
+ </block>
26
+ </reference>
27
+ </catalog_product_view>
28
+
29
+ <!-- Layout to get only upsell products block -->
30
+ <advertise_upsell_products_block>
31
+ <remove name="right"/>
32
+ <remove name="left"/>
33
+ <block type="catalog/product/list" name="root" output="toHtml" template="catalog/product/list/upsell.phtml"/>
34
+ </advertise_upsell_products_block>
35
+ </layout>
app/etc/modules/Advertise_UpsellProducts.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <!--
4
+ /**
5
+ * @category Advertise
6
+ * @package Advertise_UpsellProducts
7
+ */
8
+ -->
9
+
10
+ <config>
11
+ <modules>
12
+ <Advertise_UpsellProducts>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ <version>1.0.0</version>
16
+ </Advertise_UpsellProducts>
17
+ </modules>
18
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>AdvertiseUpsellProducts</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>Adverti.se Upsell Products for Magento - Dynamically Updated and Individually Personalised Upsell Products</summary>
10
+ <description>With Adverti.se Upsell Products you get automated Upell product relations.</description>
11
+ <notes>v1.0.0 - This is the first release of upsell products.</notes>
12
+ <authors><author><name>Michael</name><user>Oxley</user><email>mike@adverti.se</email></author></authors>
13
+ <date>2012-10-07</date>
14
+ <time>13:33:13</time>
15
+ <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Advertise_UpsellProducts.xml" hash="4f6e99ec106f66f039a17b1e831ddaf4"/></dir></dir><dir name="code"><dir name="community"><dir name="Advertise"><dir name="UpsellProducts"><dir name="Block"><dir name="Adminhtml"><file name="UpsellProducts.php" hash="c9ff33f8fd41206e64941f735edc9a74"/></dir><file name="Index.php" hash="2bf716a0737f38427248232c20ffc462"/><file name="Upsell.php" hash="d6700f038a15feb8bf3b773c3210ee33"/></dir><dir name="Helper"><file name="Data.php" hash="ca0dfcb6234afd34267bc25bcf3b2d2f"/></dir><dir name="Model"><file name="Config.php" hash="4bbb4dd3c7b16462e2e8569b26021046"/><dir name="Resource"><file name="Setup.php" hash="2ad4d65b99c5dc2974f09d8899839e45"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="UpsellProductsController.php" hash="0255e1d1a6237b3dfcb4efe9bea3aaf2"/></dir><file name="IndexController.php" hash="185cbe7a584c5ce5e7809c1896f7c763"/><file name="UpsellProductsController.php" hash="803c2f83aed7a2d7dc47f1cce5ab0a0a"/></dir><dir name="data"><dir name="upsellproducts_setup"><file name="data-install-1.0.0.php" hash="7c1d96df30727dd985ada4d2bd8f37e1"/></dir></dir><dir name="etc"><file name="config.xml" hash="58814a1f2ca679e88a16d615aadb4fe0"/><file name="system.xml" hash="5d2e06fdae604fa1b2bacc3cbaf06e26"/></dir><dir name="sql"><dir name="relatedproducts_setup"><file name="install-1.0.0.php" hash="13d5e308c0b9f639c757961191840c32"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="advertiseupsellproducts.xml" hash="c8c87a9ccc2ee6ed025161dae2f99c21"/></dir></dir></dir></dir></dir></dir><dir name="."><file name="README-Advertise-Up-Sell.txt" hash="d718d0caba17638f21fddc8140b7c1f0"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>AdvertiseCommunity</name><channel>community</channel><min>1.2.0</min><max>1.2.9</max></package></required></dependencies>
18
+ </package>