Version Notes
First public release
Download this release
Release Info
Developer | James Mikkelson |
Extension | MadCapsule_Zoetrope |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/MadCapsule/Zoetrope/Helper/Data.php +71 -0
- app/code/community/MadCapsule/Zoetrope/Model/Observer.php +88 -0
- app/code/community/MadCapsule/Zoetrope/etc/config.xml +109 -0
- app/code/community/MadCapsule/Zoetrope/etc/system.xml +109 -0
- app/code/community/MadCapsule/Zoetrope/sql/zoetrope_setup/mysql4-install-1.0.0.php +44 -0
- app/design/frontend/default/default/layout/zoetrope.xml +14 -0
- app/design/frontend/default/default/template/catalog/product/view/zoetrope.phtml +76 -0
- app/etc/modules/MadCapsule_Zoetrope.xml +9 -0
- package.xml +18 -0
app/code/community/MadCapsule/Zoetrope/Helper/Data.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Data.php
|
4 |
+
* Created by James Mikkelson on 2014-06-25.
|
5 |
+
*
|
6 |
+
* Licensed under The GPLv2 License
|
7 |
+
* Redistributions of files must retain the above copyright notice
|
8 |
+
*
|
9 |
+
* @link www.madcapsule.com
|
10 |
+
* @author james@madcapsule.co.uk
|
11 |
+
* @license GPLv2 License (http://www.gnu.org/licenses/gpl-2.0.html)
|
12 |
+
*/
|
13 |
+
class MadCapsule_Zoetrope_Helper_Data extends Mage_Core_Helper_Abstract
|
14 |
+
{
|
15 |
+
|
16 |
+
const _zoetrope_cdn = 'https://s3-eu-west-1.amazonaws.com/zoetrope-alpha/';
|
17 |
+
|
18 |
+
public function getSiteId(){
|
19 |
+
|
20 |
+
return Mage::getStoreConfig('zoetrope/general/siteid');
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getWidth(){
|
25 |
+
|
26 |
+
return Mage::getStoreConfig('zoetrope/general/width');
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getHeight(){
|
31 |
+
|
32 |
+
return Mage::getStoreConfig('zoetrope/general/height');
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getStyle(){
|
37 |
+
|
38 |
+
$style = '';
|
39 |
+
|
40 |
+
if(Mage::getStoreConfig('zoetrope/general/inline')){
|
41 |
+
$style = 'data-zoe-inline="true"';
|
42 |
+
}
|
43 |
+
|
44 |
+
return $style;
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getResolution(){
|
49 |
+
|
50 |
+
$resolution = 500;
|
51 |
+
|
52 |
+
if(Mage::getStoreConfig('zoetrope/general/resolution')){
|
53 |
+
$resolution = Mage::getStoreConfig('zoetrope/general/resolution');
|
54 |
+
}
|
55 |
+
|
56 |
+
return $resolution;
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
public function getCdn(){
|
61 |
+
|
62 |
+
$cdn = self::_zoetrope_cdn;
|
63 |
+
|
64 |
+
if(Mage::getStoreConfig('zoetrope/general/cdn')){
|
65 |
+
$cdn = Mage::getStoreConfig('zoetrope/general/cdn');
|
66 |
+
}
|
67 |
+
|
68 |
+
return $cdn;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
app/code/community/MadCapsule/Zoetrope/Model/Observer.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Observer.php
|
4 |
+
* Created by James Mikkelson on 2014-06-25.
|
5 |
+
*
|
6 |
+
* Licensed under The GPLv2 License
|
7 |
+
* Redistributions of files must retain the above copyright notice
|
8 |
+
*
|
9 |
+
* @link www.madcapsule.com
|
10 |
+
* @author james@madcapsule.co.uk
|
11 |
+
* @license GPLv2 License (http://www.gnu.org/licenses/gpl-2.0.html)
|
12 |
+
*/
|
13 |
+
class MadCapsule_Zoetrope_Model_Observer
|
14 |
+
{
|
15 |
+
|
16 |
+
public function trigger_import(){
|
17 |
+
|
18 |
+
if(Mage::getStoreConfig('zoetrope/general/triggerimport')){
|
19 |
+
|
20 |
+
if($this->import()){
|
21 |
+
Mage::getSingleton('core/session')->addSuccess('Zoetrope Import Ran');
|
22 |
+
}else{
|
23 |
+
Mage::getSingleton('core/session')->addWarning('Zoetrope import did not complete. Check your feed URL.');
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
public function import()
|
30 |
+
{
|
31 |
+
|
32 |
+
$feed_url = Mage::getStoreConfig('zoetrope/general/feed');
|
33 |
+
|
34 |
+
if(!$feed_url){
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
|
38 |
+
Mage::log('Zoetrope Import Started');
|
39 |
+
|
40 |
+
if(is_null($feed = $this->getFeed($feed_url))){
|
41 |
+
Mage::log('Unable to get feed');
|
42 |
+
return;
|
43 |
+
}
|
44 |
+
|
45 |
+
$action = Mage::getModel('catalog/resource_product_action');
|
46 |
+
foreach($feed as $image){
|
47 |
+
|
48 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $image->sku);
|
49 |
+
|
50 |
+
if(!$product){
|
51 |
+
Mage::log('Zoetrope image '.$image->zoetrope_id.' not found in Magento');
|
52 |
+
}else{
|
53 |
+
|
54 |
+
$product_update = $action->updateAttributes(array($product->getId()), array(
|
55 |
+
'zoetrope_id' => $image->zoetrope_id,
|
56 |
+
'zoetrope_starting_pos' => $image->zoetrope_start_position
|
57 |
+
), 0);
|
58 |
+
|
59 |
+
$product->unsetData();
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
Mage::log('Zoetrope Import Complete');
|
64 |
+
return true;
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getFeed($feed_url){
|
69 |
+
|
70 |
+
|
71 |
+
try{
|
72 |
+
Zend_Loader::loadClass('Zend_Http_Client');
|
73 |
+
|
74 |
+
}catch(Zend_Http_Client $e) {
|
75 |
+
throw new Exception($this->__('Unable to load Zend_Http_Client.'));
|
76 |
+
}
|
77 |
+
|
78 |
+
$feed = new Zend_Http_Client($feed_url);
|
79 |
+
$response = $feed->request('GET');
|
80 |
+
|
81 |
+
if($response->isError()){
|
82 |
+
return null;
|
83 |
+
}
|
84 |
+
|
85 |
+
return json_decode($response->getBody());
|
86 |
+
|
87 |
+
}
|
88 |
+
}
|
app/code/community/MadCapsule/Zoetrope/etc/config.xml
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<MadCapsule_Zoetrope>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</MadCapsule_Zoetrope>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<zoetrope>
|
11 |
+
<class>MadCapsule_Zoetrope_Model</class>
|
12 |
+
</zoetrope>
|
13 |
+
</models>
|
14 |
+
<resources>
|
15 |
+
<zoetrope_setup>
|
16 |
+
<setup>
|
17 |
+
<module>MadCapsule_Zoetrope</module>
|
18 |
+
</setup>
|
19 |
+
<connection>
|
20 |
+
<use>core_setup</use>
|
21 |
+
</connection>
|
22 |
+
</zoetrope_setup>
|
23 |
+
<zoetrope_write>
|
24 |
+
<connection>
|
25 |
+
<use>core_write</use>
|
26 |
+
</connection>
|
27 |
+
</zoetrope_write>
|
28 |
+
<zoetrope_read>
|
29 |
+
<connection>
|
30 |
+
<use>core_read</use>
|
31 |
+
</connection>
|
32 |
+
</zoetrope_read>
|
33 |
+
</resources>
|
34 |
+
<helpers>
|
35 |
+
<zoetrope>
|
36 |
+
<class>MadCapsule_Zoetrope_Helper</class>
|
37 |
+
</zoetrope>
|
38 |
+
</helpers>
|
39 |
+
<events>
|
40 |
+
<admin_system_config_changed_section_zoetrope>
|
41 |
+
<observers>
|
42 |
+
<zoetrope>
|
43 |
+
<type>singleton</type>
|
44 |
+
<class>zoetrope/observer</class>
|
45 |
+
<method>trigger_import</method>
|
46 |
+
</zoetrope>
|
47 |
+
</observers>
|
48 |
+
</admin_system_config_changed_section_zoetrope>
|
49 |
+
</events>
|
50 |
+
</global>
|
51 |
+
<frontend>
|
52 |
+
<routers>
|
53 |
+
<zoetrope>
|
54 |
+
<use>standard</use>
|
55 |
+
<args>
|
56 |
+
<module>Zoetrope</module>
|
57 |
+
<frontName>zoetrope</frontName>
|
58 |
+
</args>
|
59 |
+
</zoetrope>
|
60 |
+
</routers>
|
61 |
+
<layout>
|
62 |
+
<updates>
|
63 |
+
<madcapsule_zoetrope module="MadCapsule_Zoetrope">
|
64 |
+
<file>zoetrope.xml</file>
|
65 |
+
</madcapsule_zoetrope>
|
66 |
+
</updates>
|
67 |
+
</layout>
|
68 |
+
</frontend>
|
69 |
+
<adminhtml>
|
70 |
+
<acl>
|
71 |
+
<resources>
|
72 |
+
<admin>
|
73 |
+
<children>
|
74 |
+
<system>
|
75 |
+
<children>
|
76 |
+
<config>
|
77 |
+
<children>
|
78 |
+
<zoetrope>
|
79 |
+
<title>Zoetrope</title>
|
80 |
+
</zoetrope>
|
81 |
+
</children>
|
82 |
+
</config>
|
83 |
+
</children>
|
84 |
+
</system>
|
85 |
+
</children>
|
86 |
+
</admin>
|
87 |
+
</resources>
|
88 |
+
</acl>
|
89 |
+
</adminhtml>
|
90 |
+
<default>
|
91 |
+
<zoetrope>
|
92 |
+
<general>
|
93 |
+
<active>0</active>
|
94 |
+
<siteid>[provided by Zoetrope]</siteid>
|
95 |
+
<width>265</width>
|
96 |
+
<height>265</height>
|
97 |
+
<resolution>500</resolution>
|
98 |
+
</general>
|
99 |
+
</zoetrope>
|
100 |
+
</default>
|
101 |
+
<crontab>
|
102 |
+
<jobs>
|
103 |
+
<madcapsule_zoetrope_import>
|
104 |
+
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
105 |
+
<run><model>zoetrope/observer::import</model></run>
|
106 |
+
</madcapsule_zoetrope_import>
|
107 |
+
</jobs>
|
108 |
+
</crontab>
|
109 |
+
</config>
|
app/code/community/MadCapsule/Zoetrope/etc/system.xml
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<zoetrope>
|
5 |
+
<label>Zoetrope</label>
|
6 |
+
<tab>catalog</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>1000</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<general translate="label" module="Catalog">
|
14 |
+
<label>Zoetrope</label>
|
15 |
+
<sort_order>1000</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>0</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<active translate="label">
|
21 |
+
<label>Enabled</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>0</show_in_store>
|
28 |
+
</active>
|
29 |
+
<siteid translate="label">
|
30 |
+
<label>Site ID</label>
|
31 |
+
<frontend_type>text</frontend_type>
|
32 |
+
<sort_order>2</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>0</show_in_store>
|
36 |
+
<depends><active>1</active></depends>
|
37 |
+
</siteid>
|
38 |
+
<width translate="label">
|
39 |
+
<label>Image Width</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>3</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>0</show_in_store>
|
45 |
+
<depends><active>1</active></depends>
|
46 |
+
</width>
|
47 |
+
<height translate="label">
|
48 |
+
<label>Image Height</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>4</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>0</show_in_store>
|
54 |
+
<depends><active>1</active></depends>
|
55 |
+
</height>
|
56 |
+
<resolution translate="label">
|
57 |
+
<label>Resolution</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>0</show_in_store>
|
63 |
+
<comment>250, 500 or 1000</comment>
|
64 |
+
</resolution>
|
65 |
+
<inline translate="label">
|
66 |
+
<label>Inline</label>
|
67 |
+
<frontend_type>select</frontend_type>
|
68 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
69 |
+
<sort_order>6</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>0</show_in_store>
|
73 |
+
<comment>Use the inlime widget rather than the default popover.</comment>
|
74 |
+
</inline>
|
75 |
+
<feed translate="label">
|
76 |
+
<label>Image Feed URL</label>
|
77 |
+
<frontend_type>text</frontend_type>
|
78 |
+
<sort_order>7</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>0</show_in_store>
|
82 |
+
<depends><active>1</active></depends>
|
83 |
+
<comment>[optional] Image JSON feed url provided by Zoetrope.</comment>
|
84 |
+
</feed>
|
85 |
+
<cdn translate="label">
|
86 |
+
<label>Custom CDN</label>
|
87 |
+
<frontend_type>text</frontend_type>
|
88 |
+
<sort_order>8</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>0</show_in_store>
|
92 |
+
<comment>Use your own CDN for images.</comment>
|
93 |
+
</cdn>
|
94 |
+
<triggerimport translate="label">
|
95 |
+
<label>Import Now</label>
|
96 |
+
<frontend_type>select</frontend_type>
|
97 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
98 |
+
<sort_order>8</sort_order>
|
99 |
+
<show_in_default>1</show_in_default>
|
100 |
+
<show_in_website>1</show_in_website>
|
101 |
+
<show_in_store>0</show_in_store>
|
102 |
+
<comment>Run the import feed process when saving these settings.</comment>
|
103 |
+
</triggerimport>
|
104 |
+
</fields>
|
105 |
+
</general>
|
106 |
+
</groups>
|
107 |
+
</zoetrope>
|
108 |
+
</sections>
|
109 |
+
</config>
|
app/code/community/MadCapsule/Zoetrope/sql/zoetrope_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$setup->addAttributeGroup('catalog_product', 'Default', 'Zoetrope Engage Image Viewer', 2000);
|
8 |
+
$setup->addAttribute('catalog_product', 'zoetrope_id', array(
|
9 |
+
'group' => 'Zoetrope Engage Image Viewer',
|
10 |
+
'input' => 'text',
|
11 |
+
'type' => 'text',
|
12 |
+
'label' => 'Image ID',
|
13 |
+
'backend' => '',
|
14 |
+
'visible' => 0,
|
15 |
+
'required' => 0,
|
16 |
+
'user_defined' => 1,
|
17 |
+
'searchable' => 0,
|
18 |
+
'filterable' => 0,
|
19 |
+
'comparable' =>0,
|
20 |
+
'visible_on_front' => 0,
|
21 |
+
'visible_in_advanced_search' => 0,
|
22 |
+
'is_html_allowed_on_front' => 0,
|
23 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
24 |
+
));
|
25 |
+
|
26 |
+
$setup->addAttribute('catalog_product', 'zoetrope_starting_pos', array(
|
27 |
+
'group' => 'Zoetrope Engage Image Viewer',
|
28 |
+
'input' => 'text',
|
29 |
+
'type' => 'text',
|
30 |
+
'label' => 'Starting Position',
|
31 |
+
'backend' => '',
|
32 |
+
'visible' => 0,
|
33 |
+
'required' => 0,
|
34 |
+
'user_defined' => 1,
|
35 |
+
'searchable' => 0,
|
36 |
+
'filterable' => 0,
|
37 |
+
'comparable' => 0,
|
38 |
+
'visible_on_front' => 0,
|
39 |
+
'visible_in_advanced_search' => 0,
|
40 |
+
'is_html_allowed_on_front' => 0,
|
41 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
42 |
+
));
|
43 |
+
|
44 |
+
$installer->endSetup();
|
app/design/frontend/default/default/layout/zoetrope.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout version="0.1.0">
|
2 |
+
<default>
|
3 |
+
<reference name="head">
|
4 |
+
<block type="core/text" name="zoetropescripts">
|
5 |
+
<action method="setText"><text><![CDATA[<link href="//d34tuy4jppw3dn.cloudfront.net/v1/css/style.css" rel="stylesheet" type="text/css" id="zoetropescripts"><script src="//d34tuy4jppw3dn.cloudfront.net/v1/js/zoe-widget.min.js"></script>]]></text></action>
|
6 |
+
</block>
|
7 |
+
</reference>
|
8 |
+
</default>
|
9 |
+
<catalog_product_view>
|
10 |
+
<reference name="product.info.media">
|
11 |
+
<action method="setTemplate" ifconfig="zoetrope/general/active"><template>catalog/product/view/zoetrope.phtml</template></action>
|
12 |
+
</reference>
|
13 |
+
</catalog_product_view>
|
14 |
+
</layout>
|
app/design/frontend/default/default/template/catalog/product/view/zoetrope.phtml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* zoetrope.phtml
|
4 |
+
* Created by James Mikkelson on 2014-06-25.
|
5 |
+
*
|
6 |
+
* Licensed under The GPLv2 License
|
7 |
+
* Redistributions of files must retain the above copyright notice
|
8 |
+
*
|
9 |
+
* @link www.madcapsule.com
|
10 |
+
* @author james@madcapsule.co.uk
|
11 |
+
* @license GPLv2 License (http://www.gnu.org/licenses/gpl-2.0.html)
|
12 |
+
*/
|
13 |
+
$_product = $this->getProduct();
|
14 |
+
$_helper = $this->helper('catalog/output');
|
15 |
+
$_zoetrope = Mage::helper('zoetrope');
|
16 |
+
$zoetrope_id = $this->getProduct()->getData('zoetrope_id');
|
17 |
+
$start_index = $this->getProduct()->getData('zoetrope_starting_pos');
|
18 |
+
?>
|
19 |
+
|
20 |
+
<?php if($_product->getImage() != 'no_selection' && $_product->getImage() && !$zoetrope_id){ ?>
|
21 |
+
<p class="product-image product-image-zoom">
|
22 |
+
<?php
|
23 |
+
$_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
|
24 |
+
echo $_helper->productAttribute($_product, $_img, 'image');
|
25 |
+
?>
|
26 |
+
</p>
|
27 |
+
<p class="zoom-notice" id="track_hint"><?php echo $this->__('Double click on above image to view full picture') ?></p>
|
28 |
+
<div class="zoom">
|
29 |
+
<img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" title="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
|
30 |
+
<div id="track">
|
31 |
+
<div id="handle"></div>
|
32 |
+
</div>
|
33 |
+
<img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" title="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
|
34 |
+
</div>
|
35 |
+
<script type="text/javascript">
|
36 |
+
//<![CDATA[
|
37 |
+
Event.observe(window, 'load', function() {
|
38 |
+
product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
|
39 |
+
});
|
40 |
+
//]]>
|
41 |
+
</script>
|
42 |
+
|
43 |
+
<?php }elseif($_product->getImage() != 'no_selection' && $_product->getImage() && $zoetrope_id){ ?>
|
44 |
+
<p>
|
45 |
+
<?php
|
46 |
+
$_img = '<img id="image" src="'.$_zoetrope->getCdn().$zoetrope_id.'/'.$_zoetrope->getResolution().'/'.$start_index.'.jpg" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" class="zoe-engage-image"
|
47 |
+
data-zoe-site="'.$_zoetrope->getSiteId().'"
|
48 |
+
data-zoe-image="'.$zoetrope_id.'"
|
49 |
+
'.$_zoetrope->getStyle().'
|
50 |
+
data-zoe-preload="true"
|
51 |
+
data-zoe-start-ind="'.$start_index.'"
|
52 |
+
width="'.$_zoetrope->getWidth().'"
|
53 |
+
height="'.$_zoetrope->getHeight().'"/>';
|
54 |
+
echo $_helper->productAttribute($_product, $_img, 'image');
|
55 |
+
?>
|
56 |
+
</p>
|
57 |
+
<?php }else{ ?>
|
58 |
+
<p class="product-image">
|
59 |
+
<?php
|
60 |
+
$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';
|
61 |
+
echo $_helper->productAttribute($_product, $_img, 'image');
|
62 |
+
?>
|
63 |
+
</p>
|
64 |
+
<?php } ?>
|
65 |
+
<?php if(count($this->getGalleryImages()) > 0){ ?>
|
66 |
+
<div class="more-views">
|
67 |
+
<h2><?php echo $this->__('More Views') ?></h2>
|
68 |
+
<ul>
|
69 |
+
<?php foreach($this->getGalleryImages() as $_image){ ?>
|
70 |
+
<li>
|
71 |
+
<a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->escapeHtml($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" /></a>
|
72 |
+
</li>
|
73 |
+
<?php } ?>
|
74 |
+
</ul>
|
75 |
+
</div>
|
76 |
+
<?php } ?>
|
app/etc/modules/MadCapsule_Zoetrope.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<MadCapsule_Zoetrope>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</MadCapsule_Zoetrope>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>MadCapsule_Zoetrope</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.gnu.org/licenses/gpl-2.0.html">GPLv2</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Zoetrope Engage Image Viewer</summary>
|
10 |
+
<description>Implement the Zoetrope Engage Image Viewer on your product pages to provide unprecedented product image detail and let your customers get a real feel for your product from all angles.</description>
|
11 |
+
<notes>First public release</notes>
|
12 |
+
<authors><author><name>James Mikkelson</name><user>madcapsulemedia</user><email>james@madcapsule.co.uk</email></author></authors>
|
13 |
+
<date>2014-07-12</date>
|
14 |
+
<time>15:11:09</time>
|
15 |
+
<contents><target name="magelocal"><dir name="MadCapsule"><dir name="Zoetrope"><dir name="Helper"><file name="Data.php" hash="c62a38a795009eaff145cbf2f0805e55"/></dir><dir name="Model"><file name="Observer.php" hash="5c648f7bc3aae0fd781e1d30459a9e89"/></dir><dir name="etc"><file name="config.xml" hash="02c042286fe9a7c04bed2d75996d27d4"/><file name="system.xml" hash="191163fdb77550c1d4f61289b246d071"/></dir><dir name="sql"><dir name="zoetrope_setup"><file name="mysql4-install-1.0.0.php" hash="196dacfcc9dc9b47a23054eeb8f47fec"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MadCapsule_Zoetrope.xml" hash="35c184b8dde371feb9ddaa89647c46d9"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="zoetrope.xml" hash="b51861c3e4c30b3c796ae1e971980e46"/></dir><dir name="template"><dir name="catalog"><dir name="product"><dir name="view"><file name="zoetrope.phtml" hash="b63d994da445d84a332737abd7ef1331"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|