photoslurp_for_magento - Version 1.0.0

Version Notes

First stable release

Download this release

Release Info

Developer Ben Heinkel
Extension photoslurp_for_magento
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (30) hide show
  1. app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/PhotoslurpWidgetbackend.php +5 -0
  2. app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget.php +17 -0
  3. app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit.php +44 -0
  4. app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Form.php +17 -0
  5. app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Tab/Form.php +133 -0
  6. app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Tab/Form1.php +115 -0
  7. app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Tab/Form2.php +33 -0
  8. app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Tabs.php +35 -0
  9. app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Grid.php +156 -0
  10. app/code/community/Photoslurp/PhotoslurpWidget/Block/Widget.php +84 -0
  11. app/code/community/Photoslurp/PhotoslurpWidget/Helper/Data.php +10 -0
  12. app/code/community/Photoslurp/PhotoslurpWidget/Model/Cron.php +80 -0
  13. app/code/community/Photoslurp/PhotoslurpWidget/Model/Mysql4/Photoslurpwidget.php +8 -0
  14. app/code/community/Photoslurp/PhotoslurpWidget/Model/Mysql4/Photoslurpwidget/Collection.php +12 -0
  15. app/code/community/Photoslurp/PhotoslurpWidget/Model/Photoslurpwidget.php +12 -0
  16. app/code/community/Photoslurp/PhotoslurpWidget/controllers/Adminhtml/PhotoslurpwidgetController.php +148 -0
  17. app/code/community/Photoslurp/PhotoslurpWidget/controllers/Adminhtml/PhotoslurpwidgetbackendController.php +23 -0
  18. app/code/community/Photoslurp/PhotoslurpWidget/etc/adminhtml.xml +23 -0
  19. app/code/community/Photoslurp/PhotoslurpWidget/etc/config.xml +139 -0
  20. app/code/community/Photoslurp/PhotoslurpWidget/etc/system.xml +42 -0
  21. app/code/community/Photoslurp/PhotoslurpWidget/sql/photoslurpwidget_setup/mysql4-install-0.1.0.php +82 -0
  22. app/design/adminhtml/default/default/layout/photoslurpwidget.xml +29 -0
  23. app/design/adminhtml/default/default/template/photoslurpwidget/photoslurpwidgetbackend.phtml +24 -0
  24. app/design/frontend/base/default/layout/photoslurpwidget.xml +26 -0
  25. app/design/frontend/base/default/template/photoslurpwidget/style.phtml +13 -0
  26. app/design/frontend/base/default/template/photoslurpwidget/tracking.phtml +26 -0
  27. app/design/frontend/base/default/template/photoslurpwidget/widget.phtml +188 -0
  28. app/etc/modules/Photoslurp_PhotoslurpWidget.xml +10 -0
  29. js/photoslurp/admin.js +33 -0
  30. package.xml +33 -0
app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/PhotoslurpWidgetbackend.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Photoslurp_PhotoslurpWidget_Block_Adminhtml_PhotoslurpWidgetbackend extends Mage_Adminhtml_Block_Template {
4
+
5
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget extends Mage_Adminhtml_Block_Widget_Grid_Container{
5
+
6
+ public function __construct()
7
+ {
8
+
9
+ $this->_controller = "adminhtml_photoslurpwidget";
10
+ $this->_blockGroup = "photoslurpwidget";
11
+ $this->_headerText = Mage::helper("photoslurpwidget")->__("Photoslurp Widget Manager");
12
+ $this->_addButtonLabel = Mage::helper("photoslurpwidget")->__("Add New Item");
13
+ parent::__construct();
14
+
15
+ }
16
+
17
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+
8
+ parent::__construct();
9
+ $this->_objectId = "id";
10
+ $this->_blockGroup = "photoslurpwidget";
11
+ $this->_controller = "adminhtml_photoslurpwidget";
12
+ $this->_updateButton("save", "label", Mage::helper("photoslurpwidget")->__("Save Item"));
13
+ $this->_updateButton("delete", "label", Mage::helper("photoslurpwidget")->__("Delete Item"));
14
+
15
+ $this->_addButton("saveandcontinue", array(
16
+ "label" => Mage::helper("photoslurpwidget")->__("Save And Continue Edit"),
17
+ "onclick" => "saveAndContinueEdit()",
18
+ "class" => "save",
19
+ ), -100);
20
+
21
+
22
+
23
+ $this->_formScripts[] = "
24
+
25
+ function saveAndContinueEdit(){
26
+ editForm.submit($('edit_form').action+'back/edit/');
27
+ }
28
+ ";
29
+ }
30
+
31
+ public function getHeaderText()
32
+ {
33
+ if( Mage::registry("photoslurpwidget_data") && Mage::registry("photoslurpwidget_data")->getId() ){
34
+
35
+ return Mage::helper("photoslurpwidget")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("photoslurpwidget_data")->getId()));
36
+
37
+ }
38
+ else{
39
+
40
+ return Mage::helper("photoslurpwidget")->__("Add Item");
41
+
42
+ }
43
+ }
44
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Form.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array(
7
+ "id" => "edit_form",
8
+ "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))),
9
+ "method" => "post",
10
+ "enctype" =>"multipart/form-data",
11
+ )
12
+ );
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ return parent::_prepareForm();
16
+ }
17
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Tab/Form.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset("photoslurpwidget_form", array("legend" => Mage::helper("photoslurpwidget")->__("Configuration parameters")));
10
+
11
+ $fieldset->addField('widget_enable', 'select', array(
12
+ 'label' => Mage::helper('photoslurpwidget')->__('Enable'),
13
+ 'values' => Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getValueArrayYesNo(),
14
+ 'name' => 'widget_enable',
15
+ "class" => "required-entry",
16
+ "required" => true,
17
+
18
+ ));
19
+
20
+ $fieldset->addField("widget_container_id", "text", array(
21
+ "label" => Mage::helper("photoslurpwidget")->__("Widget Container Id"),
22
+ "class" => "required-entry",
23
+ "required" => true,
24
+ "name" => "widget_container_id",
25
+ 'after_element_html' => "<i>Please choose a unique HTML container ID to hold the widget</i>"
26
+ ));
27
+
28
+ $fieldset->addField("widget_id", "text", array(
29
+ "label" => Mage::helper("photoslurpwidget")->__("Widget Id"),
30
+ "class" => "required-entry",
31
+ "required" => true,
32
+ "name" => "widget_id",
33
+ 'after_element_html' => "<br><i>A unique identifier for each of the widgets you use on your website</i>"
34
+ ));
35
+
36
+ $fieldset->addField('widget_type', 'select', array(
37
+ 'label' => Mage::helper('photoslurpwidget')->__('Widget Type'),
38
+ 'values' => Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getValueArray5(),
39
+ 'name' => 'widget_type',
40
+ "class" => "required-entry",
41
+ "required" => true,
42
+ 'after_element_html' => '<i>This is either set to carousel or gallery depending on how you would like to display your pictures. Carousel has been specifically designed to be placed on your product pages, and Gallery to be used as a separate gallery page<i>'
43
+
44
+ ));
45
+
46
+ $fieldset->addField("album_id", "text", array(
47
+ "label" => Mage::helper("photoslurpwidget")->__("Album Id"),
48
+ "class" => "required-entry",
49
+ "required" => true,
50
+ "name" => "album_id",
51
+ 'after_element_html' => '<i>This is the ID number of your campaign</i>'
52
+ ));
53
+
54
+ $fieldset->addField("page_limit", "text", array(
55
+ "label" => Mage::helper("photoslurpwidget")->__("Page Limit"),
56
+ "class" => "required-entry",
57
+ "required" => true,
58
+ "name" => "page_limit",
59
+ "value" => 30,
60
+ 'after_element_html' => '<i>The number of images to load per page for both the Gallery and Carousel modes</i>'
61
+ ));
62
+
63
+ $fieldset->addField('page_type', 'select', array(
64
+ 'label' => Mage::helper('photoslurpwidget')->__('Page Type'),
65
+ 'values' => Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getValueArray10(),
66
+ 'name' => 'page_type',
67
+ "class" => "required-entry",
68
+ "required" => true,
69
+ 'after_element_html' => '<i>This parameter is used in analytics calculations</i>'
70
+ ));
71
+ $fieldset->addField('show_submit', 'select', array(
72
+ 'label' => Mage::helper('photoslurpwidget')->__('Show Submit'),
73
+ 'values' => Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getValueArrayYesNo(),
74
+ 'name' => 'show_submit',
75
+ 'after_element_html' => '<i>This parameter will enable the frontend upload widget, and display a Submit button</i>'
76
+ ));
77
+ $fieldset->addField("submit_text", "text", array(
78
+ "label" => Mage::helper("photoslurpwidget")->__("Submit Text"),
79
+ "name" => "submit_text",
80
+ 'after_element_html' => '<i>This is the text that will be displayed on the Submit button</i>'
81
+ ));
82
+
83
+ $fieldset->addField("add_photos_img", "text", array(
84
+ "label" => Mage::helper("photoslurpwidget")->__("Add Photos Img"),
85
+ "name" => "add_photos_img",
86
+ 'after_element_html' => '<i>This requires a URL to an image that will be displayed when there are no images yet in a particular album (for example when the productId parameter is used, and there are no photos for particular product yet). A banner inviting users to submit images is recommended to be used here</i>'
87
+ ));
88
+
89
+ $fieldset->addField("note_add_pics_text", "text", array(
90
+ "label" => Mage::helper("photoslurpwidget")->__("Note Add Pics Text"),
91
+ "name" => "note_add_pics_text",
92
+ 'after_element_html' => '<i>This is the text to be added on the top of your Gallery or Carousel, and can be used to let your users know how they can add their own pictures</i>'
93
+ ));
94
+
95
+ $fieldset->addField('note_add_pics_icons', 'multiselect', array(
96
+ 'label' => Mage::helper('photoslurpwidget')->__('Note Add Pics Icons'),
97
+ 'values' => Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getValueArray15(),
98
+ 'name' => 'note_add_pics_icons',
99
+ 'after_element_html' => '<i>This is related to noteAddPicsText and will add the icons of the services you have chosen to include in your campaign, letting users know which services they can use to add their own pictures</i>'
100
+ ));
101
+ $fieldset->addField('social_icons', 'select', array(
102
+ 'label' => Mage::helper('photoslurpwidget')->__('Social Icons'),
103
+ 'values' => Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getValueArrayYesNo(),
104
+ 'name' => 'social_icons',
105
+ 'after_element_html' => '<i>Enable social icons in the lightbox to allow users to share pictures back to social networks</i>'
106
+ ));
107
+ $fieldset->addField("image_height", "text", array(
108
+ "label" => Mage::helper("photoslurpwidget")->__("Image Height, px"),
109
+ "class" => "required-entry",
110
+ "required" => true,
111
+ "name" => "image_height",
112
+ "value" => 200,
113
+ 'after_element_html' => '<i>This is an option specific to the Carousel widget type, and sets the height of the thumbnail images and therefore the carousel</i>'
114
+ ));
115
+
116
+ $fieldset->addField("image_width", "text", array(
117
+ "label" => Mage::helper("photoslurpwidget")->__("Image Width, px"),
118
+ "class" => "required-entry",
119
+ "required" => true,
120
+ "name" => "image_width",
121
+ "value" => 200,
122
+ 'after_element_html' => '<i>This option is specific to the Gallery widget type, and sets the width of each thumbnail in the Gallery view</i>'
123
+ ));
124
+
125
+ if (Mage::getSingleton("adminhtml/session")->getPhotoslurpwidgetData()) {
126
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getPhotoslurpwidgetData());
127
+ Mage::getSingleton("adminhtml/session")->setPhotoslurpwidgetData(null);
128
+ } elseif (Mage::registry("photoslurpwidget_data")) {
129
+ $form->setValues(Mage::registry("photoslurpwidget_data")->getData());
130
+ }
131
+ return parent::_prepareForm();
132
+ }
133
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Tab/Form1.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Edit_Tab_Form1 extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset("photoslurpwidget_form", array("legend"=>Mage::helper("photoslurpwidget")->__("Style parameters")));
10
+
11
+ $groups = array(
12
+ array(
13
+ 'code' =>'submissionform',
14
+ 'label' => 'Submission Form',
15
+ 'fields' => array(
16
+ array('code'=>'style_submissionform_colourtop','label'=>'Colour Top', 'afterhtml'=>'<i>Default #4F5F6F</i>'),
17
+ array('code'=>'style_submissionform_colourbutton','label'=>'Colour Button', 'afterhtml'=>'<i>Default #5DADE2</i>'),
18
+ array('code'=>'style_submissionform_font','label'=>'Font', 'afterhtml'=>'<i>Default "Open Sans"</i>')
19
+ )
20
+ ),
21
+ array(
22
+ 'code' =>'taggingtitle',
23
+ 'label' => 'Tagging Title',
24
+ 'fields' => array(
25
+ array('code'=>'style_taggingtitle_font_family','label'=>'Font Family'),
26
+ array('code'=>'style_taggingtitle_font_style','label'=>'Font Style'),
27
+ array('code'=>'style_taggingtitle_font_weight','label'=>'Font Weight'),
28
+ array('code'=>'style_taggingtitle_font_color','label'=>'Font Color'),
29
+ array('code'=>'style_taggingtitle_font_size','label'=>'Font Size')
30
+ )
31
+ ),
32
+ array(
33
+ 'code' =>'thumbnail',
34
+ 'label' => 'Thumbnail',
35
+ 'fields' => array(
36
+ array('code'=>'style_thumbnail_bg_color','label'=>'Background Color'),
37
+ array('code'=>'style_thumbnail_border_color','label'=>'Border Color')
38
+ )
39
+ ),
40
+ array(
41
+ 'code' =>'carousel',
42
+ 'label' => 'Carousel',
43
+ 'fields' => array(
44
+ array('code'=>'style_carousel_bg_color','label'=>'Background Color'),
45
+ )
46
+ ),
47
+ array(
48
+ 'code' =>'popup',
49
+ 'label' => 'Popup',
50
+ 'fields' => array(
51
+ array('code'=>'style_popup_bg_color','label'=>'Background Color'),
52
+ array('code'=>'style_popup_title_font_family','label'=>'Title Font Family'),
53
+ array('code'=>'style_popup_title_font_style','label'=>'Title Font Style'),
54
+ array('code'=>'style_popup_title_font_weight','label'=>'Title Font Weight'),
55
+ array('code'=>'style_popup_title_font_color','label'=>'Title Font Color')
56
+ )
57
+ ),
58
+ array(
59
+ 'code' =>'source',
60
+ 'label' => 'Source',
61
+ 'fields' => array(
62
+ array('code'=>'style_source_font_family','label'=>'Font Family'),
63
+ array('code'=>'style_source_font_style','label'=>'Font Style'),
64
+ array('code'=>'style_source_font_weight','label'=>'Font Weight'),
65
+ array('code'=>'style_source_font_color','label'=>'Font Color')
66
+ )
67
+ ),
68
+ array(
69
+ 'code' =>'productcaptionshop',
70
+ 'label' => 'Product Caption Shop',
71
+ 'fields' => array(
72
+ array('code'=>'style_productcaptionshop_font_family','label'=>'Font Family'),
73
+ array('code'=>'style_productcaptionshop_font_style','label'=>'Font Style'),
74
+ array('code'=>'style_productcaptionshop_font_weight','label'=>'Font Weight'),
75
+ array('code'=>'style_productcaptionshop_font_color','label'=>'Font Color')
76
+ )
77
+ ),
78
+ array(
79
+ 'code' =>'productdescription',
80
+ 'label' => 'Product Description',
81
+ 'fields' => array(
82
+ array('code'=>'style_productdescription_font_family','label'=>'Font Family'),
83
+ array('code'=>'style_productdescription_font_style','label'=>'Font Style'),
84
+ array('code'=>'style_productdescription_font_weight','label'=>'Font Weight'),
85
+ array('code'=>'style_productdescription_font_color','label'=>'Font Color')
86
+ )
87
+ )
88
+ );
89
+
90
+
91
+ foreach ($groups as $group){
92
+ $fieldset->addField($group['code'], 'label' , array(
93
+ 'after_element_html'=> $this->__('<b>%s</b>',$group['label'])
94
+ ));
95
+ foreach($group['fields'] as $field){
96
+ $fieldset->addField($field['code'], "text", array(
97
+ "label" => Mage::helper("photoslurpwidget")->__($field['label']),
98
+ "name" => $field['code'],
99
+ 'after_element_html'=> $field['afterhtml']
100
+ ));
101
+ }
102
+ }
103
+
104
+
105
+ if (Mage::getSingleton("adminhtml/session")->getPhotoslurpwidgetData())
106
+ {
107
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getPhotoslurpwidgetData());
108
+ Mage::getSingleton("adminhtml/session")->setPhotoslurpwidgetData(null);
109
+ }
110
+ elseif(Mage::registry("photoslurpwidget_data")) {
111
+ $form->setValues(Mage::registry("photoslurpwidget_data")->getData());
112
+ }
113
+ return parent::_prepareForm();
114
+ }
115
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Tab/Form2.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Edit_Tab_Form2 extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset("photoslurpwidget_form", array("legend"=>Mage::helper("photoslurpwidget")->__("Custom CSS")));
10
+
11
+ $fieldset->addField('style_custom_enable', 'select', array(
12
+ 'label' => Mage::helper('photoslurpwidget')->__('Overwrite Default'),
13
+ 'values' => Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getValueArrayYesNo(),
14
+ 'name' => 'style_custom_enable',
15
+ 'after_element_html' => '<i>For further customization of the actual widgets, we recommend you overwrite the default widget CSS styles with your own</i>'
16
+ ));
17
+
18
+ $fieldset->addField("style_custom", "textarea", array(
19
+ "label" => Mage::helper("photoslurpwidget")->__("Your Own CSS"),
20
+ "name" => "style_custom"
21
+ ));
22
+
23
+ if (Mage::getSingleton("adminhtml/session")->getPhotoslurpwidgetData())
24
+ {
25
+ $form->setValues(Mage::getSingleton("adminhtml/session")->getPhotoslurpwidgetData());
26
+ Mage::getSingleton("adminhtml/session")->setPhotoslurpwidgetData(null);
27
+ }
28
+ elseif(Mage::registry("photoslurpwidget_data")) {
29
+ $form->setValues(Mage::registry("photoslurpwidget_data")->getData());
30
+ }
31
+ return parent::_prepareForm();
32
+ }
33
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Edit/Tabs.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId("photoslurpwidget_tabs");
9
+ $this->setDestElementId("edit_form");
10
+ $this->setTitle(Mage::helper("photoslurpwidget")->__("Widget information"));
11
+ }
12
+
13
+ protected function _beforeToHtml()
14
+ {
15
+ $this->addTab("form_section", array(
16
+ "label" => Mage::helper("photoslurpwidget")->__("Configuration"),
17
+ "title" => Mage::helper("photoslurpwidget")->__("Configuration"),
18
+ "content" => $this->getLayout()->createBlock("photoslurpwidget/adminhtml_photoslurpwidget_edit_tab_form")->toHtml(),
19
+ ));
20
+
21
+ $this->addTab("form_section1", array(
22
+ "label" => Mage::helper("photoslurpwidget")->__("Style parameters"),
23
+ "title" => Mage::helper("photoslurpwidget")->__("Style parameters"),
24
+ "content" => $this->getLayout()->createBlock("photoslurpwidget/adminhtml_photoslurpwidget_edit_tab_form1")->toHtml(),
25
+ ));
26
+
27
+ $this->addTab("form_section2", array(
28
+ "label" => Mage::helper("photoslurpwidget")->__("Custom CSS"),
29
+ "title" => Mage::helper("photoslurpwidget")->__("Custom CSS"),
30
+ "content" => $this->getLayout()->createBlock("photoslurpwidget/adminhtml_photoslurpwidget_edit_tab_form2")->toHtml(),
31
+ ));
32
+ return parent::_beforeToHtml();
33
+ }
34
+
35
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Block/Adminhtml/Photoslurpwidget/Grid.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId("photoslurpwidgetGrid");
10
+ $this->setDefaultSort("id");
11
+ $this->setDefaultDir("DESC");
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $collection = Mage::getModel("photoslurpwidget/photoslurpwidget")->getCollection();
18
+ $this->setCollection($collection);
19
+ return parent::_prepareCollection();
20
+ }
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn("id", array(
24
+ "header" => Mage::helper("photoslurpwidget")->__("ID"),
25
+ "align" =>"right",
26
+ "width" => "50px",
27
+ "type" => "number",
28
+ "index" => "id",
29
+ ));
30
+ $this->addColumn('widget_enable', array(
31
+ 'header' => Mage::helper('photoslurpwidget')->__('Enable'),
32
+ 'index' => 'widget_enable',
33
+ 'type' => 'options',
34
+ 'options'=>Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getOptionArrayYesNo(),
35
+ ));
36
+
37
+ $this->addColumn('page_type', array(
38
+ 'header' => Mage::helper('photoslurpwidget')->__('Page Type'),
39
+ 'index' => 'page_type',
40
+ 'type' => 'options',
41
+ 'options'=>Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getOptionArray10(),
42
+ ));
43
+ $this->addColumn('widget_type', array(
44
+ 'header' => Mage::helper('photoslurpwidget')->__('Widget Type'),
45
+ 'index' => 'widget_type',
46
+ 'type' => 'options',
47
+ 'options'=>Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getOptionArray5(),
48
+ ));
49
+
50
+ $this->addColumn("album_id", array(
51
+ "header" => Mage::helper("photoslurpwidget")->__("Album Id"),
52
+ "index" => "album_id",
53
+ ));
54
+
55
+ $this->addColumn("page_limit", array(
56
+ "header" => Mage::helper("photoslurpwidget")->__("Page Limit"),
57
+ "index" => "page_limit",
58
+ ));
59
+
60
+ return parent::_prepareColumns();
61
+ }
62
+
63
+ public function getRowUrl($row)
64
+ {
65
+ return $this->getUrl("*/*/edit", array("id" => $row->getId()));
66
+ }
67
+
68
+
69
+
70
+ protected function _prepareMassaction()
71
+ {
72
+ $this->setMassactionIdField('id');
73
+ $this->getMassactionBlock()->setFormFieldName('ids');
74
+ $this->getMassactionBlock()->setUseSelectAll(true);
75
+ $this->getMassactionBlock()->addItem('remove_photoslurpwidget', array(
76
+ 'label'=> Mage::helper('photoslurpwidget')->__('Remove Photoslurpwidget'),
77
+ 'url' => $this->getUrl('*/adminhtml_photoslurpwidget/massRemove'),
78
+ 'confirm' => Mage::helper('photoslurpwidget')->__('Are you sure?')
79
+ ));
80
+ return $this;
81
+ }
82
+
83
+ static public function getOptionArray5()
84
+ {
85
+ $data_array=array();
86
+ $data_array['']= 'Please select...';
87
+ $data_array[1]='carousel';
88
+ $data_array[2]='gallery';
89
+ return($data_array);
90
+ }
91
+ static public function getValueArray5()
92
+ {
93
+ $data_array=array();
94
+ foreach(Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getOptionArray5() as $k=>$v){
95
+ $data_array[]=array('value'=>$k,'label'=>$v);
96
+ }
97
+ return($data_array);
98
+
99
+ }
100
+
101
+ static public function getOptionArray10()
102
+ {
103
+ $data_array=array();
104
+ $data_array['']= 'Please select...';
105
+ $data_array[1]='home';
106
+ $data_array[2]='product';
107
+ $data_array[3]='lookbook';
108
+ return($data_array);
109
+ }
110
+ static public function getValueArray10()
111
+ {
112
+ $data_array=array();
113
+ foreach(Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getOptionArray10() as $k=>$v){
114
+ $data_array[]=array('value'=>$k,'label'=>$v);
115
+ }
116
+ return($data_array);
117
+
118
+ }
119
+
120
+ static public function getOptionArray15()
121
+ {
122
+ $data_array=array();
123
+ $data_array[1]='facebook ';
124
+ $data_array[2]='twitter';
125
+ $data_array[3]='instagram';
126
+ return($data_array);
127
+ }
128
+ static public function getValueArray15()
129
+ {
130
+ $data_array=array();
131
+ foreach(Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getOptionArray15() as $k=>$v){
132
+ $data_array[]=array('value'=>$k,'label'=>$v);
133
+ }
134
+ return($data_array);
135
+
136
+ }
137
+
138
+ static public function getOptionArrayYesNo()
139
+ {
140
+ $data_array=array();
141
+ $data_array[0]='No';
142
+ $data_array[1]='Yes';
143
+ return($data_array);
144
+ }
145
+ static public function getValueArrayYesNo()
146
+ {
147
+ $data_array=array();
148
+ foreach(Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getOptionArrayYesNo() as $k=>$v){
149
+ $data_array[]=array('value'=>$k,'label'=>$v);
150
+ }
151
+ return($data_array);
152
+
153
+ }
154
+
155
+
156
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Block/Widget.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Photoslurp_PhotoslurpWidget_Block_Widget extends Mage_Core_Block_Template{
3
+
4
+ protected $_product = null;
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('photoslurpwidget/widget.phtml');
10
+ }
11
+
12
+ public function getProduct()
13
+ {
14
+ if (!$this->_product) {
15
+ $this->_product = Mage::registry('product');
16
+ }
17
+ return $this->_product;
18
+ }
19
+
20
+ public function getWidget(){
21
+
22
+ return $this->_widget = Mage::getModel('photoslurpwidget/photoslurpwidget')->getCollection()
23
+ -> addFilter($field='id', $value = $this->getData('id'))
24
+ -> addFilter($field='widget_enable', $value='1')
25
+ -> getFirstItem();
26
+ }
27
+
28
+ public function getProductPageWidget()
29
+ {
30
+ return $this->_widget = Mage::getModel('photoslurpwidget/photoslurpwidget')->getCollection()
31
+ -> addFilter($field='widget_enable', $value='1')
32
+ -> addFilter($field='page_type', $value='2')
33
+ -> getFirstItem();
34
+ }
35
+
36
+ public function getAllWidgets()
37
+ {
38
+ return $this->_widget = Mage::getModel('photoslurpwidget/photoslurpwidget')->getCollection()
39
+ -> addFilter($field='widget_enable', $value='1');
40
+ }
41
+
42
+ public function getIsFacebookIconEnabled()
43
+ {
44
+ if (in_array(1, explode(",", $this->getWidget()->getNoteAddPicsIcons()))) {
45
+ return true;
46
+ }
47
+ return false;
48
+ }
49
+
50
+ public function getIsTwitterIconEnabled()
51
+ {
52
+ if (in_array(2, explode(",", $this->getWidget()->getNoteAddPicsIcons()))) {
53
+ return true;
54
+ }
55
+ return false;
56
+ }
57
+
58
+ public function getIsInstagramIconEnabled()
59
+ {
60
+ if (in_array(3, explode(",", $this->getWidget()->getNoteAddPicsIcons()))) {
61
+ return true;
62
+ }
63
+ return false;
64
+ }
65
+
66
+ public function prepareStyleText($text, $id)
67
+ {
68
+ $cssModified = '';
69
+ $pattern = '/[^{}]*{(?:[^{}]+|(?R))*}/';
70
+ preg_match_all($pattern, $text, $cssBlocks);
71
+ foreach($cssBlocks[0] as $cssBlock) {
72
+ $cssBlock = trim($cssBlock);
73
+ preg_match('/[^{}]*{/', $cssBlock, $selector);
74
+ if(!preg_match('/^@/', $selector[0])) {
75
+ $selectorModified = preg_replace(array('/,/', '/^/'), array(",\n#$id ", "\n#$id "), $selector[0]);
76
+ $cssBlockModified = preg_replace("/$selector[0]/", $selectorModified, $cssBlock);
77
+ }else{
78
+ $cssBlockModified = "\n$cssBlock";
79
+ }
80
+ $cssModified .= $cssBlockModified;
81
+ }
82
+ return $cssModified;
83
+ }
84
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Helper/Data.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Photoslurp_PhotoslurpWidget_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ const FILE_NAME = 'photoslurp_export.csv';
5
+
6
+ public function getFileName(){
7
+ return self::FILE_NAME;
8
+ }
9
+ }
10
+
app/code/community/Photoslurp/PhotoslurpWidget/Model/Cron.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Photoslurp_PhotoslurpWidget_Model_Cron{
3
+
4
+ private $delimiter = '|';
5
+
6
+ public function photoslurpExport(){//cron
7
+ if (Mage::getStoreConfig('export/export_configuration/cron_enable')){
8
+ $this->export();
9
+ }
10
+ }
11
+
12
+ public function manualExport(){
13
+ $this->export();
14
+ }
15
+
16
+ private function export(){
17
+ $collection = Mage::getResourceModel('catalog/product_collection')
18
+ ->addAttributeToFilter('visibility',array("neq"=>1)) //except not visible individually
19
+ ->addAttributeToSelect('image')
20
+ ->addAttributeToSelect('name')
21
+ ->addAttributeToSelect('price');
22
+
23
+ $headers = array();
24
+ $headers[] = 'sku';
25
+ $currencyCodes = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
26
+ foreach ($currencyCodes as $code){
27
+ $headers[] = 'price_'.$code;
28
+ }
29
+
30
+ $headers[] = 'image_url';
31
+
32
+ $rows = array();
33
+ foreach ($collection as $product) {
34
+ $rows[$product->getId()]= array();
35
+ $rows[$product->getId()][] = $product->getSku();
36
+
37
+ $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
38
+ foreach ($currencyCodes as $code){
39
+ $rows[$product->getId()][] = $this->convertPrice($product->getPrice(),$baseCurrencyCode,$code) ;
40
+ }
41
+
42
+ $rows[$product->getId()][] = $product->getImageUrl();
43
+ }
44
+
45
+ $stores = Mage::app()->getStores();
46
+
47
+ foreach ($stores as $store) {
48
+ $headers[] = 'title_'.$store->getCode();
49
+ $headers[] = 'description_'.$store->getCode();
50
+ $headers[] = 'url_'.$store->getCode();
51
+
52
+ $collection = Mage::getResourceModel('catalog/product_collection')
53
+ ->addAttributeToFilter('visibility',array("neq"=>1)) //except not visible individually
54
+ ->setStoreId($store->getId())
55
+ ->addAttributeToSelect('name')
56
+ ->addAttributeToSelect('description');
57
+
58
+ foreach ($collection as $product){
59
+ $product->setStoreId($store->getId());
60
+ $rows[$product->getId()][] = $product->getName();
61
+ $rows[$product->getId()][] = $product->getDescription();
62
+ $rows[$product->getId()][] = $product->getProductUrl();
63
+ }
64
+ }
65
+
66
+ $filename = Mage::helper('photoslurpwidget')->getFileName();
67
+ $fp = fopen($filename, 'w');
68
+
69
+ fputcsv($fp, $headers, $this->delimiter);
70
+ foreach ($rows as $row){
71
+ fputcsv($fp, $row, $this->delimiter);
72
+ }
73
+
74
+ fclose($fp);
75
+ }
76
+
77
+ private function convertPrice($price,$from,$to){
78
+ return Mage::helper('directory')->currencyConvert($price, $from, $to);
79
+ }
80
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Model/Mysql4/Photoslurpwidget.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Photoslurp_PhotoslurpWidget_Model_Mysql4_Photoslurpwidget extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("photoslurpwidget/photoslurpwidget", "id");
7
+ }
8
+ }
app/code/community/Photoslurp/PhotoslurpWidget/Model/Mysql4/Photoslurpwidget/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Photoslurp_PhotoslurpWidget_Model_Mysql4_Photoslurpwidget_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("photoslurpwidget/photoslurpwidget");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Photoslurp/PhotoslurpWidget/Model/Photoslurpwidget.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Photoslurp_PhotoslurpWidget_Model_Photoslurpwidget extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("photoslurpwidget/photoslurpwidget");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Photoslurp/PhotoslurpWidget/controllers/Adminhtml/PhotoslurpwidgetController.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Photoslurp_PhotoslurpWidget_Adminhtml_PhotoslurpwidgetController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+ $this->loadLayout()->_setActiveMenu("photoslurpwidget/photoslurpwidget")->_addBreadcrumb(Mage::helper("adminhtml")->__("Photoslurpwidget Manager"),Mage::helper("adminhtml")->__("Photoslurpwidget Manager"));
8
+ return $this;
9
+ }
10
+ public function indexAction()
11
+ {
12
+ $this->_title($this->__("Photoslurp Widget"));
13
+ $this->_title($this->__("Manager Photoslurpwidget"));
14
+
15
+ $this->_initAction();
16
+ $this->renderLayout();
17
+ }
18
+ public function editAction()
19
+ {
20
+ $this->_title($this->__("Photoslurp Widget"));
21
+ $this->_title($this->__("Photoslurpwidget"));
22
+ $this->_title($this->__("Edit Item"));
23
+
24
+ $id = $this->getRequest()->getParam("id");
25
+ $model = Mage::getModel("photoslurpwidget/photoslurpwidget")->load($id);
26
+ if ($model->getId()) {
27
+ Mage::register("photoslurpwidget_data", $model);
28
+ $this->loadLayout();
29
+ $this->_setActiveMenu("photoslurpwidget/photoslurpwidget");
30
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Photoslurp Widget Manager"), Mage::helper("adminhtml")->__("Photoslurpwidget Manager"));
31
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Photoslurpwidget Description"), Mage::helper("adminhtml")->__("Photoslurpwidget Description"));
32
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
33
+ $this->_addContent($this->getLayout()->createBlock("photoslurpwidget/adminhtml_photoslurpwidget_edit"))->_addLeft($this->getLayout()->createBlock("photoslurpwidget/adminhtml_photoslurpwidget_edit_tabs"));
34
+ $this->renderLayout();
35
+ }
36
+ else {
37
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("photoslurpwidget")->__("Item does not exist."));
38
+ $this->_redirect("*/*/");
39
+ }
40
+ }
41
+
42
+ public function newAction()
43
+ {
44
+
45
+ $this->_title($this->__("PhotoslurpWidget"));
46
+ $this->_title($this->__("Photoslurpwidget"));
47
+ $this->_title($this->__("New Item"));
48
+
49
+ $id = $this->getRequest()->getParam("id");
50
+ $model = Mage::getModel("photoslurpwidget/photoslurpwidget")->load($id);
51
+
52
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
53
+ if (!empty($data)) {
54
+ $model->setData($data);
55
+ }
56
+
57
+ Mage::register("photoslurpwidget_data", $model);
58
+
59
+ $this->loadLayout();
60
+ $this->_setActiveMenu("photoslurpwidget/photoslurpwidget");
61
+
62
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
63
+
64
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Photoslurp Widget Manager"), Mage::helper("adminhtml")->__("Photoslurpwidget Manager"));
65
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Photoslurp Widget Description"), Mage::helper("adminhtml")->__("Photoslurpwidget Description"));
66
+
67
+
68
+ $this->_addContent($this->getLayout()->createBlock("photoslurpwidget/adminhtml_photoslurpwidget_edit"))->_addLeft($this->getLayout()->createBlock("photoslurpwidget/adminhtml_photoslurpwidget_edit_tabs"));
69
+
70
+ $this->renderLayout();
71
+
72
+ }
73
+ public function saveAction()
74
+ {
75
+
76
+ $post_data=$this->getRequest()->getPost();
77
+
78
+
79
+ if ($post_data) {
80
+
81
+ try {
82
+
83
+
84
+ $post_data['note_add_pics_icons']=implode(',',$post_data['note_add_pics_icons']);
85
+
86
+ $model = Mage::getModel("photoslurpwidget/photoslurpwidget")
87
+ ->addData($post_data)
88
+ ->setId($this->getRequest()->getParam("id"))
89
+ ->save();
90
+
91
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Photoslurpwidget was successfully saved"));
92
+ Mage::getSingleton("adminhtml/session")->setPhotoslurpwidgetData(false);
93
+
94
+ if ($this->getRequest()->getParam("back")) {
95
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
96
+ return;
97
+ }
98
+ $this->_redirect("*/*/");
99
+ return;
100
+ }
101
+ catch (Exception $e) {
102
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
103
+ Mage::getSingleton("adminhtml/session")->setPhotoslurpwidgetData($this->getRequest()->getPost());
104
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
105
+ return;
106
+ }
107
+
108
+ }
109
+ $this->_redirect("*/*/");
110
+ }
111
+
112
+
113
+
114
+ public function deleteAction()
115
+ {
116
+ if( $this->getRequest()->getParam("id") > 0 ) {
117
+ try {
118
+ $model = Mage::getModel("photoslurpwidget/photoslurpwidget");
119
+ $model->setId($this->getRequest()->getParam("id"))->delete();
120
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
121
+ $this->_redirect("*/*/");
122
+ }
123
+ catch (Exception $e) {
124
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
125
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
126
+ }
127
+ }
128
+ $this->_redirect("*/*/");
129
+ }
130
+
131
+
132
+ public function massRemoveAction()
133
+ {
134
+ try {
135
+ $ids = $this->getRequest()->getPost('ids', array());
136
+ foreach ($ids as $id) {
137
+ $model = Mage::getModel("photoslurpwidget/photoslurpwidget");
138
+ $model->setId($id)->delete();
139
+ }
140
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully removed"));
141
+ }
142
+ catch (Exception $e) {
143
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
144
+ }
145
+ $this->_redirect('*/*/');
146
+ }
147
+
148
+ }
app/code/community/Photoslurp/PhotoslurpWidget/controllers/Adminhtml/PhotoslurpwidgetbackendController.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Photoslurp_PhotoslurpWidget_Adminhtml_PhotoslurpwidgetbackendController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->_title($this->__("Photoslurp Product Export"));
8
+ $this->renderLayout();
9
+ }
10
+
11
+ public function exportAction()
12
+ {
13
+ try {
14
+ $model = Mage::getModel('photoslurpwidget/cron');
15
+ $model->manualExport();
16
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Products have been exported'));
17
+ }
18
+ catch (Exception $e){
19
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
20
+ }
21
+ $this->_redirect('*/adminhtml_photoslurpwidgetbackend');
22
+ }
23
+ }
app/code/community/Photoslurp/PhotoslurpWidget/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <export translate="title" module="photoslurpwidget">
12
+ <title>Product Export Section</title>
13
+ <sort_order>0</sort_order>
14
+ </export>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/Photoslurp/PhotoslurpWidget/etc/config.xml ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Photoslurp_PhotoslurpWidget>
5
+ <version>0.1.0</version>
6
+ </Photoslurp_PhotoslurpWidget>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <photoslurpwidget>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Photoslurp_PhotoslurpWidget</module>
14
+ <frontName>photoslurpwidget</frontName>
15
+ </args>
16
+ </photoslurpwidget>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <photoslurpwidget>
21
+ <file>photoslurpwidget.xml</file>
22
+ </photoslurpwidget>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <photoslurpwidget>
29
+ <class>Photoslurp_PhotoslurpWidget_Helper</class>
30
+ </photoslurpwidget>
31
+ </helpers>
32
+ <blocks>
33
+ <photoslurpwidget>
34
+ <class>Photoslurp_PhotoslurpWidget_Block</class>
35
+ </photoslurpwidget>
36
+ </blocks>
37
+ <models>
38
+ <photoslurpwidget>
39
+ <class>Photoslurp_PhotoslurpWidget_Model</class>
40
+ <resourceModel>photoslurpwidget_mysql4</resourceModel>
41
+ </photoslurpwidget>
42
+ <photoslurpwidget_mysql4>
43
+ <class>Photoslurp_PhotoslurpWidget_Model_Mysql4</class>
44
+ <entities>
45
+ <photoslurpwidget>
46
+ <table>photoslurp_widget</table>
47
+ </photoslurpwidget>
48
+ </entities>
49
+ </photoslurpwidget_mysql4>
50
+ </models>
51
+ <resources>
52
+ <photoslurpwidget_setup>
53
+ <setup>
54
+ <module>Photoslurp_PhotoslurpWidget</module>
55
+ </setup>
56
+ <connection>
57
+ <use>core_setup</use>
58
+ </connection>
59
+ </photoslurpwidget_setup>
60
+ <photoslurpwidget_write>
61
+ <connection>
62
+ <use>core_write</use>
63
+ </connection>
64
+ </photoslurpwidget_write>
65
+ <photoslurpwidget_read>
66
+ <connection>
67
+ <use>core_read</use>
68
+ </connection>
69
+ </photoslurpwidget_read>
70
+ </resources>
71
+ </global>
72
+ <admin>
73
+ <routers>
74
+ <photoslurpwidget>
75
+ <use>admin</use>
76
+ <args>
77
+ <module>Photoslurp_PhotoslurpWidget</module>
78
+ <frontName>admin_photoslurpwidget</frontName>
79
+ </args>
80
+ </photoslurpwidget>
81
+ </routers>
82
+ </admin>
83
+ <adminhtml>
84
+ <menu>
85
+ <photoslurpwidget module="photoslurpwidget">
86
+ <title>Photoslurp</title>
87
+ <sort_order>90</sort_order>
88
+ <children>
89
+ <photoslurpwidget module="photoslurpwidget">
90
+ <title>Manage Widgets</title>
91
+ <sort_order>0</sort_order>
92
+ <action>admin_photoslurpwidget/adminhtml_photoslurpwidget</action>
93
+ </photoslurpwidget>
94
+ <photoslurpwidgetbackend module="photoslurpwidget">
95
+ <title>Export Products</title>
96
+ <sort_order>1</sort_order>
97
+ <action>admin_photoslurpwidget/adminhtml_photoslurpwidgetbackend</action>
98
+ </photoslurpwidgetbackend>
99
+ </children>
100
+ </photoslurpwidget>
101
+ </menu>
102
+ <acl>
103
+ <resources>
104
+ <all>
105
+ <title>Allow Everything</title>
106
+ </all>
107
+ <admin>
108
+ <children>
109
+ <photoslurpwidget translate="title" module="photoslurpwidget">
110
+ <title>Photoslurp Widget</title>
111
+ <sort_order>1000</sort_order>
112
+ <children>
113
+ <photoslurpwidget translate="title">
114
+ <title>Manage Widgets</title>
115
+ <sort_order>0</sort_order>
116
+ </photoslurpwidget>
117
+ </children>
118
+ </photoslurpwidget>
119
+ </children>
120
+ </admin>
121
+ </resources>
122
+ </acl>
123
+ <layout>
124
+ <updates>
125
+ <photoslurpwidget>
126
+ <file>photoslurpwidget.xml</file>
127
+ </photoslurpwidget>
128
+ </updates>
129
+ </layout>
130
+ </adminhtml>
131
+ <crontab>
132
+ <jobs>
133
+ <photoslurpwidget_photoslurpexport>
134
+ <schedule><cron_expr>0 2 * * *</cron_expr></schedule>
135
+ <run><model>photoslurpwidget/cron::photoslurpExport</model></run>
136
+ </photoslurpwidget_photoslurpexport>
137
+ </jobs>
138
+ </crontab>
139
+ </config>
app/code/community/Photoslurp/PhotoslurpWidget/etc/system.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <photoslurp translate="label" module="photoslurpwidget">
5
+ <label>Photoslurp</label>
6
+ <sort_order>100</sort_order>
7
+ </photoslurp>
8
+ </tabs>
9
+ <sections>
10
+ <export translate="label" module="photoslurpwidget">
11
+ <label>Product Export</label>
12
+ <tab>photoslurp</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>20</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <export_configuration translate="label">
20
+ <label>Export Configuration</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>0</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <cron_enable translate="label">
28
+ <label>Auto export</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
31
+ <sort_order>0</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment>Export every 24 hours.</comment>
36
+ </cron_enable>
37
+ </fields>
38
+ </export_configuration>
39
+ </groups>
40
+ </export>
41
+ </sections>
42
+ </config>
app/code/community/Photoslurp/PhotoslurpWidget/sql/photoslurpwidget_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $sql=<<<SQLTEXT
5
+
6
+ CREATE TABLE photoslurp_widget (
7
+ id int(11) NOT NULL AUTO_INCREMENT,
8
+ widget_enable tinyint(1) DEFAULT NULL,
9
+ widget_container_id varchar(255) DEFAULT NULL,
10
+ widget_id varchar(255) DEFAULT NULL,
11
+ widget_type varchar(255) DEFAULT NULL,
12
+ album_id varchar(255) DEFAULT NULL,
13
+ product_id varchar(255) DEFAULT NULL,
14
+ lang varchar(255) DEFAULT NULL,
15
+ page_limit int(11) DEFAULT NULL,
16
+ page_type varchar(255) DEFAULT NULL,
17
+ show_submit tinyint(1) DEFAULT NULL,
18
+ submit_text text DEFAULT NULL,
19
+ add_photos_img text DEFAULT NULL,
20
+ note_add_pics_text text DEFAULT NULL,
21
+ note_add_pics_icons varchar(255) DEFAULT NULL,
22
+ social_icons tinyint(1) DEFAULT NULL,
23
+ image_height int(11) DEFAULT NULL,
24
+ image_width int(11) DEFAULT NULL,
25
+
26
+ style_submissionform_colourtop varchar(255) DEFAULT NULL,
27
+ style_submissionform_colourbutton varchar(255) DEFAULT NULL,
28
+ style_submissionform_font varchar(255) DEFAULT NULL,
29
+
30
+ style_taggingtitle_font_family varchar(255) DEFAULT NULL,
31
+ style_taggingtitle_font_style varchar(255) DEFAULT NULL,
32
+ style_taggingtitle_font_weight varchar(255) DEFAULT NULL,
33
+ style_taggingtitle_font_color varchar(255) DEFAULT NULL,
34
+ style_taggingtitle_font_size varchar(255) DEFAULT NULL,
35
+
36
+ style_thumbnail_bg_color varchar(255) DEFAULT NULL,
37
+ style_thumbnail_border_color varchar(255) DEFAULT NULL,
38
+
39
+ style_carousel_bg_color varchar(255) DEFAULT NULL,
40
+
41
+ style_popup_bg_color varchar(255) DEFAULT NULL,
42
+ style_popup_title_font_family varchar(255) DEFAULT NULL,
43
+ style_popup_title_font_style varchar(255) DEFAULT NULL,
44
+ style_popup_title_font_weight varchar(255) DEFAULT NULL,
45
+ style_popup_title_font_color varchar(255) DEFAULT NULL,
46
+
47
+ style_source_font_family varchar(255) DEFAULT NULL,
48
+ style_source_font_style varchar(255) DEFAULT NULL,
49
+ style_source_font_weight varchar(255) DEFAULT NULL,
50
+ style_source_font_color varchar(255) DEFAULT NULL,
51
+
52
+ style_productcaptionshop_font_family varchar(255) DEFAULT NULL,
53
+ style_productcaptionshop_font_style varchar(255) DEFAULT NULL,
54
+ style_productcaptionshop_font_weight varchar(255) DEFAULT NULL,
55
+ style_productcaptionshop_font_color varchar(255) DEFAULT NULL,
56
+
57
+ style_productdescription_font_family varchar(255) DEFAULT NULL,
58
+ style_productdescription_font_style varchar(255) DEFAULT NULL,
59
+ style_productdescription_font_weight varchar(255) DEFAULT NULL,
60
+ style_productdescription_font_color varchar(255) DEFAULT NULL,
61
+
62
+ style_custom longtext DEFAULT NULL,
63
+ style_custom_enable tinyint(1) DEFAULT NULL,
64
+
65
+
66
+
67
+ PRIMARY KEY (id)
68
+ )
69
+ ENGINE = INNODB
70
+ AUTO_INCREMENT = 6
71
+ AVG_ROW_LENGTH = 4096
72
+ CHARACTER SET utf8
73
+ COLLATE utf8_general_ci;
74
+
75
+ SQLTEXT;
76
+
77
+ $installer->run($sql);
78
+ //demo
79
+ //Mage::getModel('core/url_rewrite')->setId(null);
80
+ //demo
81
+ $installer->endSetup();
82
+
app/design/adminhtml/default/default/layout/photoslurpwidget.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <photoslurpwidget_adminhtml_photoslurpwidget_index>
5
+ <reference name="content">
6
+ <block type="photoslurpwidget/adminhtml_photoslurpwidget" name="photoslurpwidget" />
7
+ </reference>
8
+ </photoslurpwidget_adminhtml_photoslurpwidget_index>
9
+
10
+ <photoslurpwidget_adminhtml_photoslurpwidget_edit>
11
+ <reference name="head">
12
+ <action method="addJs"><script>photoslurp/admin.js</script></action>
13
+ </reference>
14
+ </photoslurpwidget_adminhtml_photoslurpwidget_edit>
15
+
16
+ <photoslurpwidget_adminhtml_photoslurpwidget_new>
17
+ <reference name="head">
18
+ <action method="addJs"><script>photoslurp/admin.js</script></action>
19
+ </reference>
20
+ </photoslurpwidget_adminhtml_photoslurpwidget_new>
21
+
22
+ <photoslurpwidget_adminhtml_photoslurpwidgetbackend_index>
23
+ <reference name="content">
24
+ <block type="adminhtml/template" name="photoslurpwidgetbackend" template="photoslurpwidget/photoslurpwidgetbackend.phtml"/>
25
+ <!--<block type="photoslurpwidget/adminhtml_photoslurpwidgetbackend" name="photoslurpwidgetbackend" template="photoslurpwidget/photoslurpwidgetbackend.phtml"/>-->
26
+ </reference>
27
+ </photoslurpwidget_adminhtml_photoslurpwidgetbackend_index>
28
+
29
+ </layout>
app/design/adminhtml/default/default/template/photoslurpwidget/photoslurpwidgetbackend.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $helper = Mage::helper('photoslurpwidget'); ?>
2
+
3
+ <div class="content-header">
4
+ <h3 class="icon-head head-adminhtml-photoslurpwidget">Photoslurp Product Export</h3>
5
+ </div>
6
+
7
+ <div>
8
+ <form method="get" action="<?php echo Mage::helper("adminhtml")->getUrl("photoslurpwidget/adminhtml_photoslurpwidgetbackend/export/") ?>">
9
+ <button type="submit"><?php echo Mage::helper('adminhtml')->__('Export products')?></button>
10
+ </form>
11
+ </div>
12
+
13
+ <br>
14
+
15
+ <?php if (file_exists($helper->getFileName())):?>
16
+ <p>
17
+ <?php echo Mage::helper('adminhtml')->__('Access link:')?>
18
+ <a href="<?php echo Mage::helper('adminhtml')->__('%s%s', Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),$helper->getFileName())?>" download><?php echo Mage::helper('adminhtml')->__('%s%s', Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),$helper->getFileName())?></a>
19
+ </p>
20
+ <?php endif; ?>
21
+
22
+
23
+
24
+
app/design/frontend/base/default/layout/photoslurpwidget.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <default>
5
+ <reference name="head">
6
+ <block type="photoslurpwidget/widget" template="photoslurpwidget/style.phtml"/>
7
+ </reference>
8
+ </default>
9
+
10
+ <catalog_product_view>
11
+ <reference name="product.info.additional">
12
+ <block type="photoslurpwidget/widget" template="photoslurpwidget/widget.phtml" name="photoslurpwidget">
13
+ <!--<action method="setData"><name>id</name><value>3</value></action>-->
14
+ <action method="setData"><name>type</name><value>product</value></action>
15
+ </block>
16
+ </reference>
17
+ </catalog_product_view>
18
+
19
+ <checkout_onepage_success>
20
+ <reference name="before_body_end">
21
+ <block name="photoslurp_tracking" template="photoslurpwidget/tracking.phtml" type="core/template" />
22
+ </reference>
23
+ </checkout_onepage_success>
24
+
25
+ </layout>
26
+
app/design/frontend/base/default/template/photoslurpwidget/style.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_product = $this->getProduct();
3
+ $_widgets = $this->getAllWidgets();
4
+ ?>
5
+
6
+ <?php foreach($_widgets as $widget):?>
7
+ <?php if($widget->getStyleCustomEnable()): ?>
8
+ <style type="text/css" data-photoslurp-css-id="<?php echo $widget->getWidgetContainerId(); ?>">
9
+ <?php echo $this->prepareStyleText($widget->getStyleCustom(),$widget->getWidgetContainerId()) ; ?>
10
+ </style>
11
+ <?php endif; ?>
12
+ <?php endforeach; ?>
13
+
app/design/frontend/base/default/template/photoslurpwidget/tracking.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_order = Mage::getSingleton('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
3
+ $_items = $_order->getAllVisibleItems();
4
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
5
+ ?>
6
+
7
+ <!-- Start Photoslurp Embed Code -->
8
+ <script type="text/javascript">
9
+ var photoSlurpTrackingSettings = {
10
+ products: {
11
+ <?php foreach($_items as $item):?>
12
+ '<?php echo $item->getSku() ?>': {count:<?php echo $item->getQtyOrdered() ?>, price:<?php echo $item->getPrice() ?>, curency: '<?php echo $currency_code ?>'},
13
+ <?php endforeach; ?>
14
+ }
15
+ };
16
+ (function() {
17
+ var d=document,
18
+ h=d.getElementsByTagName('head')[0],
19
+ s=d.createElement('script');
20
+ s.type='text/javascript';
21
+ s.async=true;
22
+ s.src='//static.photoslurp.com/widget/v1/tracking_notify.js';
23
+ h.appendChild(s);
24
+ }());
25
+ </script>
26
+ <!-- End Photoslurp Embed Code -->
app/design/frontend/base/default/template/photoslurpwidget/widget.phtml ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $_product = $this->getProduct();
4
+
5
+ if ($this->getData('type') == 'product') {
6
+ $_widget = $this->getProductPageWidget();
7
+ } else {
8
+ $_widget = $this->getWidget();
9
+ }
10
+
11
+ ?>
12
+
13
+ <?php if($_widget->getId()):
14
+
15
+ $_widget_container_id = $_widget->getWidgetContainerId();
16
+ $_widget_type = Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getValueArray5()[$_widget->getWidgetType()]['label'];
17
+ $_album_id = $_widget -> getAlbumId();
18
+ $_lang = Mage::app()->getStore()->getCode();//$_widget -> getLang();
19
+ $_widget_id = $_widget -> getWidgetId();
20
+ $_image_height = $_widget -> getImageHeight();
21
+ $_image_width = $_widget -> getImageWidth();
22
+ $_show_submit = $_widget -> getShowSubmit();
23
+ $_submit_text = $_widget -> getSubmitText();
24
+ $_page_limit = $_widget -> getPageLimit();
25
+ $_page_type = Photoslurp_PhotoslurpWidget_Block_Adminhtml_Photoslurpwidget_Grid::getValueArray10()[$_widget -> getPageType()]['label'];
26
+ $_product_id = ($_product)?$_product->getSku():'';
27
+ $_add_photos_img = $_widget -> getAddPhotosImg();
28
+ $_social_icons = $_widget -> getSocialIcons();
29
+ $_note_add_pics_text = $_widget -> getNoteAddPicsText();
30
+ $_note_add_pics_icons_arr = explode(",", $_widget->getNoteAddPicsIcons());
31
+
32
+ $_facebook = ($this->getIsFacebookIconEnabled())?'true':'false';
33
+ $_twitter = ($this->getIsTwitterIconEnabled())?'true':'false';
34
+ $_instagram = ($this->getIsInstagramIconEnabled())?'true':'false';
35
+
36
+ //STYLE PARAMETERS
37
+
38
+ $_style_submissionform_colourtop = $_widget->getData('style_submissionform_colourtop');
39
+ $_style_submissionform_colourbutton = $_widget->getData('style_submissionform_colourbutton');
40
+ $_style_submissionform_font = $_widget->getData('style_submissionform_font');
41
+
42
+ $_style_taggingtitle_font_family = $_widget->getData('style_taggingtitle_font_family');
43
+ $_style_taggingtitle_font_style = $_widget->getData('style_taggingtitle_font_style');
44
+ $_style_taggingtitle_font_weight = $_widget->getData('style_taggingtitle_font_weight');
45
+ $_style_taggingtitle_font_color = $_widget->getData('style_taggingtitle_font_color');
46
+ $_style_taggingtitle_font_size = $_widget->getData('style_taggingtitle_font_size');
47
+
48
+ $_style_thumbnail_bg_color = $_widget->getData('style_thumbnail_bg_color');
49
+ $_style_thumbnail_border_color = $_widget->getData('style_thumbnail_border_color');
50
+
51
+ $_style_carousel_bg_color = $_widget->getData('style_carousel_bg_color');
52
+
53
+ $_style_popup_bg_color = $_widget->getData('style_popup_bg_color');
54
+ $_style_popup_title_font_family = $_widget->getData('style_popup_title_font_family');
55
+ $_style_popup_title_font_style = $_widget->getData('style_popup_title_font_style');
56
+ $_style_popup_title_font_weight = $_widget->getData('style_popup_title_font_weight');
57
+ $_style_popup_title_font_color = $_widget->getData('style_popup_title_font_color');
58
+
59
+ $_style_source_font_family = $_widget->getData('style_source_font_family');
60
+ $_style_source_font_style = $_widget->getData('style_source_font_style');
61
+ $_style_source_font_weight = $_widget->getData('style_source_font_weight');
62
+ $_style_source_font_color = $_widget->getData('style_source_font_color');
63
+
64
+ $_style_productcaptionshop_font_family = $_widget->getData('style_productcaptionshop_font_family');
65
+ $_style_productcaptionshop_font_style = $_widget->getData('style_productcaptionshop_font_style');
66
+ $_style_productcaptionshop_font_weight = $_widget->getData('style_productcaptionshop_font_weight');
67
+ $_style_productcaptionshop_font_color = $_widget->getData('style_productcaptionshop_font_color');
68
+
69
+ $_style_productdescription_font_family = $_widget->getData('style_productdescription_font_family');
70
+ $_style_productdescription_font_style = $_widget->getData('style_productdescription_font_style');
71
+ $_style_productdescription_font_weight = $_widget->getData('style_productdescription_font_weight');
72
+ $_style_productdescription_font_color = $_widget->getData('style_productdescription_font_color');
73
+ ?>
74
+
75
+
76
+
77
+
78
+ <div id="<?php echo $_widget_container_id ?>" style="clear:both" class="ps-container">
79
+ <script data-type="photoslurp">
80
+
81
+ if(!photoSlurpWidgetSettings) {
82
+ var photoSlurpWidgetSettings = {};
83
+ }
84
+
85
+ (function() {
86
+ photoSlurpWidgetSettings['<?php echo $_widget_container_id ?>'] = {
87
+ widgetType: '<?php echo $_widget_type ?>',
88
+ albumId: <?php echo $_album_id ?>,
89
+ lang: '<?php echo $_lang ?>',
90
+ widgetId: '<?php echo $_widget_id ?>',
91
+ imageHeight: '<?php echo $this->__('%spx',$_image_height) ?>',
92
+ imageWidth: '<?php echo $this->__('%spx',$_image_width) ?>',
93
+ showSubmit: <?php echo $_show_submit ?>,
94
+ submitText: '<?php echo $_submit_text ?>',
95
+ page_limit: <?php echo $_page_limit ?>,
96
+ pageType: '<?php echo $_page_type ?>',
97
+ productId: '<?php echo $_product_id ?>',
98
+ addPhotosImg: '<?php echo $_add_photos_img ?>',
99
+ socialIcons: <?php echo $_social_icons ?>,
100
+ noteAddPicsText:'<?php echo $_note_add_pics_text ?>',
101
+ noteAddPicsIcons: {
102
+ facebook: <?php echo $_facebook ?>,
103
+ twitter: <?php echo $_twitter ?>,
104
+ instagram: <?php echo $_instagram ?>
105
+ },
106
+
107
+
108
+ style: {
109
+ submissionForm: {
110
+ colourTop: '<?php echo $_style_submissionform_colourtop ?>', //Default #4F5F6F
111
+ colourButton: '<?php echo $_style_submissionform_colourbutton ?>', //Default #5DADE2
112
+ font: '<?php echo $_style_submissionform_font ?>'//Default "Open Sans"
113
+ },
114
+ taggingTitle: {
115
+ font: {
116
+ family: '<?php echo $_style_taggingtitle_font_family ?>',
117
+ style: '<?php echo $_style_taggingtitle_font_style ?>',
118
+ weight: '<?php echo $_style_taggingtitle_font_weight ?>',
119
+ color: '<?php echo $_style_taggingtitle_font_color ?>',
120
+ size: '<?php echo $_style_taggingtitle_font_size ?>'
121
+ }
122
+ },
123
+ thumbnail: {
124
+ bg: {
125
+ color: '<?php echo $_style_thumbnail_bg_color ?>'
126
+ },
127
+ border: {
128
+ color: '<?php echo $_style_thumbnail_border_color ?>'
129
+ }
130
+ },
131
+ carousel: {
132
+ bg: {
133
+ color: '<?php echo $_style_carousel_bg_color ?>'
134
+ }
135
+ },
136
+ popup: {
137
+ bg: {
138
+ color: '<?php echo $_style_popup_bg_color ?>'
139
+ },
140
+ title: {
141
+ font: {
142
+ family: '<?php echo $_style_popup_title_font_family ?>',
143
+ style: '<?php echo $_style_popup_title_font_style ?>',
144
+ weight: '<?php echo $_style_popup_title_font_weight ?>',
145
+ color: '<?php echo $_style_popup_title_font_color ?>'
146
+ }
147
+ },
148
+ source: {
149
+ font: {
150
+ family: '<?php echo $_style_source_font_family ?>',
151
+ style: '<?php echo $_style_source_font_style ?>',
152
+ weight: '<?php echo $_style_source_font_weight ?>',
153
+ color: '<?php echo $_style_source_font_color ?>'
154
+ }
155
+ },
156
+ product_caption_shop: {
157
+ font: {
158
+ family: '<?php echo $_style_productcaptionshop_font_family ?>',
159
+ style: '<?php echo $_style_productcaptionshop_font_style ?>',
160
+ weight: '<?php echo $_style_productcaptionshop_font_weight ?>',
161
+ color: '<?php echo $_style_productcaptionshop_font_color ?>'
162
+ }
163
+ },
164
+ product_description: {
165
+ font: {
166
+ family: '<?php echo $_style_productdescription_font_family ?>',
167
+ style: '<?php echo $_style_productdescription_font_style ?>',
168
+ weight: '<?php echo $_style_productdescription_font_weight ?>',
169
+ color: '<?php echo $_style_productdescription_font_color ?>'
170
+ }
171
+ }
172
+ }
173
+ }
174
+ };
175
+ var script = document.createElement('script');
176
+ script.async = true;
177
+ script.src = 'http://www.photoslurp.com/static/widget/v1/widget_loader.js';
178
+ var entry = document.getElementsByTagName('script')[0];
179
+ entry.parentNode.insertBefore(script, entry);
180
+ })();
181
+
182
+ </script>
183
+ <a href="//corp.photoslurp.com" target="_blank" class="ps-poweredby-link">
184
+ <div class="ps-logo-widget-carousel"></div>
185
+ </a>
186
+ </div>
187
+
188
+ <?php endif; ?>
app/etc/modules/Photoslurp_PhotoslurpWidget.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Photoslurp_PhotoslurpWidget>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ </Photoslurp_PhotoslurpWidget>
9
+ </modules>
10
+ </config>
js/photoslurp/admin.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.observe('dom:loaded', function() {
2
+
3
+ switchFields($('widget_type').getValue());
4
+
5
+ Event.observe($('widget_type'),'change', function(){
6
+ switchFields(this.getValue());
7
+ });
8
+
9
+ function switchFields(val){
10
+ var img_width = $('image_width');
11
+ var img_height = $('image_height');
12
+ if(val == 1){
13
+ img_width.removeClassName('required-entry');
14
+ img_width.removeClassName('required-entry');
15
+ img_width.up('tr').hide();
16
+ img_height.up('tr').show();
17
+ }else{
18
+ if(val == 2){
19
+ img_height.removeClassName('required-entry');
20
+ img_height.removeClassName('required-entry');
21
+ img_width.up('tr').show();
22
+ img_height.up('tr').hide();
23
+ }else{
24
+ img_height.addClassName('required-entry');
25
+ img_height.up('tr').show();
26
+ img_width.addClassName('required-entry');
27
+ img_width.up('tr').show();
28
+ }
29
+
30
+ }
31
+ }
32
+
33
+ });
package.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>photoslurp_for_magento</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL-v3</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>A visual commerce and marketing platform that helps brands increase conversion rates by finding, curating, analysing and publishing customer photos from Instagram, Twitter and Facebook</summary>
10
+ <description>Photoslurp&#x2019;s Magento module allows brands to quickly and easily integrate customer photos in the form of UGC from across social networks into their Magento stores, increasing conversion rates and engagement.&#xD;
11
+ &#xD;
12
+ Some of Photoslurp&#x2019;s features:&#xD;
13
+ &#xD;
14
+ Make Customer Photos Shoppable: UGC photos can be linked directly to products in your catalog, allowing them to be directly shoppable using our &#x2018;Shop This Look&#x2019; feature &#xD;
15
+ &#xD;
16
+ Customizable Widgets: Unlimited number of completely customizable widgets, allowing you to integrate shoppable galleries into Lookbooks or product page carousels&#xD;
17
+ &#xD;
18
+ Analytics: Detailed analytics on everything from how your customers are interacting with your integrated UGC to which photos are driving the most revenue&#xD;
19
+ &#xD;
20
+ Automated Product Catalog Sync: Automated syncing with your Magento store to ensure Photoslurp always has the latest details from your product catalog to keep features such as &#x2018;Shop This Look&#x2019; working flawlessy.&#xD;
21
+ &#xD;
22
+ Evangelists: Identify your biggest evangelists by the number photos they have created about your brand, as well as their influence level and the amount of revenue their pictures have driven to your store.&#xD;
23
+ &#xD;
24
+ Learn more about Photoslurp&#x2019;s visual commerce and marketing platform at www.photoslurp.com&#xD;
25
+ </description>
26
+ <notes>First stable release</notes>
27
+ <authors><author><name>Ben Heinkel</name><user>benheinkel</user><email>ben@photoslurp.com</email></author></authors>
28
+ <date>2015-07-13</date>
29
+ <time>14:08:45</time>
30
+ <contents><target name="magecommunity"><dir name="Photoslurp"><dir name="PhotoslurpWidget"><dir name="Block"><dir name="Adminhtml"><file name="PhotoslurpWidgetbackend.php" hash="2b49591a547532b230cfdafdb01373b5"/><dir name="Photoslurpwidget"><dir name="Edit"><file name="Form.php" hash="e3ebf310859f3653039a2a9ce4a7a2bc"/><dir name="Tab"><file name="Form.php" hash="aebc277b61a1065114bd7a0b0d3c2d68"/><file name="Form1.php" hash="9679d1789e25df9acfaa98329d98857f"/><file name="Form2.php" hash="e5793f2c4eca49b71146745bb49af08e"/></dir><file name="Tabs.php" hash="74a1a30bbe2b0c272d9bce12028c3791"/></dir><file name="Edit.php" hash="99583b3ecde44838f5425fe63a8b4715"/><file name="Grid.php" hash="d3b13b6e6fe0ccd46e6be4e76c6e3b1f"/></dir><file name="Photoslurpwidget.php" hash="e5fc90a2da315f2e74ab3afd49455c7e"/></dir><file name="Widget.php" hash="5929dbf6b4421a3bd0a7f966d7db47ca"/></dir><dir name="Helper"><file name="Data.php" hash="61da950bec80670e6a856018cfbbd738"/></dir><dir name="Model"><file name="Cron.php" hash="e977a2fd3acb71136629366a3365eae7"/><dir name="Mysql4"><dir name="Photoslurpwidget"><file name="Collection.php" hash="1df259b1e26c2aec7fe1b08eba97847e"/></dir><file name="Photoslurpwidget.php" hash="86107037de174b7d6a8267b64f669d1c"/></dir><file name="Photoslurpwidget.php" hash="32b2ccbd3129bec06461c4571c1acf94"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PhotoslurpwidgetController.php" hash="5dcb4d0673b9105f620e7e9da8e6d216"/><file name="PhotoslurpwidgetbackendController.php" hash="a814366c630dc8d21f68cb543e04f292"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c73c2c02e06f5e3245301d5ac30c2dce"/><file name="config.xml" hash="12e777bf2177988c104623108088d0e4"/><file name="system.xml" hash="93044b2d1198b6ed9afd656c095754b1"/></dir><dir name="sql"><dir name="photoslurpwidget_setup"><file name="mysql4-install-0.1.0.php" hash="48684a283eaee034d604826bce1e97b0"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="photoslurpwidget.xml" hash="6e573725bedd956d1a01bf0b0b3f0115"/></dir><dir name="template"><dir name="photoslurpwidget"><file name="photoslurpwidgetbackend.phtml" hash="4d30ff86ad1e655b12a2b168ffbd8105"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="photoslurpwidget.xml" hash="0c29cc27b8f6c2d84fe4ecb5f88c6f6e"/></dir><dir name="template"><dir name="photoslurpwidget"><file name="style.phtml" hash="27186062459ea7736d1c4be0aeee0b53"/><file name="tracking.phtml" hash="0f20b49b435ee069c029a7a3bf64b5be"/><file name="widget.phtml" hash="963583309fcb02d72081ad598b1ab6c7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Photoslurp_PhotoslurpWidget.xml" hash="2a6846c50e65414252323da5afdd69ba"/></dir></target><target name="mageweb"><dir name="js"><dir name="photoslurp"><file name="admin.js" hash="c56d8a9f8983fe292c1ee4f234840148"/></dir></dir></target></contents>
31
+ <compatible/>
32
+ <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
33
+ </package>