Svitla_I_Bought_It - Version 0.3.0

Version Notes

Svitla_I_Bought_It 0.3.0v

Download this release

Release Info

Developer Svitla
Extension Svitla_I_Bought_It
Version 0.3.0
Comparing to
See all releases


Version 0.3.0

app/code/community/Svitla/Iboughtit/Block/Checkout.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Svitla_Iboughtit_Block_Checkout extends Mage_Core_Block_Template{
3
+
4
+
5
+
6
+ }
app/code/community/Svitla/Iboughtit/Block/Checkout/Success.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Svitla_Iboughtit_Block_Checkout_Success extends Svitla_Iboughtit_Block_Checkout{
3
+
4
+ private $order = false;
5
+
6
+ /**
7
+ * Constructor
8
+ */
9
+ public function __construct()
10
+ {
11
+ // Get last order id
12
+ $this->order = Mage::getModel('sales/order')->load(
13
+ Mage::getSingleton('checkout/session')->getLastOrderId()
14
+ );
15
+ }
16
+
17
+ /**
18
+ * @return bool
19
+ */
20
+ public function getStatus()
21
+ {
22
+ return $this->order->getId();
23
+ }
24
+
25
+ /**
26
+ * @return mixed
27
+ */
28
+ public function getTitle()
29
+ {
30
+ return Mage::getStoreConfig('svitla_iboughtit/success/title');
31
+ }
32
+
33
+ /**
34
+ * @return mixed
35
+ */
36
+ public function getMarketingText()
37
+ {
38
+ return Mage::getStoreConfig('svitla_iboughtit/success/marketing_message');
39
+ }
40
+
41
+ /**
42
+ * @return mixed
43
+ */
44
+ public function getCustomerEmail()
45
+ {
46
+ return $this->order->getCustomerEmail();
47
+ }
48
+
49
+ /**
50
+ * @return string
51
+ */
52
+ protected function getServerUrl()
53
+ {
54
+ return 'http://server.i-bought-it.com/?'.
55
+ http_build_query(
56
+ [
57
+ 'order_id'=>$this->order->getId(),
58
+ 'customer_email'=>$this->getCustomerEmail(),
59
+ 'btn_txt'=>Mage::getStoreConfig('svitla_iboughtit/success/button_text'),
60
+ 'ibirefererid'=>Mage::getModel('core/cookie')->get('ibirefererid')
61
+ ]
62
+ );
63
+ }
64
+
65
+ }
app/code/community/Svitla/Iboughtit/Block/Index.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Svitla_Iboughtit_Block_Index extends Mage_Core_Block_Template{
3
+
4
+
5
+
6
+
7
+
8
+ }
app/code/community/Svitla/Iboughtit/Block/Server.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ abstract class Svitla_Iboughtit_Block_Server extends Mage_Core_Block_Template{
3
+
4
+ /**
5
+ * SOAP Access
6
+ * @var array
7
+ */
8
+ private $soap = array(
9
+ 'login'=> '',
10
+ 'api_key' => ''
11
+ );
12
+
13
+ /**
14
+ * Constructor
15
+ */
16
+ public function __construct()
17
+ {
18
+ $this->setTemplate('svitla/iboughtit/json.phtml');
19
+ }
20
+
21
+ /**
22
+ * @param $login
23
+ */
24
+ public function setSoapLogin($login)
25
+ {
26
+ $this->soap['login'] = $login;
27
+ }
28
+
29
+ /**
30
+ * @param $key
31
+ */
32
+ public function setSoapApiKey($key)
33
+ {
34
+ $this->soap['api_key'] = $key;
35
+ }
36
+
37
+ /**
38
+ * @param $login
39
+ */
40
+ public function getSoapLogin()
41
+ {
42
+ return $this->soap['login'];
43
+ }
44
+
45
+ /**
46
+ * @param $key
47
+ */
48
+ public function getSoapApiKey()
49
+ {
50
+ return $this->soap['api_key'];
51
+ }
52
+
53
+ /**
54
+ * @return json|string
55
+ */
56
+ abstract public function getJson();
57
+
58
+ }
app/code/community/Svitla/Iboughtit/Block/Server/General/Connect.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Svitla_Iboughtit_Block_Server_General_Connect extends Svitla_Iboughtit_Block_Server{
3
+
4
+ /**
5
+ * @return json|string
6
+ */
7
+ public function getJson(){
8
+
9
+ // Get module version
10
+ $ModVersions = (array)Mage::getConfig()->getModuleConfig("Svitla_Iboughtit")->version;
11
+
12
+
13
+ // Get Magento version
14
+ $SystemVersion = Mage::getVersion();
15
+
16
+ return json_encode(array(
17
+ 'MyName' => 'Magento',
18
+ 'ShopName' => Mage::app()->getStore()->getName(),
19
+ 'SystemVersion' => $SystemVersion,
20
+ 'ModuleVersion' => $ModVersions['0'],
21
+ 'SoapLogin' => $this->getSoapLogin(),
22
+ 'SoapKey' => $this->getSoapApiKey()
23
+ ));
24
+ }
25
+
26
+ }
app/code/community/Svitla/Iboughtit/Block/Share.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Svitla_Iboughtit_Block_Share extends Mage_Core_Block_Template{
3
+
4
+ // Product names
5
+ private $productsNames = '';
6
+
7
+ // Product images
8
+ private $productImages = array();
9
+
10
+ /**
11
+ * Constructor
12
+ */
13
+ public function __construct()
14
+ {
15
+ $this->setTemplate('svitla/iboughtit/sharepage.phtml');
16
+ }
17
+
18
+ public function getProductImages()
19
+ {
20
+ return $this->productImages;
21
+ }
22
+
23
+ public function getProductsNames()
24
+ {
25
+ return $this->productsNames;
26
+ }
27
+
28
+ /**
29
+ * @param $order_id
30
+ */
31
+ public function setProducts($order_id)
32
+ {
33
+ if($order = Mage::getModel('sales/order')->load($order_id)){
34
+ $products = $order->getAllItems();
35
+ $shift = count($products) - 1;
36
+
37
+ for($i = 0; isset($products[$i]); $i++) {
38
+ if($i >= $shift){
39
+ $this->productsNames .= $products[$i]->getName().'!';
40
+ }else{
41
+ $this->productsNames .= $products[$i]->getName().', ';
42
+ }
43
+
44
+ // Load product data
45
+ $product = Mage::getModel('catalog/product')->load($products[$i]->getProductId());
46
+
47
+ // Set product images
48
+ $this->productImages[$i] = (string)Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(200);
49
+
50
+ }
51
+
52
+ }
53
+ }
54
+
55
+
56
+ }
app/code/community/Svitla/Iboughtit/Helper/Data.php ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Svitla_Iboughtit_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ private $soapPermissions = array(
5
+ '__root__',
6
+ 'catalog',
7
+ 'catalog/product',
8
+ 'catalog/product/downloadable_link',
9
+ 'catalog/product/downloadable_link/list'
10
+ );
11
+
12
+ public function getSoapCustomer($username)
13
+ {
14
+ return Mage::getModel('api/user')->loadByUsername($username);
15
+ }
16
+
17
+ /**
18
+ * Create SOAP customer
19
+ * @return array
20
+ */
21
+ public function addSoapCustomer($login, $pass, $data = array())
22
+ {
23
+ // Is customer?
24
+ if($this->getSoapCustomer($login)){
25
+ return false;
26
+ }
27
+
28
+ // Check $data
29
+ $data['email'] = isset($data['email']) ? $data['email'] : 'no-email@no.no';
30
+ $data['lastname'] = isset($data['lastname']) ? $data['lastname'] : 'No name';
31
+ $data['firstname'] = isset($data['firstname']) ? $data['firstname'] : 'No name';
32
+
33
+ try {
34
+
35
+ // Add SOAP role
36
+ $role = Mage::getModel('api/roles')
37
+ ->setName('iboughtit')
38
+ ->setPid(false)
39
+ ->setRoleType('G')
40
+ ->save();
41
+
42
+ // Set SOAP rules
43
+ Mage::getModel("api/rules")
44
+ ->setRoleId($role->getId())
45
+ ->setResources($this->soapPermissions)
46
+ ->saveRel();
47
+
48
+ // Add SOAP customer
49
+ $user = Mage::getModel('api/user');
50
+
51
+ $user->setData(array(
52
+ 'username' => $login,
53
+ 'lastname' => $data['lastname'],
54
+ 'firstname' => $data['firstname'],
55
+ 'email' => $data['email'],
56
+ 'api_key' => $pass,
57
+ 'api_key_confirmation' => $pass,
58
+ 'is_active' => 1,
59
+ 'user_roles' => '',
60
+ 'assigned_user_role' => '',
61
+ 'role_name' => '',
62
+ 'roles' => array($role->getId())
63
+ ));
64
+
65
+ $user->save()->load($user->getId());
66
+
67
+ $user->setRoleIds(array($role->getId()))
68
+ ->setRoleUserId($user->getUserId())
69
+ ->saveRelations();
70
+
71
+
72
+ // Return SOAP customer data
73
+ return $user;
74
+
75
+ } catch (Mage_Core_Exception $e) {
76
+ Mage::log($e->getMessage());
77
+ } catch (Exception $e) {
78
+ Mage::log(Mage::helper('iboughtit')->__('An error occurred while saving iboughtit role.'));
79
+ }
80
+
81
+ return false;
82
+ }
83
+
84
+ /**
85
+ * @param Mage_Catalog_Model_Product $product
86
+ * @param Mage_Catalog_Model_Category $category
87
+ * @param bool $mustBeIncludedInNavigation
88
+ * @return string
89
+ */
90
+ public function getProductFullUrl (Mage_Catalog_Model_Product $product ,
91
+ Mage_Catalog_Model_Category $category = null ,
92
+ $mustBeIncludedInNavigation = true ){
93
+
94
+ // Try to find url matching provided category
95
+ if( $category != null){
96
+ // Category is no match then we'll try to find some other category later
97
+ if( !in_array($product->getId() , $category->getProductCollection()->getAllIds() )
98
+ || !self::isCategoryAcceptable($category , $mustBeIncludedInNavigation )){
99
+ $category = null;
100
+ }
101
+ }
102
+ if ($category == null) {
103
+ if( is_null($product->getCategoryIds() )){
104
+ return $product->getProductUrl();
105
+ }
106
+ $catCount = 0;
107
+ $productCategories = $product->getCategoryIds();
108
+ // Go through all product's categories
109
+ while( $catCount < count($productCategories) && $category == null ) {
110
+ $tmpCategory = Mage::getModel('catalog/category')->load($productCategories[$catCount]);
111
+ // See if category fits (active, url key, included in menu)
112
+ if ( !self::isCategoryAcceptable($tmpCategory , $mustBeIncludedInNavigation ) ) {
113
+ $catCount++;
114
+ }else{
115
+ $category = Mage::getModel('catalog/category')->load($productCategories[$catCount]);
116
+ }
117
+ }
118
+ }
119
+ $url = (!is_null( $product->getUrlPath($category))) ? Mage::getBaseUrl() . $product->getUrlPath($category) : $product->getProductUrl();
120
+ return $url;
121
+ }
122
+
123
+ /**
124
+ * Checks if a category matches criteria: active && url_key not null && included in menu if it has to
125
+ */
126
+ protected static function isCategoryAcceptable(Mage_Catalog_Model_Category $category = null, $mustBeIncludedInNavigation = true){
127
+ if( !$category->getIsActive() || is_null( $category->getUrlKey() )
128
+ || ( $mustBeIncludedInNavigation && !$category->getIncludeInMenu()) ){
129
+ return false;
130
+ }
131
+ return true;
132
+ }
133
+
134
+ public function createCoupon($customer_id, $discount, $skus = false, $condition = '==')
135
+ {
136
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
137
+
138
+ $customerGroupIds = Mage::getModel('customer/group')->getCollection()->getAllIds();
139
+ $websitesId = Mage::getModel('core/website')->getCollection()->getAllIds();
140
+
141
+ $customer_name = $customer->getName();
142
+ $couponCode = Mage::helper('core')->getRandomString(9);
143
+
144
+ $model = Mage::getModel('salesrule/rule');
145
+ $model->setName('Discount for ' . $customer_name);
146
+ $model->setDescription('Discount for ' . $customer_name);
147
+ $model->setFromDate(date('Y-m-d'));
148
+ $model->setToDate(date('Y-m-d', strtotime('+2 days')));
149
+ $model->setCouponType(2);
150
+ $model->setCouponCode($couponCode);
151
+ $model->setUsesPerCoupon(1);
152
+ $model->setUsesPerCustomer(1);
153
+ $model->setCustomerGroupIds($customerGroupIds);
154
+ $model->setIsActive(1);
155
+
156
+ // Products list
157
+ if($skus){
158
+ $model->setConditionsSerialized($this->makeConditions($skus, $condition));
159
+ }else{
160
+ $model->setConditionsSerialized('a:6:{s:4:\"type\";s:32:\"salesrule/rule_condition_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";s:1:\"1\";s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";}');
161
+ }
162
+
163
+ $model->setActionsSerialized('a:6:{s:4:\"type\";s:40:\"salesrule/rule_condition_product_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";s:1:\"1\";s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";}');
164
+ $model->setStopRulesProcessing(0);
165
+ $model->setIsAdvanced(1);
166
+ $model->setProductIds('');
167
+ $model->setSortOrder(1);
168
+ $model->setSimpleAction('by_fixed');
169
+ $model->setDiscountAmount($discount);
170
+ $model->setDiscountStep(0);
171
+ $model->setSimpleFreeShipping(0);
172
+ $model->setTimesUsed(0);
173
+ $model->setIsRss(0);
174
+ $model->setWebsiteIds($websitesId);
175
+
176
+ try {
177
+ $model->save();
178
+ } catch (Exception $e) {
179
+ Mage::log($e->getMessage());
180
+ }
181
+
182
+ // Send coupon code to customer email
183
+ try {
184
+ // Get store data
185
+ $store = Mage::app()->getStore();
186
+
187
+ //load the custom template to the email
188
+ $emailTemplate = Mage::getModel('core/email_template')
189
+ ->loadDefault('coupon_new');
190
+
191
+ // it depends on the template variables
192
+ $emailTemplateVariables = array();
193
+ $emailTemplateVariables['email_message'] = Mage::getStoreConfig('svitla_iboughtit/email/email_message');
194
+ $emailTemplateVariables['customer_name'] = $customer_name;
195
+ $emailTemplateVariables['coupon_code'] = $couponCode;
196
+
197
+
198
+ $emailTemplate->setSenderName($store->getName());
199
+ $emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_sales/email'));
200
+ $emailTemplate->setType('html');
201
+ $emailTemplate->setTemplateSubject($this->__('Your discount coupon'));
202
+ $emailTemplate->send($customer->getEmail(), $customer->getFirstname() . $customer->getLastname(), $emailTemplateVariables);
203
+ } catch (Exception $e) {
204
+ Mage::log($e->getMessage());
205
+ }
206
+ }
207
+
208
+ function makeConditions($skus, $condition = '=='){
209
+ return serialize(
210
+ [
211
+ "type"=> "salesrule/rule_condition_combine",
212
+ "attribute"=> NULL,
213
+ "operator"=> NULL,
214
+ "value"=> "1",
215
+ "is_value_processed"=> NULL,
216
+ "aggregator"=> "all",
217
+ ["conditions"]=> [
218
+ '0' => [
219
+ "type"=> "salesrule/rule_condition_product_found",
220
+ "attribute"=> NULL,
221
+ "operator"=> NULL,
222
+ "value"=> "1",
223
+ "is_value_processed"=> NULL,
224
+ "aggregator"=> "all",
225
+ ["conditions"]=> [
226
+ '0'=> [
227
+ "type"=> "salesrule/rule_condition_product",
228
+ "attribute"=> "sku",
229
+ "operator"=> $condition,
230
+ "value"=> $skus,
231
+ "is_value_processed"=> false
232
+ ]
233
+ ]
234
+ ]
235
+ ]
236
+ ]
237
+ );
238
+ }
239
+
240
+ function randomPassword() {
241
+ $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
242
+ for ($i = 0; $i < 8; $i++) {
243
+ $n = rand(0, count($alphabet)-1);
244
+ $pass[$i] = $alphabet[$n];
245
+ }
246
+ return $pass;
247
+ }
248
+ }
249
+
app/code/community/Svitla/Iboughtit/Model/Observer.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Svitla_Iboughtit_Model_Observer
4
+ {
5
+
6
+ public function productDeleteBefore(Varien_Event_Observer $observer)
7
+ {
8
+ //Mage::dispatchEvent('admin_session_user_login_success', array('user'=>$user));
9
+ //$user = $observer->getEvent()->getUser();
10
+ //$user->doSomething();
11
+ }
12
+
13
+ public function orderSuccess()
14
+ {
15
+
16
+ }
17
+
18
+ }
app/code/community/Svitla/Iboughtit/controllers/IndexController.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Svitla_Iboughtit_IndexController extends Mage_Core_Controller_Front_Action
4
+ {
5
+
6
+ /**
7
+ * About IBoughtIt
8
+ */
9
+ public function IndexAction()
10
+ {
11
+ // Rendering page
12
+ $this->loadLayout();
13
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Titlename"));
14
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
15
+ $breadcrumbs->addCrumb("home", array(
16
+ "label" => $this->__("Home Page"),
17
+ "title" => $this->__("Home Page"),
18
+ "link" => Mage::getBaseUrl()
19
+ ));
20
+
21
+ $breadcrumbs->addCrumb("titlename", array(
22
+ "label" => $this->__("Titlename"),
23
+ "title" => $this->__("Titlename")
24
+ ));
25
+
26
+ $this->renderLayout();
27
+ }
28
+
29
+ public function testAction()
30
+ {
31
+
32
+
33
+ exit('Success!');
34
+ }
35
+
36
+ }
app/code/community/Svitla/Iboughtit/controllers/ServerController.php ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Svitla_Iboughtit_ServerController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ /**
6
+ * Default info, Hello!
7
+ */
8
+ public function IndexAction()
9
+ {
10
+ if ($this->checkApiKey()) {
11
+ // Get module API
12
+ $helper = Mage::helper('iboughtit');
13
+
14
+ // Render answer
15
+ $answer = $this->getLayout()->createBlock('iboughtit/server_general_connect');
16
+
17
+ // Add Soap customer or load if is
18
+ if (!$SOAP_Customer = $helper->getSoapCustomer('iboughtit')) {
19
+ /*
20
+ $SOAP_Customer = $helper->addSoapCustomer(
21
+ 'iboughtit',
22
+ $helper->randomPassword()
23
+ );
24
+ */
25
+ }
26
+
27
+ // Set answer data
28
+ $answer->setSoapLogin($SOAP_Customer->getUsername());
29
+ $answer->setSoapApiKey($SOAP_Customer->getApiKey());
30
+
31
+ // Send answer
32
+ echo $answer->toHtml();
33
+
34
+ } else {
35
+ // Return 404
36
+ $this->getResponse()->setHeader('HTTP/1.1', '404 Not Found');
37
+ $this->getResponse()->setHeader('Status', '404 File not found');
38
+ $pageId = Mage::getStoreConfig('web/default/cms_no_route');
39
+ if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
40
+ $this->_forward('defaultNoRoute');
41
+ }
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Return product list
47
+ */
48
+ public function LoadProductAction()
49
+ {
50
+ if ($this->checkApiKey()) {
51
+ // Set answer
52
+ $answer = array(
53
+ 'data' => array(),
54
+ 'page' => Mage::app()->getRequest()->getParam('p', 1),
55
+ 'page-size' => Mage::app()->getRequest()->getParam('size', 1)
56
+
57
+ );
58
+
59
+ //fetch all visible products
60
+ $product_collection = Mage::getModel('catalog/product')->getCollection();
61
+
62
+
63
+ $product_collection->addAttributeToSelect('*');
64
+
65
+ //filter by name or description
66
+ if ($sTerm = Mage::app()->getRequest()->getParam('f_name')) {
67
+ $product_collection->addFieldToFilter(array(
68
+ array('attribute' => 'name', 'like' => $sTerm)
69
+ ));
70
+ }
71
+
72
+
73
+ //pagination (THIS DOESNT WORK!)
74
+ $product_collection->setPageSize($answer['page-size'])->setCurPage($answer['page']);
75
+
76
+ //TEST OUTPUT
77
+ foreach ($product_collection as $product) {
78
+ $answer['data'][] = $product->getData();
79
+ }
80
+
81
+ $answer['count-products'] = $product_collection->getSize();
82
+
83
+ echo json_encode($answer);
84
+
85
+ } else {
86
+ // Return 404
87
+ $this->getResponse()->setHeader('HTTP/1.1', '404 Not Found');
88
+ $this->getResponse()->setHeader('Status', '404 File not found');
89
+ $pageId = Mage::getStoreConfig('web/default/cms_no_route');
90
+ if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
91
+ $this->_forward('defaultNoRoute');
92
+ }
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Redirect to product page by url
98
+ */
99
+ public function sharePageAction()
100
+ {
101
+ // Cookie API
102
+ $cookie = Mage::getSingleton('core/cookie');
103
+
104
+ // If referer is facebook
105
+ if ($referer = $this->getRequest()->getServer('HTTP_REFERER')) {
106
+
107
+ $referer = parse_url($referer);
108
+ $referer = explode('.', $referer['host']);
109
+
110
+ if (isset($referer['1']) && isset($referer['2'])) {
111
+ $referer = $referer['1'] . '.' . $referer['2'];
112
+ } else {
113
+ $referer = 'undefined';
114
+ }
115
+
116
+ $product_id = false;
117
+
118
+ // Check count products
119
+ if ($order_id = Mage::app()->getRequest()->getParam('order_id')) {
120
+ // If order is load
121
+ if ($order = Mage::getModel('sales/order')->load($order_id)) {
122
+ // Get order items
123
+ $products = $order->getAllItems();
124
+ // Set product id if count == one
125
+ if (count($products) == 1) {
126
+ $product_id = $products['0']->getProductId();
127
+ }
128
+ }
129
+ }
130
+
131
+ switch ($referer) {
132
+ case('facebook.com'):
133
+ // It is new referrer?
134
+ if(!$cookie->get('ibirefererid')){
135
+ // Set custom visitors data
136
+ $order_id = Mage::app()->getRequest()->getParam('order_id');
137
+ $buyer_id = Mage::app()->getRequest()->getParam('buyer');
138
+ $home_url = Mage::helper('core/url')->getHomeUrl();
139
+ $api_key = base64_encode(Mage::getStoreConfig('svitla_iboughtit/general/apikey'));
140
+ $customerIP = Mage::helper('core/http')->getRemoteAddr(true);
141
+
142
+ // Set visitors data
143
+ $refererId = $this->milliseconds(true) . mt_rand(1, 1000);
144
+ $cookie->set('ibirefererid', $refererId, time() + 2592000, '/');
145
+
146
+
147
+
148
+ // Request to ibi server
149
+ $context = stream_context_create(array('http' =>
150
+ array(
151
+ 'method' => 'POST',
152
+ 'header' => 'Content-type: application/x-www-form-urlencoded',
153
+ 'content' => http_build_query(
154
+ array(
155
+ 'order_id' => $order_id,
156
+ 'buyer_id' => $buyer_id,
157
+ 'home_url' => $home_url,
158
+ 'api_key' => $api_key,
159
+ 'session_id' => $refererId,
160
+ 'ip' => $customerIP
161
+ )
162
+ )
163
+ )
164
+ ));
165
+
166
+ $query = 'http://server.i-bought-it.com/success/addreferrals';
167
+
168
+
169
+ // Get store product pack
170
+ if (!$response = @file_get_contents($query, false, $context)) {
171
+ exit('Fatal error: problem with response from ibi.');
172
+ }
173
+ }
174
+
175
+ // Redirect to product page!
176
+ $this->redirectToProduct($product_id);
177
+
178
+ // Close case www.facebook.com
179
+ break;
180
+ default: {
181
+ $this->redirectToProduct();
182
+ }
183
+ }
184
+
185
+ }
186
+
187
+ // If order
188
+ if ($order_id = Mage::app()->getRequest()->getParam('order_id')) {
189
+
190
+ // Render answer
191
+ $block = $this->getLayout()->createBlock('iboughtit/share');
192
+
193
+ // Set products from order
194
+ $block->setProducts($order_id);
195
+
196
+ exit($block->toHtml());
197
+
198
+ }
199
+
200
+
201
+ // If product
202
+
203
+ // Return 404
204
+ $this->getResponse()->setHeader('HTTP/1.1', '404 Not Found');
205
+ $this->getResponse()->setHeader('Status', '404 File not found');
206
+ $pageId = Mage::getStoreConfig('web/default/cms_no_route');
207
+ if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
208
+ $this->_forward('defaultNoRoute');
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Make coupon Action
214
+ */
215
+ public function makeCouponAction()
216
+ {
217
+ if($this->checkApiKey()){
218
+ $order_id = Mage::app()->getRequest()->getParam('order_id');
219
+ $campaign = Mage::app()->getRequest()->getParam('campaign_data');
220
+ // Get order data
221
+ $order = Mage::getModel('sales/order')->load($order_id);
222
+
223
+ if($order_id && $campaign && $order){
224
+ // Get API
225
+ $helper = Mage::helper('iboughtit');
226
+
227
+
228
+
229
+ // Import json
230
+ $campaign = json_decode($campaign); // var_dump($campaign); exit();
231
+
232
+ // Check status onetime discount
233
+ if($campaign->discount_onetime_status){
234
+
235
+ // Get discount product
236
+ $products = unserialize($campaign->discount_onetime_products);
237
+
238
+
239
+ $productsCollection = Mage::getModel('catalog/product')
240
+ ->getCollection()
241
+ ->addAttributeToFilter('entity_id', array('in' => $products));
242
+
243
+ $skus = '';
244
+
245
+ $count = $productsCollection->count();
246
+ $i = 1;
247
+ foreach($productsCollection as $product) {
248
+ $skus .= $product->getSku().($i < $count ? ',' : '');
249
+ $i++;
250
+ }
251
+
252
+
253
+ // Make coupon
254
+ $helper->createCoupon($order->getCustomerId(), '10', $skus);
255
+ //var_dump($products);
256
+ //echo('Set discount_onetime');
257
+
258
+
259
+ }
260
+
261
+ echo 'true';
262
+
263
+ }
264
+
265
+ }else{
266
+ // Return 404
267
+ $this->getResponse()->setHeader('HTTP/1.1', '404 Not Found');
268
+ $this->getResponse()->setHeader('Status', '404 File not found');
269
+ $pageId = Mage::getStoreConfig('web/default/cms_no_route');
270
+ if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
271
+ $this->_forward('defaultNoRoute');
272
+ }
273
+ }
274
+ }
275
+
276
+ /**
277
+ * Check API Key
278
+ * @return bool
279
+ */
280
+ private function checkApiKey()
281
+ {
282
+ if (base64_decode(Mage::app()->getRequest()->getParam('apikey')) == Mage::getStoreConfig('svitla_iboughtit/general/apikey')) {
283
+ return true;
284
+ } else {
285
+ return false;
286
+ }
287
+ }
288
+
289
+ /**
290
+ * @param bool $product_id
291
+ */
292
+ private function redirectToProduct($product_id = false)
293
+ {
294
+ if ($product_id) {
295
+ // Get product url
296
+ if ($product = Mage::getModel('catalog/product')->load($product_id)) {
297
+ // Redirect to product page
298
+ header("Location: " . $product->getProductUrl($product));
299
+ } else {
300
+ $this->redirectToProduct();
301
+ }
302
+ } else {
303
+ header("Location: " . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
304
+ }
305
+ }
306
+
307
+ /**
308
+ * @return mixed
309
+ */
310
+ private function milliseconds()
311
+ {
312
+ $mt = explode(' ', microtime());
313
+ return $mt[1] * 1000 + round($mt[0] * 1000);
314
+ }
315
+
316
+
317
+ }
app/code/community/Svitla/Iboughtit/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
+ <svitla_iboughtit translate="title" module="iboughtit">
12
+ <title>IBoughtIt Section</title>
13
+ <sort_order>0</sort_order>
14
+ </svitla_iboughtit>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/Svitla/Iboughtit/etc/config.xml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Svitla_Iboughtit>
5
+ <version>0.3.0</version>
6
+ </Svitla_Iboughtit>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <iboughtit>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Svitla_Iboughtit</module>
14
+ <frontName>iboughtit</frontName>
15
+ </args>
16
+ </iboughtit>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <iboughtit>
21
+ <file>svitla/iboughtit.xml</file>
22
+ </iboughtit>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <iboughtit>
29
+ <class>Svitla_Iboughtit_Helper</class>
30
+ </iboughtit>
31
+ </helpers>
32
+ <blocks>
33
+ <iboughtit>
34
+ <class>Svitla_Iboughtit_Block</class>
35
+ </iboughtit>
36
+ </blocks>
37
+ <models>
38
+ <iboughtit>
39
+ <class>Svitla_Iboughtit_Model</class>
40
+ <resourceModel>iboughtit_mysql4</resourceModel>
41
+ </iboughtit>
42
+ </models>
43
+ <events>
44
+ <catalog_product_delete_before> <!-- identifier of the event we want to catch -->
45
+ <observers>
46
+ <catalog_product_delete_before_handler> <!-- identifier of the event handler -->
47
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
48
+ <class>iboughtit/observer</class> <!-- observers class alias -->
49
+ <method>productDeleteBefore</method> <!-- observer's method to be called -->
50
+ <args></args> <!-- additional arguments passed to observer -->
51
+ </catalog_product_delete_before_handler>
52
+ </observers>
53
+ </catalog_product_delete_before>
54
+ <checkout_onepage_controller_success_action>
55
+ <observers>
56
+ <iboughtit_order_success>
57
+ <class>iboughtit/observer</class>
58
+ <method>orderSuccess</method>
59
+ </iboughtit_order_success>
60
+ </observers>
61
+ </checkout_onepage_controller_success_action>
62
+
63
+ </events>
64
+ <template>
65
+ <email>
66
+ <coupon_new module="modulename">
67
+ <label>any desired name</label>
68
+ <file>sales/coupon_new.html</file> // this specifies the path where the custom template is located
69
+ <type>html</type>
70
+ </coupon_new>
71
+ </email>
72
+ </template>
73
+ </global>
74
+ </config>
app/code/community/Svitla/Iboughtit/etc/system.xml ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <svitla_systems translate="label" module="iboughtit">
5
+ <label>Svitla Systems</label>
6
+ <sort_order>0</sort_order>
7
+ </svitla_systems>
8
+ </tabs>
9
+ <sections>
10
+ <svitla_iboughtit translate="label" module="iboughtit">
11
+ <label>IBoughtIt</label>
12
+ <tab>svitla_systems</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>0</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
+ <general translate="label">
20
+ <label>General</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
+ <status translate="label">
28
+ <label>Status</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
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
+ <comment>Status</comment>
36
+ </status>
37
+ <apikey translate="label">
38
+ <label>Api key</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>2</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <comment>Api key</comment>
45
+ </apikey>
46
+ </fields>
47
+ </general>
48
+ <success translate="label">
49
+ <label>Success page settings</label>
50
+ <frontend_type>text</frontend_type>
51
+ <sort_order>1</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <fields>
56
+ <button_text translate="label">
57
+ <label>Button text</label>
58
+ <frontend_type>text</frontend_type>
59
+ <sort_order>1</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ <comment>Button text fot "I Bought It" button</comment>
64
+ </button_text>
65
+ <title translate="label">
66
+ <label>Titlet</label>
67
+ <frontend_type>text</frontend_type>
68
+ <sort_order>2</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ <comment>Title</comment>
73
+ </title>
74
+ <marketing_message translate="label">
75
+ <label>Marketing message</label>
76
+ <frontend_type>textarea</frontend_type>
77
+ <sort_order>3</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ <comment>Marketing message for success page</comment>
82
+ </marketing_message>
83
+ </fields>
84
+ </success>
85
+ <email translate="label">
86
+ <label>Email settings</label>
87
+ <frontend_type>text</frontend_type>
88
+ <sort_order>2</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ <fields>
93
+ <email_message translate="label">
94
+ <label>Email message</label>
95
+ <frontend_type>textarea</frontend_type>
96
+ <sort_order>2</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ <comment>Email message value.</comment>
101
+ </email_message>
102
+ </fields>
103
+ </email>
104
+ </groups>
105
+ </svitla_iboughtit>
106
+ </sections>
107
+ </config>
app/design/frontend/base/default/layout/svitla/iboughtit.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.3.0">
3
+ <!-- I bought info! -->
4
+ <iboughtit_index_index>
5
+ <reference name="root">
6
+ <action method="setTemplate">
7
+ <template>page/1column.phtml</template>
8
+ </action>
9
+ </reference>
10
+ <reference name="content">
11
+ <block type="iboughtit/checkout_success" name="iboughtit_checkout_success" template="svitla/iboughtit/success.phtml"/>
12
+ <!--<block type="iboughtit/index" name="iboughtit_index" template="svitla/iboughtit/index.phtml"/>-->
13
+ </reference>
14
+ </iboughtit_index_index>
15
+ <!-- Success page -->
16
+ <checkout_onepage_success>
17
+ <reference name="head">
18
+ <action method="addItem"><type>js_css</type><name>css/iboughtit.css</name><params/></action>
19
+ </reference>
20
+ <reference name="content">
21
+ <block type="iboughtit/checkout_success" name="iboughtit_checkout_success" template="svitla/iboughtit/success.phtml"/>
22
+ </reference>
23
+ </checkout_onepage_success>
24
+ </layout>
25
+
app/design/frontend/base/default/template/svitla/iboughtit/index.phtml ADDED
@@ -0,0 +1 @@
 
1
+ I bought info!
app/design/frontend/base/default/template/svitla/iboughtit/json.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <?php echo $this->getJson() ?>
app/design/frontend/base/default/template/svitla/iboughtit/sharepage.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
3
+ <head lang="en">
4
+ <meta charset="UTF-8">
5
+ <!-- for Facebook -->
6
+ <meta property="og:title" content="<?php echo $this->__('I bought it!'); ?>" />
7
+ <meta property="og:type" content="article" />
8
+ <?php foreach($this->getProductImages() as $image): ?>
9
+ <meta property="og:image" content="<?php echo $image; ?>" />
10
+ <?php endforeach; ?>
11
+ <!-- <meta property="og:url" content="http://avtoklav.net/avtoklav-net.html" />-->
12
+ <meta property="og:description" content="<?php echo $this->__('I bought'); ?> <?php echo $this->getProductsNames(); ?>" />
13
+
14
+ <meta name="description" content="<?php echo $this->__('I bought'); ?> <?php echo $this->getProductsNames(); ?>" />
15
+ <title><?php echo $this->__('I bought'); ?> <?php echo $this->getProductsNames(); ?></title>
16
+ </head>
17
+ <body>
18
+ <h1><?php echo $this->__('I bought'); ?> <?php echo $this->getProductsNames(); ?></h1>
19
+ </body>
20
+ </html>
app/design/frontend/base/default/template/svitla/iboughtit/success.phtml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getStatus()): ?>
2
+ <style type="text/css">
3
+ img.iboughtit-image {
4
+ width: 90%;
5
+ float: right;
6
+ }
7
+ </style>
8
+ <div class="account-login clearer">
9
+ <div class="registered-users grid12-6">
10
+ <div class="page-title">
11
+ <h1><?php echo $this->getTitle(); ?></h1>
12
+ </div>
13
+ <div class="content">
14
+ <?php echo $this->getMarketingText(); ?>
15
+ <br />
16
+ <br />
17
+ <hr />
18
+ <br />
19
+ <iframe style="border: none; width: 100%; height: 35px" src="<?php echo $this->getServerUrl() ?>"></iframe>
20
+ </div>
21
+ </div>
22
+ <div class="new-users grid12-6">
23
+ <div class="content">
24
+ <img class="iboughtit-image" src="<?php echo $this->getSkinUrl('images/iboughtit/shopping.jpg'); ?>"/>
25
+ </div>
26
+ </div>
27
+
28
+ </div>
29
+ <?php endif; ?>
app/etc/modules/Svitla_Iboughtit.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Svitla_Iboughtit>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.3.0</version>
8
+ </Svitla_Iboughtit>
9
+ </modules>
10
+ </config>
app/locale/en_US/template/email/sales/coupon_new.html ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: New Order # {{var order.increment_id}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$order.getCustomerName()":"Customer Name",
7
+ "var store.getFrontendName()":"Store Name",
8
+ "store url=\"customer/account/\"":"Customer Account Url",
9
+ "var order.increment_id":"Order Id",
10
+ "var order.getCreatedAtFormated('long')":"Order Created At (datetime)",
11
+ "var order.getBillingAddress().format('html')":"Billing Address",
12
+ "var payment_html":"Payment Details",
13
+ "var order.getShippingAddress().format('html')":"Shipping Address",
14
+ "var order.getShippingDescription()":"Shipping Description",
15
+ "layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid",
16
+ "var order.getEmailCustomerNote()":"Email Order Note"}
17
+ @-->
18
+ <!--@styles
19
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
20
+ @-->
21
+
22
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
23
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
24
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
25
+ <tr>
26
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
27
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
28
+ <tr>
29
+ <td valign="top">
30
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{var customer_name}}</h1>
31
+ <p style="font-size:12px; line-height:16px; margin:0;">
32
+ {{var email_message}}
33
+ </p>
34
+ <p style="font-size:12px; line-height:16px; margin:0;">Your coupon code: <strong>{{var coupon_code}}</strong>.</p>
35
+ </tr>
36
+ </table>
37
+ </td>
38
+ </tr>
39
+ </table>
40
+ </div>
41
+ </body>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Svitla_I_Bought_It</name>
4
+ <version>0.3.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Svitla_I_Bought_It 0.3.0v</summary>
10
+ <description>&#x201C;I Bought It&#x201D; is service which allows attracting buyers and collecting information about buyers and referrals of the online store.</description>
11
+ <notes>Svitla_I_Bought_It 0.3.0v</notes>
12
+ <authors><author><name>Svitla</name><user>Andriy</user><email>info@svitla.com</email></author></authors>
13
+ <date>2014-12-04</date>
14
+ <time>08:24:17</time>
15
+ <contents><target name="magecommunity"><dir name="Svitla"><dir name="Iboughtit"><dir name="Block"><dir name="Checkout"><file name="Success.php" hash="444c9591497f41a5802562d01f40e3e0"/></dir><file name="Checkout.php" hash="c6889bad6afc29ade0474e8523a41e1d"/><file name="Index.php" hash="7e036a313979765aa73726ad9c422ffb"/><dir name="Server"><dir name="General"><file name="Connect.php" hash="2f73f49a3dd6a371405d9adfc2aa4584"/></dir></dir><file name="Server.php" hash="9c4e7043d559062f67bc0d5a4d04287b"/><file name="Share.php" hash="178af198c8c995f115ae37d46217b582"/></dir><dir name="Helper"><file name="Data.php" hash="680a9a30b2c22b890828e87d4ff5a194"/></dir><dir name="Model"><file name="Observer.php" hash="9fad0a27446d6f4e6894a1314d9b2cba"/></dir><dir name="controllers"><file name="IndexController.php" hash="f1bad6336cc1788e7a981eedac7e152a"/><file name="ServerController.php" hash="f6dd9632103b197ac2db00ed68517c5b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="97bdeec3aa0ebf94004bfa4e8417f616"/><file name="config.xml" hash="91499a4e78c0a79344bd042a25e91baa"/><file name="system.xml" hash="58bc25246e950092b1ac26cb5225b76b"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="svitla"><file name="iboughtit.xml" hash="c21ad299c7542119a8beb2663b10f8c8"/></dir></dir><dir name="template"><dir name="svitla"><dir name="iboughtit"><file name="index.phtml" hash="324d23a15e9c417528314b3d16079f0c"/><file name="json.phtml" hash="368b989552c9318fae7e127e085fbae4"/><file name="sharepage.phtml" hash="529b5006d657e99237bd5f6420a6c1af"/><file name="success.phtml" hash="6b70c4945c68746e10c43a87171bac9a"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Svitla_Iboughtit.xml" hash="5d0b4454e61b56b4c1bbe423b7816ffb"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="sales"><file name="coupon_new.html" hash="1c3352335b2a8adb18dc6e8055998589"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="iboughtit.css" hash="e2b676f507a0343119f518d8e71290fe"/></dir><dir name="images"><dir name="iboughtit"><file name="shopping.jpg" hash="8c912426a0876f61c777125428860469"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/css/iboughtit.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ img.iboughtit-image{
2
+ width: 80%;
3
+ }
skin/frontend/base/default/images/iboughtit/shopping.jpg ADDED
Binary file