easysize - Version 1.0

Version Notes

Multi shop configuration.
EasySize settings moved to System->Configuration.
Tracking on checkout page.
EasySize block added to 'before_body_end'.
One gender support.
Brand selectable (not default manufacturer anymore).

Download this release

Release Info

Developer EasySize IVS
Extension easysize
Version 1.0
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0

app/code/community/EasySize/SizeGuide/Block/Data.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class EasySize_SizeGuide_Block_Data extends Mage_Core_Block_Template {
4
+ private $size_attribute_id = false;
5
+
6
+ public function getRequiredAttributes() {
7
+ $this->required_attributes = new stdClass();
8
+
9
+ // product is currently viewed product
10
+ $product_id = $this->getRequest()->getParam('id');
11
+ $product = Mage::getModel('catalog/product')->load($product_id);
12
+
13
+ // Get all sizeguide settings from shop configurations
14
+ $shop_configuration = Mage::getStoreConfig('sizeguide/sizeguide');
15
+
16
+ $this->required_attributes->order_button_id = $shop_configuration['sizeguide_add_to_cart_button'];
17
+ $this->required_attributes->product_id = $product_id;
18
+ $this->required_attributes->product_brand = $product->getAttributeText($shop_configuration['sizeguide_brand_attribute']);
19
+ $this->required_attributes->product_gender = $product->getAttributeText($shop_configuration['sizeguide_gender_attribute']);
20
+ $one_gender = $shop_configuration['sizeguide_gender_one_attribute'];
21
+
22
+ // If one gender is set, the shop is selling on gender clothing items
23
+ if(strlen($one_gender) > 0) {
24
+ $this->required_attributes->product_gender = $one_gender;
25
+ }
26
+
27
+ $this->required_attributes->product_type = implode(',', $this->getProductCategoriesNames($product));
28
+ $this->required_attributes->sizes_in_stock = $this->getProductSizesInStock($product, $shop_configuration['sizeguide_size_attributes']);
29
+ $this->required_attributes->shop_id = $shop_configuration['sizeguide_shopid'];
30
+ $this->required_attributes->placeholder = $shop_configuration['sizeguide_button_placeholder'];
31
+ $this->required_attributes->size_selector = "attribute{$this->size_attribute_id}";
32
+ $this->required_attributes->user_id = $this->getCustomerId();
33
+ $this->required_attributes->image_url = Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage());
34
+
35
+ return json_encode($this->required_attributes);
36
+ }
37
+
38
+ /*
39
+ * Returns all product category names
40
+ */
41
+ private function getProductCategoriesNames($product) {
42
+ $all_product_categories = array();
43
+
44
+ foreach($product->getCategoryCollection()->addAttributeToSelect('name') as $category) {
45
+ $all_product_categories[] = $category->getName();
46
+ }
47
+
48
+ return $all_product_categories;
49
+ }
50
+
51
+ /*
52
+ * Iterates through all the simple products created from the configurable product
53
+ * Returns array of product's sizes in stock.
54
+ */
55
+ private function getProductSizesInStock($product, $size_attribute_codes) {
56
+ $child_products = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
57
+ $sizes_in_stock = array();
58
+ $product_attributes = Mage::getModel('eav/config')
59
+ ->getEntityAttributeCodes(Mage_Catalog_Model_Product::ENTITY,$product);
60
+
61
+ // Iterate through all simple products
62
+ foreach ($child_products as $simple_product) {
63
+ // Iterate through all size attributes
64
+ foreach (explode(',', $size_attribute_codes) as $size_attribute) {
65
+ if(in_array($size_attribute, $product_attributes)) {
66
+ $current_simple_product_id = $simple_product->getId();
67
+ $current_simple_product = Mage::getModel('catalog/product')->load($current_simple_product_id);
68
+ $quantity = $current_simple_product->getStockItem()->getQty();
69
+ $size = $current_simple_product->getAttributeText($size_attribute);
70
+ $sizes_in_stock[$size] = $quantity;
71
+
72
+ /* When looking for size attribute id,
73
+ * make sure there is atleast one item of that attribute,
74
+ * and attribute is actually set
75
+ */
76
+ if(!$this->size_attribute_id && $quantity > 0 && strlen($size) > 0) {
77
+ $this->size_attribute_id = Mage::getResourceModel('eav/entity_attribute')
78
+ ->getIdByCode('catalog_product', $size_attribute);
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ return $sizes_in_stock;
85
+ }
86
+
87
+ /*
88
+ * Returns logged in customer id || -1
89
+ */
90
+ private function getCustomerId() {
91
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
92
+ return Mage::getSingleton('customer/session')->getCustomerId();
93
+ } else {
94
+ return -1;
95
+ }
96
+ }
97
+
98
+ /*
99
+ * Custom debuging function. Not used in production
100
+ */
101
+ public function log($text) {
102
+ Mage::log($text, null, 'sizeguide.log');
103
+ }
104
+ }
app/code/community/EasySize/SizeGuide/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class EasySize_SizeGuide_Helper_Data extends Mage_Core_Helper_Abstract {
4
+
5
+ }
app/code/community/EasySize/SizeGuide/Model/Observer.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class EasySize_SizeGuide_Model_Observer {
4
+ public function sendTrackingData($observer) {
5
+ if(Mage::getModel('core/cookie')->get('es_cart_items') != false) {
6
+ // Get all items in cart
7
+ $order = Mage::getModel('sales/order')->load($observer->getData('order_ids')[0]);
8
+ $items_in_cart = json_decode(Mage::getModel('core/cookie')->get('es_cart_items'));
9
+ $this->orders = new stdClass();
10
+
11
+ // iterate through all items in the order
12
+ foreach($order->getAllItems() as $order_item) {
13
+ // Unserialize item data
14
+ $item = unserialize($order_item->product_options);
15
+
16
+ // Check whether ordered item exists in cart
17
+ if(isset($item['simple_sku']) && isset($items_in_cart->$item['simple_sku'])) {
18
+ $size_attributes = array();
19
+ foreach(explode(',', Mage::getStoreConfig('sizeguide/sizeguide/sizeguide_size_attributes')) as $attribute) {
20
+ $sattr = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $attribute);
21
+ $size_attributes[] = $sattr->getFrontendLabel();
22
+ }
23
+
24
+ foreach ($item['attributes_info'] as $value) {
25
+ if (in_array($value['label'], $size_attributes)) {
26
+ $curl = curl_init("https://popup.easysize.me/collect?a=24&v=".urlencode($value['value'])."&pv={$items_in_cart->$item['simple_sku']}");
27
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
28
+ curl_exec($curl);
29
+ curl_close($curl);
30
+ }
31
+ }
32
+ }
33
+ }
34
+
35
+ Mage::getModel('core/cookie')->delete('es_cart_items', '/');
36
+ Mage::getModel('core/cookie')->set('es_cart_items', '', 0, '/');
37
+ }
38
+ }
39
+
40
+ public function addToCart($observer) {
41
+ $item_data = $observer->getEvent()->getQuoteItem()->getProduct()->getData();
42
+ if(Mage::getModel('core/cookie')->get('esui') && Mage::getModel('core/cookie')->get('espageview')) {
43
+ if(Mage::getModel('core/cookie')->get('es_cart_items') != false) {
44
+ $items_in_cart = json_decode(Mage::getModel('core/cookie')->get('es_cart_items'));
45
+ } else {
46
+ $items_in_cart = new stdClass();
47
+ }
48
+
49
+ $items_in_cart->$item_data['sku'] = Mage::getModel('core/cookie')->get('espageview');
50
+ Mage::getModel('core/cookie')->set('es_cart_items', json_encode($items_in_cart), 2678400, '/');
51
+ }
52
+ }
53
+
54
+ public function updateCart($observer) {
55
+ // todo. Fix update cart
56
+ }
57
+ }
app/code/community/EasySize/SizeGuide/Model/ShopAttributes.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * Get a list of all attributes in the shop.
5
+ * Used in the configuration(system.xml) to select values.
6
+ */
7
+
8
+ class EasySize_SizeGuide_Model_ShopAttributes {
9
+
10
+ public function toOptionArray() {
11
+ $result = Array();
12
+ $shopAttributes = Mage::getResourceModel('catalog/product_attribute_collection')
13
+ ->getItems();
14
+
15
+ foreach ($shopAttributes as $attribute) {
16
+ $code = $attribute->getAttributeCode();
17
+ $label = $attribute->getFrontendLabel();
18
+ $result[] = array('value'=>$code, 'label'=>$label);
19
+ }
20
+
21
+ return $result;
22
+ }
23
+ }
app/code/community/EasySize/SizeGuide/etc/config.xml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <EasySize_SizeGuide>
5
+ <version>1.2.0</version>
6
+ </EasySize_SizeGuide>
7
+ </modules>
8
+
9
+ <adminhtml>
10
+ <acl>
11
+ <resources>
12
+ <admin>
13
+ <children>
14
+ <system>
15
+ <children>
16
+ <config>
17
+ <children>
18
+ <sizeguide>
19
+ <title>EasySize SizeGuide Module Section</title>
20
+ </sizeguide>
21
+ </children>
22
+ </config>
23
+ </children>
24
+ </system>
25
+ </children>
26
+ </admin>
27
+ </resources>
28
+ </acl>
29
+ </adminhtml>
30
+
31
+ <frontend>
32
+ <layout>
33
+ <updates>
34
+ <sizeguide>
35
+ <file>sizeguide.xml</file>
36
+ </sizeguide>
37
+ </updates>
38
+ </layout>
39
+
40
+ <events>
41
+ <checkout_onepage_controller_success_action>
42
+ <observers>
43
+ <easysize_sizeguide_checkout>
44
+ <type>singleton</type>
45
+ <class>sizeguide/observer</class>
46
+ <method>sendTrackingData</method>
47
+ </easysize_sizeguide_checkout>
48
+ </observers>
49
+ </checkout_onepage_controller_success_action>
50
+ <checkout_cart_product_add_after>
51
+ <observers>
52
+ <easysize_sizeguide_add_to_cart>
53
+ <type>singleton</type>
54
+ <class>sizeguide/observer</class>
55
+ <method>addToCart</method>
56
+ </easysize_sizeguide_add_to_cart>
57
+ </observers>
58
+ </checkout_cart_product_add_after>
59
+ <checkout_cart_update_item_complete>
60
+ <observers>
61
+ <easysize_sizeguide_update_cart>
62
+ <type>singleton</type>
63
+ <class>sizeguide/observer</class>
64
+ <method>updateCart</method>
65
+ </easysize_sizeguide_update_cart>
66
+ </observers>
67
+ </checkout_cart_update_item_complete>
68
+ </events>
69
+ </frontend>
70
+
71
+ <global>
72
+ <models>
73
+ <sizeguide>
74
+ <class>EasySize_SizeGuide_Model</class>
75
+ </sizeguide>
76
+ </models>
77
+
78
+ <blocks>
79
+ <sizeguide>
80
+ <class>EasySize_SizeGuide_Block</class>
81
+ </sizeguide>
82
+ </blocks>
83
+
84
+ <helpers>
85
+ <sizeguide>
86
+ <class>EasySize_SizeGuide_Helper</class>
87
+ </sizeguide>
88
+ </helpers>
89
+ </global>
90
+ </config>
app/code/community/EasySize/SizeGuide/etc/system.xml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <tabs>
3
+ <easysize translate="label" module="sizeguide">
4
+ <label>EasySize</label>
5
+ <sort_order>99999</sort_order>
6
+ </easysize>
7
+ </tabs>
8
+ <sections>
9
+ <sizeguide translate="label" module="sizeguide">
10
+ <label>Settings</label>
11
+ <tab>easysize</tab>
12
+ <frontend_type>text</frontend_type>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <sizeguide translate="label">
19
+ <label>Required fields</label>
20
+ <comment>Please consult your developers or EasySize team if you are not sure about the right value to be selected.</comment>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1</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
+ <sizeguide_shopid>
28
+ <label>Shop ID</label>
29
+ <comment>Provided by EasySize</comment>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>1</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
+ </sizeguide_shopid>
36
+
37
+ <sizeguide_gender_attribute>
38
+ <label>Gender attribute code</label>
39
+ <comment>Select the attribute that contains gender information</comment>
40
+ <frontend_type>select</frontend_type>
41
+ <source_model>sizeguide/shopAttributes</source_model>
42
+ <sort_order>2</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </sizeguide_gender_attribute>
47
+
48
+ <sizeguide_gender_one_attribute>
49
+ <label>Gender</label>
50
+ <comment>If you sell one gender items only, enter that gender (Male or Female). Leave blank otherwise!</comment>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>3</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </sizeguide_gender_one_attribute>
57
+
58
+ <sizeguide_brand_attribute>
59
+ <label>Brand attribute code</label>
60
+ <comment>Select the attribute that contains brand information</comment>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>sizeguide/shopAttributes</source_model>
63
+ <sort_order>4</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ </sizeguide_brand_attribute>
68
+
69
+ <sizeguide_size_attributes>
70
+ <label>Size attribute codes</label>
71
+ <comment>Select all attributes that contain size information</comment>
72
+ <frontend_type>multiselect</frontend_type>
73
+ <source_model>sizeguide/shopAttributes</source_model>
74
+ <sort_order>5</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ </sizeguide_size_attributes>
79
+
80
+ <sizeguide_button_placeholder>
81
+ <label>EasySize button placeholder</label>
82
+ <comment>Selector of the element where EasySize will be appended</comment>
83
+ <frontend_type>text</frontend_type>
84
+ <sort_order>6</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </sizeguide_button_placeholder>
89
+
90
+ <sizeguide_add_to_cart_button>
91
+ <label>Add to cart button</label>
92
+ <comment>Selector of your add to cart button</comment>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>7</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ </sizeguide_add_to_cart_button>
99
+
100
+ <!-- TODO thing about the button design, should we load it dynamically instead? -->
101
+ </fields>
102
+ </sizeguide>
103
+ </groups>
104
+ </sizeguide>
105
+ </sections>
106
+ </config>
app/code/community/Easysize/Webapp/Block/Attr.php DELETED
@@ -1,211 +0,0 @@
1
- <?php
2
-
3
- class Easysize_Webapp_Block_Attr extends Mage_Core_Block_Template{
4
-
5
- private $sizeCode;
6
- private $genderCode;
7
- private $attrObj;
8
-
9
- /**
10
- * @description : get theme
11
- **/
12
- public function getVersion()
13
- {
14
- return Mage::getSingleton('core/design_package')->getTheme('frontend');
15
- }
16
-
17
-
18
- /**
19
- * @notice : the product need to have a field manufacturer, gender, and size
20
- * admin panel for "gender" & "size"
21
- * Manufacturer it'sn't a default attribute but already implemented in magento framework
22
- **/
23
- public function getProductObject(){
24
-
25
- $id = $this->getRequest()->getParam('id');
26
- $current_product=Mage::getModel('catalog/product')->load($id);
27
-
28
- $this->sizeCode = Mage::getStoreConfig('easysize_section/easysize_group/size_field',Mage::app()->getStore());
29
- $this->genderCode = Mage::getStoreConfig('easysize_section/easysize_group/gender_field',Mage::app()->getStore());
30
-
31
-
32
- if(!$current_product->isConfigurable() || !$this->attributesExist($current_product, $this->genderCode)) return false;
33
-
34
- $this->attrObj = new stdClass();
35
-
36
- $this->attrObj->product_id =$current_product->getSku();
37
-
38
- $id = $this->getRequest()->getParam('id');
39
-
40
- // Order button
41
- $this->attrObj->order_button_id = strlen(Mage::getStoreConfig('easysize_section/easysize_group/add_to_cart_field',Mage::app()->getStore())) > 2 ? Mage::getStoreConfig('easysize_section/easysize_group/add_to_cart_field',Mage::app()->getStore()) : ".add-to-cart-buttons";
42
-
43
- $this->attrObj->product_brand = $current_product->getAttributeText('manufacturer');
44
-
45
- $ncat = $current_product->getCategoryIds();
46
- $this->attrObj->product_type = array();
47
-
48
- for ($i=0; $i < sizeof($ncat); $i++) {
49
- $this->attrObj->product_type[] = Mage::getModel('catalog/category')->load($ncat[$i])->getName();
50
- }
51
-
52
- $this->attrObj->product_type = implode(",", $this->attrObj->product_type);
53
- $this->attrObj->product_gender = $current_product->getAttributeText($this->genderCode);
54
- $this->attrObj->user_id = $this->getUser();
55
- $this->attrObj->size_selector = "attribute".$this->getSizeNumberAttribute();
56
- $this->attrObj->placeholder = Mage::getStoreConfig('easysize_section/easysize_group/placeholder_field',Mage::app()->getStore());
57
-
58
-
59
- $this->attrObj->custom_style = Mage::getStoreConfig('easysize_section/easysize_group/style_field',Mage::app()->getStore());
60
- $this->attrObj->shop_id = Mage::getStoreConfig('easysize_section/easysize_group/id_shop_field',Mage::app()->getStore());
61
-
62
- $attributes = $current_product->getAttributes();
63
- $childProducts = Mage::getModel('catalog/product_type_configurable')
64
- ->getUsedProducts(null,$current_product);
65
-
66
- $sizeObj = array();
67
- foreach($childProducts as $child) {
68
- if($this->attributesExist($child, $this->sizeCode)){
69
- $chid = $child->getId();
70
- $current_child_product=Mage::getModel('catalog/product')->load($chid);
71
- $qty = $current_child_product->getStockItem()->getQty();
72
- $size = $current_child_product->getAttributeText($this->sizeCode);
73
- $sizeObj[$size] = $qty;
74
- }
75
- }
76
- $this->attrObj->sizes_in_stock = $sizeObj;
77
-
78
-
79
- if(!empty($izeObj) || !$this->attrObj->product_brand || !$this->attrObj->product_gender){
80
- return false;
81
- }else{
82
- return true;
83
-
84
- }
85
-
86
- }
87
- public function getObj(){
88
- return json_encode($this->attrObj);
89
- }
90
-
91
- public function getSizeNumberAttribute(){
92
- $this->sizeCode = Mage::getStoreConfig('easysize_section/easysize_group/size_field',Mage::app()->getStore());
93
- $tize = Mage::getSingleton("eav/config")->getAttribute('catalog_product', $this->sizeCode);
94
- $attrSize = $tize->getData();
95
-
96
- return $attrSize['attribute_id'];
97
- }
98
-
99
- public function getUser(){
100
- if(Mage::getSingleton('customer/session')->isLoggedIn()) {
101
- $customerData = Mage::getSingleton('customer/session')->getCustomer();
102
- return $customerData->getId();
103
- }else{
104
- return -1;
105
- }
106
- }
107
-
108
- public function attributesExist($product, $attrCode){
109
- $attributes = $product->getAttributes();
110
-
111
- foreach ($attributes as $attribute){
112
- if($attribute->getAttributecode()==$attrCode){
113
- return true;
114
- }
115
- }
116
- return false;
117
- }
118
-
119
- public function getProductId(){
120
- return $this->getRequest()->getParam('id');
121
- }
122
-
123
- public function checkCart(){
124
-
125
- $quote = Mage::getSingleton('checkout/session')->getQuote();
126
- $cartItems = $quote->getAllVisibleItems();
127
- $arr = Array();
128
- foreach ($cartItems as $item){
129
- $productId = $item->getProductId();
130
- array_push($arr, $productId);
131
- }
132
-
133
- return json_encode($arr);
134
- }
135
-
136
- public function attributeExistsInTheShop($code){
137
-
138
- $attributes = Mage::getModel('catalog/product')->getAttributes();
139
- $attributeArray = array();
140
-
141
- foreach($attributes as $a){
142
-
143
- foreach ($a->getEntityType()->getAttributeCodes() as $attributeName) {
144
- array_push($attributeArray, $attributeName);
145
- }
146
- break;
147
- }
148
- return in_array($code, $attributeArray);
149
- }
150
-
151
- public function getAllProducts($sizeCode, $genderCode){
152
-
153
- $allProducts = Array();
154
- $products = Mage::getModel('catalog/product')->getCollection();
155
- $_productCollection = clone $products;
156
- $_productCollection->clear()
157
- ->addAttributeToFilter('type_id', 'configurable')
158
- ->load();
159
-
160
- foreach($_productCollection as $prod) {
161
- $obj= new stdClass();
162
- $valid = true;
163
- $product = Mage::getModel('catalog/product')->load($prod->getId());
164
-
165
- $obj->name = $product->name;
166
- if($this->attributesExist($product, $genderCode)){
167
- $obj->gender = $product->getAttributeText($genderCode);
168
- }else{
169
- $obj->gender = "No";
170
- $valid = false;
171
- }
172
-
173
- $ncat = $product->getCategoryIds()[0];
174
- $product_type = Mage::getModel('catalog/category')->load($ncat)->getName();
175
- if($product_type){
176
- $obj->product_type = $product_type;
177
- }else{
178
- $obj->product_type = "No";
179
- $valid = false;
180
- }
181
-
182
- $obj->children = "No";
183
- $childProducts = Mage::getModel('catalog/product_type_configurable')
184
- ->getUsedProducts(null,$product);
185
-
186
- foreach($childProducts as $child) {
187
- if($this->attributesExist($child, $sizeCode)){
188
- $obj->children = "Yes";
189
- break;
190
- }
191
- }
192
- if($obj->children == "No"){
193
- $valid = false;
194
- }
195
-
196
-
197
- if($this->attributesExist($product, "manufacturer") && $product->getAttributeText('manufacturer') !=""){
198
- $obj->product_brand = $product->getAttributeText("manufacturer");
199
- }else{
200
- $obj->product_brand = "No";
201
- $valid = false;
202
- }
203
-
204
- $obj->valid = $valid;
205
- array_push($allProducts, $obj);
206
- }
207
-
208
- return $allProducts;
209
- }
210
-
211
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Easysize/Webapp/Helper/Data.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
-
3
-
4
- class Easysize_Webapp_Helper_Data extends Mage_Core_Helper_Abstract{
5
-
6
-
7
- public function isAvailable($id){
8
-
9
-
10
- $current_product=Mage::getModel('catalog/product')->load($id);
11
-
12
- $sizeCode = Mage::getStoreConfig('easysize_section/easysize_group/size_field',Mage::app()->getStore());
13
- $genderCode = Mage::getStoreConfig('easysize_section/easysize_group/gender_field',Mage::app()->getStore());
14
-
15
-
16
- if(!$current_product->isConfigurable() || !$this->attributesExist($current_product, $genderCode)) return false;
17
-
18
- $product_brand = $current_product->getAttributeText('manufacturer');
19
-
20
- $ncat = $current_product->getCategoryIds()[0];
21
- $product_type = Mage::getModel('catalog/category')->load($ncat)->getName();
22
-
23
- $product_gender = $current_product->getAttributeText($genderCode);
24
-
25
- $shop_id = Mage::getStoreConfig('easysize_section/easysize_group/id_shop_field',Mage::app()->getStore());
26
-
27
- $attributes = $current_product->getAttributes();
28
- $childProducts = Mage::getModel('catalog/product_type_configurable')
29
- ->getUsedProducts(null,$current_product);
30
-
31
- $sizeObj = array();
32
- foreach($childProducts as $child) {
33
- if($this->attributesExist($child, $sizeCode)){
34
- $chid = $child->getId();
35
- $current_child_product=Mage::getModel('catalog/product')->load($chid);
36
- $qty = $current_child_product->getStockItem()->getQty();
37
- $size = $current_child_product->getAttributeText($sizeCode);
38
- $sizeObj[$size] = $qty;
39
- }
40
- }
41
-
42
- if(!empty($izeObj) || !$product_brand || !$product_gender || !$product_type){
43
- return false;
44
- }else{
45
- return true;
46
- }
47
-
48
- }
49
-
50
- public function attributesExist($product, $attrCode){
51
- $attributes = $product->getAttributes();
52
-
53
- foreach ($attributes as $attribute){
54
- if($attribute->getAttributecode()==$attrCode){
55
- return true;
56
- }
57
- }
58
- return false;
59
- }
60
- }
61
-
62
-
63
-
64
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Easysize/Webapp/Model/Observer.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
-
3
- class Easysize_Webapp_Model_Observer extends Varien_Event_Observer{
4
- public function __construct(){}
5
-
6
- public function checkoutObserver($observer){
7
-
8
- $eso = Mage::getModel('core/cookie')->get("eso");
9
- Mage::log('eso from cookie: ' . $eso );
10
-
11
- $quote = Mage::getSingleton('checkout/session')->getQuote();
12
- $cartItems = $quote->getAllVisibleItems();
13
-
14
- $arr = Array();
15
-
16
- $eso = Mage::getModel('core/cookie')->get("eso");
17
- $eso = json_decode($eso);
18
-
19
- $order_id = $observer->getEvent()->getOrder()->getId();
20
-
21
- foreach ($eso as $key => $value){
22
- if($this->inTheCart($value->product_id)){
23
- $url = 'http://54.186.147.109/prod/web_app_v1.0/php/track.php';
24
- $data = array('pageview_id' => $value->skey,'value' => $order_id, 'action' => '19');
25
-
26
- $options = array(
27
- 'http' => array(
28
- 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
29
- 'method' => 'POST',
30
- 'content' => http_build_query($data),
31
- ),
32
- );
33
- $context = stream_context_create($options);
34
- $response = file_get_contents($url, false, $context);
35
- Mage::log($response);
36
- }
37
- }
38
-
39
- Mage::getModel('core/cookie')->delete("eso");
40
-
41
- }
42
- public function logCartAdd($observer){
43
-
44
-
45
-
46
- $eso = Mage::getModel('core/cookie')->get("eso");
47
- $skey = Mage::getModel('core/cookie')->get('skey');
48
-
49
- $product = Mage::getModel('catalog/product')
50
- ->load(Mage::app()->getRequest()->getParam('product', 0));
51
- $id = $product->getId();
52
-
53
- $helper = Mage::helper('webapp/data');
54
- $bool = $helper->isAvailable($id);
55
- if($bool){
56
-
57
- $eso = Mage::getModel('core/cookie')->get("eso");
58
-
59
- $curr = Array('skey'=>$skey, 'product_id'=>$id);
60
- $arr = json_decode($eso);
61
-
62
- if($eso==false || $eso==null || $eso==""){
63
- $arr = Array();
64
- }
65
- array_push($arr, $curr);
66
- $eso = json_encode($arr);
67
-
68
- Mage::getSingleton('core/cookie')->set('eso', $eso);
69
-
70
- }
71
- }
72
-
73
- public function inTheCart($id){
74
- $quote = Mage::getSingleton('checkout/session')->getQuote();
75
- foreach($quote->getAllVisibleItems() as $item) {
76
- if ($item->getData('product_id') == $id) {
77
- return true;
78
- break;
79
- }
80
- }
81
- return false;
82
- }
83
-
84
-
85
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Easysize/Webapp/controllers/Adminhtml/IndexController.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
-
3
- class Easysize_Webapp_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action {
4
- public function indexAction(){
5
- $this->loadLayout();
6
- $this->renderLayout();
7
- }
8
- }
 
 
 
 
 
 
 
 
app/code/community/Easysize/Webapp/controllers/IndexController.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
-
3
- class Easysize_Webapp_IndexController extends Mage_Core_Controller_Front_Action {
4
- public function indexAction(){
5
- $this->loadLayout(array('default'));
6
- $this->renderLayout();
7
- }
8
- }
 
 
 
 
 
 
 
 
app/code/community/Easysize/Webapp/etc/config.xml DELETED
@@ -1,121 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <default>
4
- <easysize_section>
5
- <easysize_group>
6
- <size_field>size</size_field>
7
- <gender_field>gender</gender_field>
8
- <placeholder_field>product-options-wrapper</placeholder_field>
9
- <style_field>stylepit</style_field>
10
- </easysize_group>
11
- </easysize_section>
12
- </default>
13
- <admin>
14
- <routers>
15
- <myadmin>
16
- <use>admin</use>
17
- <args>
18
- <module>Easysize_Webapp</module>
19
- <frontName>easysize</frontName>
20
- </args>
21
- </myadmin>
22
- </routers>
23
- </admin>
24
- <adminhtml>
25
- <layout>
26
- <updates>
27
- <webapp>
28
- <file>webapp_admin.xml</file>
29
- </webapp>
30
- </updates>
31
- </layout>
32
- <menu>
33
- <test translate="title" module="adminhtml">
34
- <title>EasySize</title>
35
- <sort_order>100</sort_order>
36
- <children>
37
- <set_time>
38
- <title>Overview</title>
39
- <action>easysize/adminhtml_index</action>
40
- </set_time>
41
- </children>
42
- </test>
43
- </menu>
44
-
45
- </adminhtml>
46
- <global>
47
- <modules>
48
- <Easysize_Webapp>
49
- <version>1.0.1</version>
50
- </Easysize_Webapp>
51
- </modules>
52
- <blocks>
53
- <webapp>
54
- <class>Easysize_Webapp_Block</class>
55
- </webapp>
56
- </blocks>
57
- <helpers>
58
- <webapp>
59
- <class>Easysize_Webapp_Helper</class>
60
- </webapp>
61
- </helpers>
62
- <models>
63
- <webapp>
64
- <class>Easysize_Webapp_Model</class>
65
- </webapp>
66
- </models>
67
-
68
- <ressources>
69
- <webapp_write>
70
- <connection>
71
- <use>core_write</use>
72
- </connection>
73
- </webapp_write>
74
- <webapp_read>
75
- <connection>
76
- <use>core_read</use>
77
- </connection>
78
- </webapp_read>
79
- </ressources>
80
- </global>
81
-
82
- <frontend>
83
- <events>
84
- <controller_action_predispatch_checkout_cart_add>
85
- <observers>
86
- <webapp>
87
- <class>webapp/observer</class>
88
- <method>logCartAdd</method>
89
- </webapp>
90
- </observers>
91
- </controller_action_predispatch_checkout_cart_add>
92
-
93
- <sales_order_place_after>
94
- <observers>
95
- <webapp>
96
- <type>singleton</type>
97
- <class>webapp/observer</class>
98
- <method>checkoutObserver</method>
99
- </webapp>
100
- </observers>
101
- </sales_order_place_after>
102
- </events>
103
- <routers>
104
- <routeurfrontend>
105
- <use>standard</use>
106
- <args>
107
- <module>Easysize_Webapp</module>
108
- <frontName>webapp</frontName>
109
- </args>
110
- </routeurfrontend>
111
- </routers>
112
- <layout>
113
- <updates>
114
- <webapp>
115
- <file>webapp.xml</file>
116
- </webapp>
117
- </updates>
118
- </layout>
119
- </frontend>
120
-
121
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Easysize/Webapp/etc/system.xml DELETED
@@ -1,80 +0,0 @@
1
- <!-- <?xml version="1.0" ?>
2
- <config>
3
- <tabs>
4
- <easysize_tab translate="label">
5
- <label>EasySize Configuration</label>
6
- <sort_order>100</sort_order>
7
- </easysize_tab>
8
- </tabs>
9
- <sections>
10
- <easysize_section translate="label">
11
- <label>General</label>
12
- <sort_order>200</sort_order>
13
- <show_in_default>1</show_in_default>
14
- <show_in_website>1</show_in_website>
15
- <show_in_store>1</show_in_store>
16
- <tab>easysize_tab</tab>
17
- <groups>
18
- <easysize_group translate="label">
19
- <label>Configuration</label>
20
-
21
- <comment>Please fill the form with the code attribute corresponding to the value</comment>
22
- <sort_order>10</sort_order>
23
- <show_in_default>1</show_in_default>
24
- <show_in_website>1</show_in_website>
25
- <show_in_store>1</show_in_store>
26
- <expanded>1></expanded>
27
- <fields>
28
- <size_field translate="label">
29
- <label>Size</label>
30
- <comment>Size code attribut here</comment>
31
- <frontend_type>text</frontend_type>
32
- <sort_order>10</sort_order>
33
- <show_in_default>2</show_in_default>
34
- <show_in_website>2</show_in_website>
35
- <show_in_store>2</show_in_store>
36
- </size_field>
37
- <gender_field translate="label">
38
- <label>Gender</label>
39
- <comment>gender code attribut here</comment>
40
- <frontend_type>text</frontend_type>
41
- <sort_order>20</sort_order>
42
- <show_in_default>2</show_in_default>
43
- <show_in_website>2</show_in_website>
44
- <show_in_store>2</show_in_store>
45
- </gender_field>
46
- <placeholder_field translate="label">
47
- <label>Placeholder</label>
48
- <comment>Default value : product-options-wrapper</comment>
49
- <frontend_type>text</frontend_type>
50
- <sort_order>30</sort_order>
51
- <show_in_default>2</show_in_default>
52
- <show_in_website>2</show_in_website>
53
- <show_in_store>2</show_in_store>
54
- </placeholder_field>
55
- <id_shop_field translate="label">
56
- <label>Your id shop</label>
57
- <comment>Your id shop provided by EasySize</comment>
58
- <frontend_type>text</frontend_type>
59
- <sort_order>40</sort_order>
60
- <show_in_default>2</show_in_default>
61
- <show_in_website>2</show_in_website>
62
- <show_in_store>2</show_in_store>
63
- </id_shop_field>
64
- <style_field translate="label">
65
- <label>Style name</label>
66
- <comment>Default value : sliding</comment>
67
- <frontend_type>text</frontend_type>
68
- <sort_order>40</sort_order>
69
- <show_in_default>2</show_in_default>
70
- <show_in_website>2</show_in_website>
71
- <show_in_store>2</show_in_store>
72
- </style_field>
73
- </fields>
74
-
75
- </easysize_group>
76
- </groups>
77
-
78
- </easysize_section>
79
- </sections>
80
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/webapp_admin.xml DELETED
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" ?>
2
- <layout version="0.1.0">
3
-
4
- <myadmin_adminhtml_index_index>
5
- <reference name="content">
6
- <block type="webapp/Attr" name="admin_test" template="webapp/afficher.phtml" />
7
- </reference>
8
- </myadmin_adminhtml_index_index>
9
- </layout>
10
-
11
-
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/webapp/afficher.phtml DELETED
@@ -1,206 +0,0 @@
1
- <style>
2
-
3
- .content{
4
- width: 100%;
5
- margin: auto;
6
- }
7
- .title{
8
- text-align: center;
9
- }
10
- #logo{
11
- width: 140px;
12
- }
13
- .table {
14
- margin-bottom: 20px;
15
- max-width: 100%;
16
- width: 100%;
17
- }
18
- .alert-danger {
19
- text-align: center;
20
- background-color: #f2dede;
21
- border-color: #ebccd1;
22
- color: #a94442;
23
- }
24
- .alert {
25
- border: 1px solid transparent;
26
- border-radius: 4px;
27
- margin-bottom: 20px;
28
- padding: 15px;
29
- }
30
- .alert-success {
31
- color: #3c763d;
32
- background-color: #dff0d8;
33
- border-color: #d6e9c6;
34
- }
35
- #form{
36
- width: 30%;
37
- float: right;
38
- padding: 20px;
39
- margin: 0;
40
- }
41
- </style>
42
- <?php
43
-
44
-
45
- Mage::app()->getCacheInstance()->flush();
46
-
47
- if(isset($_POST['sizecode'])){
48
- $sizeCode = $_POST['sizecode'];
49
- $genderCode = $_POST['gendercode'];
50
- $placeholder = $_POST['placeholder'];
51
- $shopid = $_POST['shopid'];
52
- $design = $_POST['design'];
53
- $add_to_cart = $_POST['add_to_cart'];
54
-
55
- Mage::getModel('core/config')->saveConfig('easysize_section/easysize_group/size_field', $sizeCode);
56
- Mage::getModel('core/config')->saveConfig('easysize_section/easysize_group/gender_field', $genderCode);
57
- Mage::getModel('core/config')->saveConfig('easysize_section/easysize_group/placeholder_field', $placeholder);
58
- Mage::getModel('core/config')->saveConfig('easysize_section/easysize_group/id_shop_field', $shopid);
59
- Mage::getModel('core/config')->saveConfig('easysize_section/easysize_group/style_field', $design);
60
- Mage::getModel('core/config')->saveConfig('easysize_section/easysize_group/add_to_cart_field', $add_to_cart);
61
- }else{
62
- $sizeCode = Mage::getStoreConfig('easysize_section/easysize_group/size_field',Mage::app()->getStore());
63
- $genderCode = Mage::getStoreConfig('easysize_section/easysize_group/gender_field',Mage::app()->getStore());
64
- $placeholder = Mage::getStoreConfig('easysize_section/easysize_group/placeholder_field',Mage::app()->getStore());
65
- $shopid = Mage::getStoreConfig('easysize_section/easysize_group/id_shop_field',Mage::app()->getStore());
66
- $design = Mage::getStoreConfig('easysize_section/easysize_group/style_field',Mage::app()->getStore());
67
- $add_to_cart = strlen(Mage::getStoreConfig('easysize_section/easysize_group/add_to_cart_field',Mage::app()->getStore())) > 2 ? Mage::getStoreConfig('easysize_section/easysize_group/add_to_cart_field',Mage::app()->getStore()) : ".add-to-cart-buttons";
68
- }
69
-
70
-
71
-
72
- ?>
73
- <div class="content">
74
-
75
- <div id="form">
76
- <h2>Configuration</h2>
77
- <form method="POST" action="" style="max-width: 500px;">
78
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
79
- <div class="alert alert-danger">
80
- <h4 class="title">Errors</h4>
81
- <?php
82
- $error = false;
83
- if (!$sizeCode) {
84
- $error = true;
85
- echo "<p>- A size code is needed</p></p>";
86
- } else if (!$this->attributeExistsInTheShop($sizeCode)) {
87
- echo "<p>- '".$sizeCode."'' is not a valid size code </p>";
88
- $error = true;
89
- }
90
-
91
- if (!$genderCode) {
92
- $error = true;
93
- echo "<p>- A gender code is needed";
94
- } else if (!$this->attributeExistsInTheShop($genderCode)){
95
- $error = true;
96
- echo "<p>- '".$genderCode."'' is not a valid gender code </p>";
97
- }
98
-
99
- if (!$placeholder) {
100
- $error = true;
101
- echo "<p>- A placeholder is needed</p>";
102
- }
103
-
104
- if (!$shopid) {
105
- $error = true;
106
- echo "<p>- Shop id is needed</p>";
107
- }
108
-
109
- if (!$error) {
110
- echo '<style>.alert-danger{display:none;}</style>';
111
- echo '<style>.alert-success{display:block;}</style>';
112
- } else {
113
- echo '<style>.alert-danger{display:block;}</style>';
114
- echo '<style>.alert-success{display:none;}</style>';
115
- }
116
-
117
- ?>
118
- </div>
119
-
120
- <div class="alert alert-success">
121
- <h4 class="title">All looks well configured</h4>
122
-
123
- </div>
124
-
125
-
126
- <p class="fd">
127
- <label class="label" for="sizecode"><b>Size Code: </b></label>
128
- <input style="float: right;" type="text" name="sizecode" id="sizecode" value="<?php echo $sizeCode;?>" /> <br/>
129
- <i>This code represents the product size in your shop.</i>
130
- </p>
131
-
132
- <p class="fd">
133
- <label class="label" for="gendercoder"><b>Gender Code: </b></label>
134
- <input style="float: right;" type="text" name="gendercode" id="gendercode" value="<?php echo $genderCode;?>" /><br/>
135
- <i>This code represents the product gender in your shop.</i>
136
- </p>
137
-
138
- <p class="fd">
139
- <label class="label" for="placeholder"><b>Placeholder: </b></label>
140
- <input style="float: right;" stype="text" name="placeholder" id="placeholder" value="<?php echo $placeholder;?>" /><br/>
141
- <i>This value controls the position of the EasySize button.</i>
142
- </p>
143
-
144
- <p class="fd">
145
- <label class="label" for="add_to_cart"><b>Add to cart button: </b></label>
146
- <input style="float: right;" stype="text" name="add_to_cart" id="add_to_cart" value="<?php echo $add_to_cart;?>" /><br/>
147
- <i>Your add to cart button selector</i>
148
- </p>
149
-
150
- <p class="fd">
151
- <label class="label" for="design"><b>Design Name: </b></label>
152
- <input style="float: right;" type="text" name="design" id="design" value="<?php echo $design;?>" /><br/>
153
- <i>Change the design of the popup (Ask EasySize team).</i>
154
- </p>
155
-
156
- <p class="fd">
157
- <label class="label" for="shopid"><b>Shop Id: </b></label>
158
- <input style="float: right;" type="text" name="shopid" id="shopid" value="<?php echo $shopid;?>" /><br/>
159
- <i>This value is your shop id provided by EasySize.</i>
160
- </p>
161
-
162
- <p>
163
- <button style="width: 100%;" type="submit">Save</button>
164
- </p>
165
- </form>
166
-
167
- <h2>Overview</h2>
168
- <p>Below you will find all configurable product and how they fulfill EasySize parameters</p>
169
- <i>Note: Each configurable product needs to have a category, a brand (manufacturer attribute), a gender and different(multiple) sizes available.</i>
170
-
171
- <hr/>
172
-
173
- <table class="table">
174
- <thead>
175
- <tr>
176
- <th>Name</th>
177
- <th>Category</th>
178
- <th>Gender</th>
179
- <th>Brand</th>
180
- <th>Different(multiple) Sizes?</th>
181
- </tr>
182
- </thead>
183
-
184
- <?php
185
- $all = $this->getAllProducts($sizeCode, $genderCode);
186
- for ($i=0; $i<sizeof($all); $i++) {
187
- if ($all[$i]->valid) {
188
- echo "<tr style='color: green'>";
189
- } else {
190
- echo "<tr style='color: red'>";
191
- }
192
-
193
- echo "<td>".$all[$i]->name."</td>";
194
- echo "<td>".$all[$i]->product_type."</td>";
195
- echo "<td>".$all[$i]->gender."</td>";
196
- echo "<td>".$all[$i]->product_brand."</td>";
197
- echo "<td>".$all[$i]->children."</td>";
198
- echo "</tr>";
199
- }
200
- ?>
201
- </table>
202
-
203
- </div>
204
-
205
- <iframe style="float: left; border:none; margin:0;" src="http://www.easysize.me/" height="800px" width="65%" >EasySize loading...</iframe>
206
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/layout/sizeguide.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <!-- frontName/controllername/actionmethod -->
4
+ <catalog_product_view>
5
+ <reference name="before_body_end">
6
+ <block
7
+ type="sizeguide/data"
8
+ name="sizeguide"
9
+ template="sizeguide/easysize.phtml" />
10
+ </reference>
11
+ </catalog_product_view>
12
+ </layout>
app/design/frontend/base/default/layout/webapp.xml DELETED
@@ -1,12 +0,0 @@
1
- <layout version="0.1.0">
2
- <default>
3
- <reference name="head">
4
- <action method="addJs">
5
- <script>EasySize/easysize.js</script>
6
- </action>
7
- </reference>
8
- <reference name="content">
9
- <block type="webapp/Attr" name="product.info.es" template="webapp/easysizeMod.phtml"></block>
10
- </reference>
11
- </default>
12
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/sizeguide/easysize.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <script type="text/javascript" src="https://webapp.easysize.me/web_app_v1.0/js/easysize.js"></script>
2
+ <script>
3
+ var EasySize = new EasySize(<?php echo $this->getRequiredAttributes(); ?>).start();
4
+ </script>
app/design/frontend/base/default/template/webapp/easysizeMod.phtml DELETED
@@ -1,14 +0,0 @@
1
- <script type="text/javascript" src="http://webapp.easysize.me/web_app_v1.0/js/easysize-2.0.0.js"></script>
2
-
3
- <?php if($this->getProductObject()){ ?>
4
- <script type="text/javascript">
5
- var easy_size;
6
- window.onload = function() {
7
- var data = <?php echo $this->getObj(); ?>;
8
- easy_size = new EasySize(data);
9
- easy_size.start();
10
- }
11
- </script>
12
- <?php } ?>
13
-
14
- <link href="http://webapp.easysize.me/web_app_v1.0/css/easysize_<?php echo Mage::getStoreConfig('easysize_section/easysize_group/style_field',Mage::app()->getStore());?>.css" rel="stylesheet" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/EasySize_SizeGuide.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <EasySize_SizeGuide>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </EasySize_SizeGuide>
8
+ </modules>
9
+ </config>
app/etc/modules/Easysize_all.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Easysize_Webapp>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Easysize_Webapp>
8
- </modules>
9
- </config>
 
 
 
 
 
 
 
 
 
js/EasySize/easysize.js DELETED
@@ -1,28 +0,0 @@
1
- (function(){
2
-
3
- var setItem = function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
4
- if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; }
5
- var sExpires = "";
6
- if (vEnd) {
7
- switch (vEnd.constructor) {
8
- case Number:
9
- sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd;
10
- break;
11
- case String:
12
- sExpires = "; expires=" + vEnd;
13
- break;
14
- case Date:
15
- sExpires = "; expires=" + vEnd.toUTCString();
16
- break;
17
- }
18
- }
19
- document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : "");
20
- return true;
21
- }
22
-
23
- jQuery(document).delegate(".button.btn-cart", 'mouseenter', function(){
24
- var skey = easy_size.skey();
25
- setItem('skey', skey);
26
- });
27
-
28
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,18 +1,23 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>easysize</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.easysize.me/terms-of-use/">EasySize</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>EasySize sizing solution</summary>
10
  <description>EasySize was founded in October 2014 by Gulnaz Khusainova and is currently based in Copenhagen, Denmark. EasySize&#x2019;s aim is to improve the online shopping experience for customers and empower retailers to grow their online businesses by using smart technology to accurately understand what a customer&#x2019;s ideal fit is. To date, EasySize has helped over 400,000 unique users find their ideal fit all over the world. Please visit easysize.me for more information.</description>
11
- <notes>It is stable and working</notes>
 
 
 
 
 
12
  <authors><author><name>EasySize IVS</name><user>EasySize</user><email>gk@easysize.me</email></author></authors>
13
- <date>2015-09-15</date>
14
- <time>08:26:17</time>
15
- <contents><target name="magecommunity"><dir name="Easysize"><dir name="Webapp"><dir name="Block"><file name="Attr.php" hash="0d5d8b24f3d4dd024fed68a788ef8eb5"/></dir><dir name="Helper"><file name="Data.php" hash="ad6aa6663faa95d5aebec81f1fa26751"/></dir><dir name="Model"><file name="Observer.php" hash="aee980532952e9316cfa1b31e824fe0c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="68676dd9984c41decac75931d8b7d2d5"/></dir><file name="IndexController.php" hash="4884e9612dfb2a1beb2780f34177ad2a"/></dir><dir name="etc"><file name="config.xml" hash="6b9724d23eacfaa938d448750b4ae6dd"/><file name="system.xml" hash="33b242bc6b481b97ab9bdf459f2a6d30"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="webapp_admin.xml" hash="dbc673aaba2b280288921438a3e5656a"/></dir><dir name="template"><dir name="webapp"><file name="afficher.phtml" hash="930b0b5e444ed5a30f7f11da92f04998"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="webapp"><file name="easysizeMod.phtml" hash="3e626688e69517363f2269a341d22061"/></dir></dir><dir name="layout"><file name="webapp.xml" hash="6e7db4d388b083b304d193df270b513d"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Easysize_all.xml" hash="e0b74bb3a63484144a37267238d52834"/></dir></target><target name="mage"><dir name="js"><dir name="EasySize"><file name="easysize.js" hash="68f6553e60490429e266b2aee0b4619d"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>easysize</name>
4
+ <version>1.1.10</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.easysize.me/terms-of-use/">EasySize</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>EasySize sizing solution</summary>
10
  <description>EasySize was founded in October 2014 by Gulnaz Khusainova and is currently based in Copenhagen, Denmark. EasySize&#x2019;s aim is to improve the online shopping experience for customers and empower retailers to grow their online businesses by using smart technology to accurately understand what a customer&#x2019;s ideal fit is. To date, EasySize has helped over 400,000 unique users find their ideal fit all over the world. Please visit easysize.me for more information.</description>
11
+ <notes>Multi shop configuration.&#xD;
12
+ EasySize settings moved to System-&gt;Configuration.&#xD;
13
+ Tracking on checkout page.&#xD;
14
+ EasySize block added to 'before_body_end'.&#xD;
15
+ One gender support.&#xD;
16
+ Brand selectable (not default manufacturer anymore).</notes>
17
  <authors><author><name>EasySize IVS</name><user>EasySize</user><email>gk@easysize.me</email></author></authors>
18
+ <date>2016-02-24</date>
19
+ <time>14:50:15</time>
20
+ <contents><target name="magecommunity"><dir name="EasySize"><dir name="SizeGuide"><dir name="Block"><file name="Data.php" hash="64242731fa0bee496f9b259eba41e7ae"/></dir><dir name="Helper"><file name="Data.php" hash="e1f1c548146a5eedc58222620232a758"/></dir><dir name="Model"><file name="Observer.php" hash="87c607e056e53cacd367c75f314e4921"/><file name="ShopAttributes.php" hash="cc02d02ce5ed899280cd72b049c066e1"/></dir><dir name="etc"><file name="config.xml" hash="b22b10df62ace9e7a9e873235e749565"/><file name="system.xml" hash="8cb01b6b5fc246f7a4a8170a5cf72cfa"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="sizeguide"><file name="easysize.phtml" hash="04a9b0118af89064f1ceb527289f1f6d"/></dir></dir><dir name="layout"><file name="sizeguide.xml" hash="719082d2622034408573c6650e98e644"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EasySize_SizeGuide.xml" hash="2397289fc71f8ddb23dec37aefdf4779"/></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>