Bubbleyes_BubblitPlugin - Version 2.0.0

Version Notes

Support for multiple stores integration.

Download this release

Release Info

Developer Terje Lindstad
Extension Bubbleyes_BubblitPlugin
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.3.0 to 2.0.0

app/code/community/Bubbleyes/BubblitPlugin/Block/Button.php CHANGED
@@ -12,17 +12,18 @@ class Bubbleyes_BubblitPlugin_Block_Button
12
  public function getProductScript()
13
  {
14
  try{
15
- if($this->_helper->isBubblEnabledInDetails())
16
- {
17
- $productSKU = $this -> getProduct() -> sku;
18
-
 
19
  $productData = array(
20
- 'SKU' => $productSKU
21
  );
22
 
23
  $settings = NULL;
24
 
25
- $tmp = $this->_helper->CallAPIWithResponse('getProductScript', array('Product' => $productData, 'Settings' => $settings));
26
  return $tmp["Script"];
27
  }
28
  }
12
  public function getProductScript()
13
  {
14
  try{
15
+ $product = $this -> getProduct();
16
+ $storeId = $product -> getStoreId();
17
+
18
+ if($this->_helper->isBubblEnabledInDetails($storeId))
19
+ {
20
  $productData = array(
21
+ 'SKU' => $product -> sku
22
  );
23
 
24
  $settings = NULL;
25
 
26
+ $tmp = $this->_helper->CallAPIWithResponse('getProductScript', array('Product' => $productData, 'Settings' => $settings), $storeId);
27
  return $tmp["Script"];
28
  }
29
  }
app/code/community/Bubbleyes/BubblitPlugin/Helper/Data.php CHANGED
@@ -2,7 +2,7 @@
2
  class Bubbleyes_BubblitPlugin_Helper_Data extends Mage_Core_Helper_Abstract
3
  {
4
  static $APIAddress = "http://api.bubbleyes.com/client/";
5
- static $Version = 'magento 1.3.0';
6
  static $ProductsPortionSize = 25;
7
 
8
  public static function getProductPortionSize() {
@@ -25,7 +25,7 @@
25
  return Mage::getStoreConfig('BubbleyesBubblitPluginOptions/bubbl_layout/bubbllayout', $storeId);
26
  }
27
 
28
- public static function CallAPI($method, $params) {
29
  $data = json_encode($params);
30
 
31
  $response = null;
@@ -33,14 +33,14 @@
33
  if ($curl = curl_init()) {
34
  curl_setopt($curl, CURLOPT_URL, self::getAPIMethod($method));
35
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
36
- 'Authorization: Basic ' . self::getAPIKey(),
37
  'Content-Type: application/json',
38
  'Content-Length: ' . strlen($data)));
39
- curl_setopt($curl, CURLOPT_POST, true);
40
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
41
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
42
- curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
43
- curl_setopt($curl, CURLOPT_FRESH_CONNECT, true);
44
  curl_setopt($curl, CURLOPT_TIMEOUT, 1);
45
 
46
  curl_exec($curl);
@@ -49,7 +49,7 @@
49
  }
50
  }
51
 
52
- public static function CallAPIWithResponse($method, $params) {
53
  $data = json_encode($params);
54
 
55
  $response = null;
@@ -57,13 +57,13 @@
57
  if ($curl = curl_init()) {
58
  curl_setopt($curl, CURLOPT_URL, self::getAPIMethod($method));
59
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
60
- 'Authorization: Basic ' . self::getAPIKey(),
61
  'Content-Type: application/json',
62
  'Content-Length: ' . strlen($data)));
63
- curl_setopt($curl, CURLOPT_POST, true);
64
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
65
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
66
- curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
67
 
68
  $response = curl_exec($curl);
69
 
2
  class Bubbleyes_BubblitPlugin_Helper_Data extends Mage_Core_Helper_Abstract
3
  {
4
  static $APIAddress = "http://api.bubbleyes.com/client/";
5
+ static $Version = 'magento 2.0.0';
6
  static $ProductsPortionSize = 25;
7
 
8
  public static function getProductPortionSize() {
25
  return Mage::getStoreConfig('BubbleyesBubblitPluginOptions/bubbl_layout/bubbllayout', $storeId);
26
  }
27
 
28
+ public static function CallAPI($method, $params, $storeId) {
29
  $data = json_encode($params);
30
 
31
  $response = null;
33
  if ($curl = curl_init()) {
34
  curl_setopt($curl, CURLOPT_URL, self::getAPIMethod($method));
35
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
36
+ 'Authorization: Basic ' . self::getAPIKey($storeId),
37
  'Content-Type: application/json',
38
  'Content-Length: ' . strlen($data)));
39
+ curl_setopt($curl, CURLOPT_POST, TRUE);
40
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
41
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
42
+ curl_setopt($curl, CURLOPT_NOSIGNAL, TRUE);
43
+ curl_setopt($curl, CURLOPT_FRESH_CONNECT, TRUE);
44
  curl_setopt($curl, CURLOPT_TIMEOUT, 1);
45
 
46
  curl_exec($curl);
49
  }
50
  }
51
 
52
+ public static function CallAPIWithResponse($method, $params, $storeId) {
53
  $data = json_encode($params);
54
 
55
  $response = null;
57
  if ($curl = curl_init()) {
58
  curl_setopt($curl, CURLOPT_URL, self::getAPIMethod($method));
59
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
60
+ 'Authorization: Basic ' . self::getAPIKey($storeId),
61
  'Content-Type: application/json',
62
  'Content-Length: ' . strlen($data)));
63
+ curl_setopt($curl, CURLOPT_POST, TRUE);
64
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
65
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
66
+ curl_setopt($curl, CURLOPT_NOSIGNAL, TRUE);
67
 
68
  $response = curl_exec($curl);
69
 
app/code/community/Bubbleyes/BubblitPlugin/Model/Config/Source/Helpinfo/Comment.php CHANGED
@@ -7,30 +7,39 @@ class Bubbleyes_BubblitPlugin_Model_Config_Source_Helpinfo_Comment extends Mage_
7
  $supportedCurrencies = Mage::helper("Bubbleyes_BubblitPlugin")->CallAPIWithResponse('listSupportedCurrencies', array());
8
 
9
  $result = '
 
 
 
 
 
 
10
  <ul style="font-size:11px">
11
- <li>1. Register to the Bubbleyes.com platform <br/>(at <a href="http://bubbleyes.com/" target="_blank">http://bubbleyes.com/</a>).
12
  <br/> Upon registration you will be able to log in to the Bubbleyes Client Platform (at <a href="http://admin.bubbleyes.com/" target="_blank">http://admin.bubbleyes.com/</a>). In your profile there you can access the API key needed in the plugin configuration.
13
  </li>
14
-
15
  <li>
16
  <br/>
17
- 2. Once the plugin is configured all products data will be automatically synchronized between your Magento installation and your Bubbleyes installation.
18
- <br/> This includes automatically making changes when products are created or edited or deleted.
19
  </li>
20
-
21
  <li>
22
  <br/>
23
- 3. The supoorted currencies are: '
24
- . implode(", ", $supportedCurrencies)
25
- . '<br/> If you currency is not in the supported list, your data will not be synchonized.
26
  </li>
27
 
28
  <li>
29
  <br />
30
  4. If you want the plugin setup to insert automatically the Bubbl button in the product details, please set "Bubbl Button Enabled In Details" = yes.
31
- To insert manually the Bubbl button in your theme, please use as reference the Bubbleyes theme, which is created with the plugin installation.
 
 
32
  </li>
33
  </ul>
 
 
 
 
34
  ';
35
 
36
  return $result;
7
  $supportedCurrencies = Mage::helper("Bubbleyes_BubblitPlugin")->CallAPIWithResponse('listSupportedCurrencies', array());
8
 
9
  $result = '
10
+ <p>
11
+ The Bubbl plugin configuration is based at Store View level. You need to register different client for each Store View you want to integrate with Bubbleyes.
12
+ <br/>
13
+ Follow the steps to setup a single Store View with Bubbleyes (you can repeat the process for all Store Views):
14
+ </p>
15
+ <br/>
16
  <ul style="font-size:11px">
17
+ <li>1. Register to the Bubbleyes.com platform <br/>(at <a href="http://admin.bubbleyes.com/" target="_blank">http://admin.bubbleyes.com/</a>).
18
  <br/> Upon registration you will be able to log in to the Bubbleyes Client Platform (at <a href="http://admin.bubbleyes.com/" target="_blank">http://admin.bubbleyes.com/</a>). In your profile there you can access the API key needed in the plugin configuration.
19
  </li>
 
20
  <li>
21
  <br/>
22
+ 2. Navigate to the configuration of the plugin in the Store View you want to setup.
 
23
  </li>
 
24
  <li>
25
  <br/>
26
+ 3. Enter the received by the Bubbleyes API Key in the configuration field.
27
+ <br/> Once the configuration is saved with an API Key all products data will be automatically synchronized between your Magento installation and your Bubbleyes installation.
28
+ <br/> This includes automatically making changes when products are created or edited or deleted.
29
  </li>
30
 
31
  <li>
32
  <br />
33
  4. If you want the plugin setup to insert automatically the Bubbl button in the product details, please set "Bubbl Button Enabled In Details" = yes.
34
+ <br/>By default the buton is inserted at the end of you product content section.
35
+
36
+ <br/>To insert manually or reposition the Bubbl button in your theme, please use as reference the Bubbleyes theme, which is created with the plugin installation.
37
  </li>
38
  </ul>
39
+ <br/><br/>
40
+ <p>
41
+ More technical information can be found at <a href="http://api.bubbleyes.com/integration#developedWithMagento" target="_blank">http://api.bubbleyes.com/integration#developedWithMagento</a>.
42
+ </p>
43
  ';
44
 
45
  return $result;
app/code/community/Bubbleyes/BubblitPlugin/Model/Observer.php CHANGED
@@ -13,46 +13,9 @@ class Bubbleyes_BubblitPlugin_Model_Observer
13
  {
14
  try{
15
  // Retrieve the product being updated from the event observer
16
- $product = $observer->getEvent()->getProduct();
17
-
18
- if($product->sku != null)
19
- {
20
- // create or update
21
- if($product->visibility != Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE) {
22
- $categories = $product -> getCategoryCollection() -> addAttributeToSelect(array('name'));
23
-
24
- $productCategory = NULL;
25
- $productCategoryId = NULL;
26
- if(count($categories) > 0)
27
- {
28
- $category = $categories -> getFirstItem();
29
- $productCategory = $category -> getName();
30
- $productCategoryId = $category -> getId();
31
- }
32
-
33
- $productImage = $this->GetImageUrl($product);
34
-
35
- $productData = array(
36
- 'SKU' => $product->sku,
37
- 'Name' => $product->name,
38
- 'ShopUrl' => $product-> getProductUrl(),
39
- 'Description' => $product->short_description,
40
- 'Currency' => Mage::app()->getStore()->getCurrentCurrencyCode(),
41
- 'Price' => number_format($product->price, 2, '.', ''),
42
- 'DiscountedPrice' => $product-> special_price == null ? null : number_format($product-> special_price, 2, '.', ''),
43
- 'IsActive' => ($product -> status) == 1 ? "true" : "false",
44
- 'Image' => $productImage,
45
- 'Category' => $productCategory,
46
- 'CategoryId' => $productCategoryId
47
- );
48
-
49
- $this->_helper->CallAPI('createOrEditProduct', array('Product' => $productData));
50
- }
51
- //delete
52
- else {
53
- self::DeleteProduct($product, $this->_helper);
54
- }
55
- }
56
  }
57
  catch (Exception $ex) {
58
  $this->_helper->LoggerForException($ex);
@@ -62,7 +25,9 @@ class Bubbleyes_BubblitPlugin_Model_Observer
62
  public function HandleProductDelete(Varien_Event_Observer $observer)
63
  {
64
  try{
 
65
  $product = $observer->getEvent()->getProduct();
 
66
  self::DeleteProduct($product, $this->_helper);
67
  }
68
  catch (Exception $ex) {
@@ -73,38 +38,103 @@ class Bubbleyes_BubblitPlugin_Model_Observer
73
  public function HandleSettingsChanged(Varien_Event_Observer $observer)
74
  {
75
  try{
76
- $products = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('visibility', array('neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE))->addAttributeToSelect(array('name', 'short_description', 'price', 'special_price', 'currency', 'status', 'image'));
77
-
78
- $timestamp = date('YmdHis');
79
 
80
- //do in portions
81
- $itt = 0;
82
- $productsPortion = array();
83
- foreach($products as $product)
84
  {
85
- array_push($productsPortion, $product);
86
- $itt++;
 
 
 
87
 
88
- if($itt == $this->_helper->getProductPortionSize())
89
- {
90
- try {
91
- $this->_helper->CallAPI('importProducts', array('ProductsXML' => self::BuildProductsXML($productsPortion), 'Timestamp' => $timestamp));
92
- }
93
- catch (Exception $exPortion) {
94
- $this->_helper->LoggerForException($exPortion);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
- $itt = 0;
97
- $productsPortion = array();
98
  }
99
- }
100
 
101
- $this->_helper->CallAPI('importProducts', array('ProductsXML' => self::BuildProductsXML($productsPortion), 'Timestamp' => $timestamp, 'IsLastPortion' => true));
 
102
  }
103
  catch (Exception $ex) {
104
  $this->_helper->LoggerForException($ex);
105
  }
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  public static function GetImageUrl($product) {
109
  $productMediaConfig = Mage::getModel('catalog/product_media_config');
110
 
@@ -120,12 +150,78 @@ class Bubbleyes_BubblitPlugin_Model_Observer
120
  return $productImage;
121
  }
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  public static function DeleteProduct($product, $helper) {
124
  $productData = array(
125
  'SKU' => $product->sku
126
  );
127
 
128
- $helper->CallAPI('deleteProduct', array('Product' => $productData));
 
 
 
 
 
129
  }
130
 
131
  public static function BuildProductsXML($products) {
@@ -141,22 +237,21 @@ class Bubbleyes_BubblitPlugin_Model_Observer
141
 
142
  $productXML -> addChild("name", htmlspecialchars($product->name, ENT_QUOTES));
143
  $productXML -> addChild("description", htmlspecialchars($product->short_description, ENT_QUOTES));
144
- $productXML -> addChild("currency", Mage::app()->getStore()->getCurrentCurrencyCode());
145
- $productXML -> addChild("price", number_format($product->price, 2, '.', ''));
146
 
147
- $discountedPrice = $product-> special_price;
 
 
 
148
  if($discountedPrice != null) {
149
  $productXML -> addChild("discountedprice", number_format($discountedPrice, 2, '.', ''));
150
  }
151
 
152
  $productXML -> addChild("active", ($product -> status) == 1 ? "true" : "false");
153
 
154
- $categories = $product -> getCategoryCollection() -> addAttributeToSelect(array('name','id'));
155
- if(count($categories) > 0)
156
- {
157
- $category = $categories -> getFirstItem();
158
- $productXML -> addChild("category", htmlspecialchars($category -> getName(), ENT_QUOTES));
159
- $productXML -> addChild("categoryId", $category -> getId());
160
  }
161
 
162
  $productImage = self::GetImageUrl($product);
13
  {
14
  try{
15
  // Retrieve the product being updated from the event observer
16
+ $productId = $observer->getEvent()->getProduct()->getId();
17
+
18
+ self::UpdateProduct($productId, $this->_helper);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
  catch (Exception $ex) {
21
  $this->_helper->LoggerForException($ex);
25
  public function HandleProductDelete(Varien_Event_Observer $observer)
26
  {
27
  try{
28
+ // Retrieve the product being deleted from the event observer
29
  $product = $observer->getEvent()->getProduct();
30
+
31
  self::DeleteProduct($product, $this->_helper);
32
  }
33
  catch (Exception $ex) {
38
  public function HandleSettingsChanged(Varien_Event_Observer $observer)
39
  {
40
  try{
41
+ $code = Mage::getSingleton('adminhtml/config_data')->getStore();
42
+ $storeId = Mage::getModel('core/store')->load($code)->getId();
 
43
 
44
+ if($storeId != 0)
 
 
 
45
  {
46
+ $productIds = Mage::getModel('catalog/product')
47
+ ->getCollection()
48
+ ->addStoreFilter($storeId)
49
+ ->addAttributeToFilter('visibility', array('neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE))
50
+ ->addAttributeToSelect('entity_id');
51
 
52
+ $timestamp = date('YmdHis');
53
+
54
+ //do in portions
55
+ $itt = 0;
56
+ $productsPortion = array();
57
+ foreach($productIds as $productId)
58
+ {
59
+ $product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($productId->getId());
60
+
61
+ array_push($productsPortion, $product);
62
+ $itt++;
63
+
64
+ if($itt == $this->_helper->getProductPortionSize())
65
+ {
66
+ try {
67
+ $this->_helper->CallAPI('importProducts', array('ProductsXML' => self::BuildProductsXML($productsPortion), 'Timestamp' => $timestamp), $storeId);
68
+ }
69
+ catch (Exception $exPortion) {
70
+ $this->_helper->LoggerForException($exPortion);
71
+ }
72
+ $itt = 0;
73
+ $productsPortion = array();
74
  }
 
 
75
  }
 
76
 
77
+ $this->_helper->CallAPI('importProducts', array('ProductsXML' => self::BuildProductsXML($productsPortion), 'Timestamp' => $timestamp, 'IsLastPortion' => true), $storeId);
78
+ }
79
  }
80
  catch (Exception $ex) {
81
  $this->_helper->LoggerForException($ex);
82
  }
83
  }
84
 
85
+ public static function GetPrice($product, $baseCurrency, $currentCurrency) {
86
+
87
+ $price = $product->getPrice();
88
+ $discountedPrice = $product->getSpecialPrice();
89
+ $currency = $baseCurrency;
90
+
91
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
92
+
93
+ $optionCollection= $product->getTypeInstance(true)->getOptionsCollection($product);
94
+ $selectionsCollection = $product->getTypeInstance(true)->getSelectionsCollection(
95
+ $product->getTypeInstance(true)->getOptionsIds($product),
96
+ $product
97
+ );
98
+ $optionCollection->appendSelections($selectionsCollection);
99
+
100
+ foreach($optionCollection as $option)
101
+ {
102
+ $minPrice = 0;
103
+
104
+ if($option->required) {
105
+ $selections = $option->getSelections();
106
+ $minPrice = min(array_map(function ($s) {
107
+ return $s->price;
108
+ }, $selections));
109
+ }
110
+
111
+ $price += $minPrice;
112
+ }
113
+
114
+ $discountedPrice = $price * $product->getSpecialPrice() / 100;
115
+ }
116
+ else if($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_GROUPED) {
117
+ $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
118
+
119
+ foreach($associatedProducts as $associatedProduct)
120
+ {
121
+ $price += $associatedProduct -> getPrice();
122
+ $discountedPrice += $associatedProduct -> getSpecialPrice();
123
+ }
124
+ }
125
+
126
+ //convert to store currency
127
+ $rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrency, array($currentCurrency));
128
+ if(count($rates) > 0)
129
+ {
130
+ $price = Mage::helper('directory')->currencyConvert($price, $baseCurrency, $currentCurrency);
131
+ $discountedPrice = Mage::helper('directory')->currencyConvert($discountedPrice, $baseCurrency, $currentCurrency);
132
+ $currency = $currentCurrency;
133
+ }
134
+
135
+ return array($price, $discountedPrice, $currency);
136
+ }
137
+
138
  public static function GetImageUrl($product) {
139
  $productMediaConfig = Mage::getModel('catalog/product_media_config');
140
 
150
  return $productImage;
151
  }
152
 
153
+ public static function GetCategory($product) {
154
+ $categories = $product -> getCategoryCollection() -> addAttributeToSelect(array('name'));
155
+
156
+ $productCategory = NULL;
157
+ $productCategoryId = NULL;
158
+ if(count($categories) > 0)
159
+ {
160
+ $category = $categories -> getFirstItem();
161
+ $productCategory = $category -> getName();
162
+ $productCategoryId = $category -> getId();
163
+ }
164
+
165
+ return array($productCategory, $productCategoryId);
166
+ }
167
+
168
+ public static function UpdateProduct($productId, $helper) {
169
+ //update product for each store, as some properties are global
170
+ foreach(Mage::app()->getStores() as $store) {
171
+ $storeId = $store->getId();
172
+
173
+ $product = Mage::getModel('catalog/product')->setStoreId($storeId)->load($productId);
174
+
175
+ if(in_array($store->getWebsiteId(), $product->getWebsiteIds()))
176
+ {
177
+ if($product->sku != NULL)
178
+ {
179
+ // create or update
180
+ if($product->visibility != Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE) {
181
+
182
+ list($price, $discountedPrice, $currency) = self::GetPrice($product, $store->getBaseCurrencyCode(), $store->getCurrentCurrencyCode());
183
+ list($productCategory, $productCategoryId) = self::GetCategory($product);
184
+ $productImage = self::GetImageUrl($product);
185
+
186
+ $productData = array(
187
+ 'SKU' => $product->sku,
188
+ 'Name' => $product->name,
189
+ 'ShopUrl' => $product->getProductUrl(),
190
+ 'Description' => $product->short_description,
191
+ 'Currency' => $currency,
192
+ 'Price' => number_format($price, 2, '.', ''),
193
+ 'DiscountedPrice' => number_format($discountedPrice, 2, '.', ''),
194
+ 'IsActive' => ($product -> status) == 1 ? "true" : "false",
195
+ 'Image' => $productImage,
196
+ 'Category' => $productCategory,
197
+ 'CategoryId' => $productCategoryId
198
+ );
199
+
200
+ $helper->CallAPI('createOrEditProduct', array('Product' => $productData), $storeId);
201
+ }
202
+ //delete
203
+ else {
204
+ self::DeleteProduct($product, $helper);
205
+ }
206
+ }
207
+ }
208
+ else {
209
+ self::DeleteProduct($product, $helper);
210
+ }
211
+ }
212
+ }
213
+
214
  public static function DeleteProduct($product, $helper) {
215
  $productData = array(
216
  'SKU' => $product->sku
217
  );
218
 
219
+ //delete from each store view
220
+ foreach(Mage::app()->getStores() as $store) {
221
+ $storeId = $store->getId();
222
+
223
+ $helper->CallAPI('deleteProduct', array('Product' => $productData), $storeId);
224
+ }
225
  }
226
 
227
  public static function BuildProductsXML($products) {
237
 
238
  $productXML -> addChild("name", htmlspecialchars($product->name, ENT_QUOTES));
239
  $productXML -> addChild("description", htmlspecialchars($product->short_description, ENT_QUOTES));
 
 
240
 
241
+ list($price, $discountedPrice, $currency) = self::GetPrice($product, $store->getBaseCurrencyCode(), $store->getCurrentCurrencyCode());
242
+
243
+ $productXML -> addChild("currency", $currency);
244
+ $productXML -> addChild("price", number_format($price, 2, '.', ''));
245
  if($discountedPrice != null) {
246
  $productXML -> addChild("discountedprice", number_format($discountedPrice, 2, '.', ''));
247
  }
248
 
249
  $productXML -> addChild("active", ($product -> status) == 1 ? "true" : "false");
250
 
251
+ list($productCategory, $productCategoryId) = self::GetCategory($product);
252
+ if($productCategory != NULL) {
253
+ $productXML -> addChild("category", htmlspecialchars($productCategory, ENT_QUOTES));
254
+ $productXML -> addChild("categoryId", $productCategoryId);
 
 
255
  }
256
 
257
  $productImage = self::GetImageUrl($product);
app/code/community/Bubbleyes/BubblitPlugin/etc/config.xml CHANGED
@@ -5,7 +5,7 @@
5
  <modules>
6
 
7
  <Bubbleyes_BubblitPlugin>
8
- <version>1.0.0</version>
9
  </Bubbleyes_BubblitPlugin>
10
 
11
  </modules>
@@ -61,8 +61,7 @@
61
  </Bubbleyes_BubblitPlugin>
62
  </helpers>
63
 
64
-
65
- <blocks>
66
  <BubblitPlugin>
67
  <class>Bubbleyes_BubblitPlugin_Block</class>
68
  </BubblitPlugin>
5
  <modules>
6
 
7
  <Bubbleyes_BubblitPlugin>
8
+ <version>2.0.0</version>
9
  </Bubbleyes_BubblitPlugin>
10
 
11
  </modules>
61
  </Bubbleyes_BubblitPlugin>
62
  </helpers>
63
 
64
+ <blocks>
 
65
  <BubblitPlugin>
66
  <class>Bubbleyes_BubblitPlugin_Block</class>
67
  </BubblitPlugin>
app/code/community/Bubbleyes/BubblitPlugin/etc/system.xml CHANGED
@@ -14,34 +14,34 @@
14
  <sort_order>1</sort_order>
15
  <show_in_default>1</show_in_default>
16
  <show_in_website>0</show_in_website>
17
- <show_in_store>0</show_in_store>
18
  <groups>
19
  <api_access translate="label">
20
  <label>API Access</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>1</sort_order>
23
- <show_in_default>1</show_in_default>
24
  <show_in_website>0</show_in_website>
25
- <show_in_store>0</show_in_store>
26
  <expanded>1</expanded>
27
  <fields>
28
  <api_key translate="label comment">
29
  <label>API key</label>
30
- <comment><![CDATA[API key providing access to the Bubbleyes API.]]></comment>
31
  <frontend_type>text</frontend_type>
32
  <sort_order>1</sort_order>
33
- <show_in_default>1</show_in_default>
34
  <show_in_website>0</show_in_website>
35
- <show_in_store>0</show_in_store>
36
  </api_key>
37
  </fields>
38
  </api_access>
39
  <bubbl_layout translate="label">
40
  <label>Bubbl Button</label>
41
  <sort_order>2</sort_order>
42
- <show_in_default>1</show_in_default>
43
  <show_in_website>0</show_in_website>
44
- <show_in_store>0</show_in_store>
45
  <expanded>1</expanded>
46
  <fields>
47
  <bubblenabled translate="label comment">
@@ -50,9 +50,9 @@
50
  <frontend_type>select</frontend_type>
51
  <source_model>adminhtml/system_config_source_yesno</source_model>
52
  <sort_order>2</sort_order>
53
- <show_in_default>1</show_in_default>
54
  <show_in_website>0</show_in_website>
55
- <show_in_store>0</show_in_store>
56
  </bubblenabled>
57
  <bubbllayout translate="label comment">
58
  <label>Bubbl Button Layout</label>
14
  <sort_order>1</sort_order>
15
  <show_in_default>1</show_in_default>
16
  <show_in_website>0</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
  <groups>
19
  <api_access translate="label">
20
  <label>API Access</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>1</sort_order>
23
+ <show_in_default>0</show_in_default>
24
  <show_in_website>0</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
  <expanded>1</expanded>
27
  <fields>
28
  <api_key translate="label comment">
29
  <label>API key</label>
30
+ <comment><![CDATA[API key providing access to the Bubbleyes API. <br/> The API Key needs to be distinct for each Store View.]]></comment>
31
  <frontend_type>text</frontend_type>
32
  <sort_order>1</sort_order>
33
+ <show_in_default>0</show_in_default>
34
  <show_in_website>0</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
  </api_key>
37
  </fields>
38
  </api_access>
39
  <bubbl_layout translate="label">
40
  <label>Bubbl Button</label>
41
  <sort_order>2</sort_order>
42
+ <show_in_default>0</show_in_default>
43
  <show_in_website>0</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
  <expanded>1</expanded>
46
  <fields>
47
  <bubblenabled translate="label comment">
50
  <frontend_type>select</frontend_type>
51
  <source_model>adminhtml/system_config_source_yesno</source_model>
52
  <sort_order>2</sort_order>
53
+ <show_in_default>0</show_in_default>
54
  <show_in_website>0</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
  </bubblenabled>
57
  <bubbllayout translate="label comment">
58
  <label>Bubbl Button Layout</label>
app/design/frontend/Bubbleyes/default/template/catalog/product/view/sharing.phtml CHANGED
@@ -1,52 +1,52 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package rwd_default
23
- * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- ?>
27
-
28
- <?php $_product = $this->getProduct(); ?>
29
- <?php $_wishlistSubmitUrl = $this->helper('wishlist')->getAddUrl($_product); ?>
30
-
31
- <ul class="sharing-links">
32
- <?php if ($this->canEmailToFriend()): ?>
33
- <li><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>" class="link-email-friend" title="<?php echo $this->__('Email to a Friend') ?>"><?php echo $this->__('Email to a Friend') ?></a></li>
34
- <?php endif; ?>
35
-
36
- <?php $_helper = $this->helper('catalog/output'); ?>
37
- <?php $_productName = urlencode(trim($_helper->productAttribute($_product, $_product->getName(), 'name')))?>
38
- <?php $_productImageUrl = urlencode(trim($this->helper('catalog/image')->init($_product, 'image')))?>
39
- <?php $_productUrl = urlencode(trim($_product->getProductUrl()))?>
40
- <li>
41
- <?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description'))); ?>
42
- <a href="<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>" target="_blank" title="<?php echo $this->__('Share on Facebook') ?>" class="link-facebook">
43
- <?php echo $this->__('Share Facebook') ?>
44
- </a>
45
- </li>
46
- <li>
47
- <a href="<?php echo 'http://twitter.com/home?status=' . $_productName . '+' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Twitter') ?>" class="link-twitter"><?php echo $this->__('Share on Twitter') ?></a>
48
- </li>
49
- </ul>
50
-
51
  <?php echo $this->getChildHtml('', true, true) ?>
52
-
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <?php $_product = $this->getProduct(); ?>
29
+ <?php $_wishlistSubmitUrl = $this->helper('wishlist')->getAddUrl($_product); ?>
30
+
31
+ <ul class="sharing-links">
32
+ <?php if ($this->canEmailToFriend()): ?>
33
+ <li><a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>" class="link-email-friend" title="<?php echo $this->__('Email to a Friend') ?>"><?php echo $this->__('Email to a Friend') ?></a></li>
34
+ <?php endif; ?>
35
+
36
+ <?php $_helper = $this->helper('catalog/output'); ?>
37
+ <?php $_productName = urlencode(trim($_helper->productAttribute($_product, $_product->getName(), 'name')))?>
38
+ <?php $_productImageUrl = urlencode(trim($this->helper('catalog/image')->init($_product, 'image')))?>
39
+ <?php $_productUrl = urlencode(trim($_product->getProductUrl()))?>
40
+ <li>
41
+ <?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description'))); ?>
42
+ <a href="<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>" target="_blank" title="<?php echo $this->__('Share on Facebook') ?>" class="link-facebook">
43
+ <?php echo $this->__('Share Facebook') ?>
44
+ </a>
45
+ </li>
46
+ <li>
47
+ <a href="<?php echo 'http://twitter.com/home?status=' . $_productName . '+' . $_productUrl; ?>" target="_blank" title="<?php echo $this->__('Share on Twitter') ?>" class="link-twitter"><?php echo $this->__('Share on Twitter') ?></a>
48
+ </li>
49
+ </ul>
50
+
51
  <?php echo $this->getChildHtml('', true, true) ?>
52
+
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bubbleyes_BubblitPlugin</name>
4
- <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/bsd-license.php">BSDL</license>
7
  <channel>community</channel>
@@ -9,11 +9,11 @@
9
  <summary>Connect customers and web stores&#xD;
10
  in a unique and dynamic way: Bubbl!</summary>
11
  <description>It's simple. End-consumers from all over the world surf the Internet, finding products which interest them- but the prices are slightly higher than they are willing to pay. With a simple click, these products are stored in a single convenient collection.</description>
12
- <notes>- bug fixing</notes>
13
  <authors><author><name>Terje Lindstad</name><user>tlindstad</user><email>terjelindstad@bubbleyes.com</email></author></authors>
14
- <date>2015-03-05</date>
15
- <time>15:40:13</time>
16
- <contents><target name="magecommunity"><dir><dir name="Bubbleyes"><dir name="BubblitPlugin"><dir name="Block"><file name="Button.php" hash="5a5fbba9f2621b5cb3364f23df195139"/></dir><dir name="Helper"><file name="Data.php" hash="fe878e00f31d04d3a2c8c4ea5f3d7622"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Bubbllayout.php" hash="ea03544f51545df9803dc3fb0d69ce30"/><dir name="Helpinfo"><file name="Comment.php" hash="eaa644af07bf619a06805184e1daffbd"/></dir></dir></dir><file name="Observer.php" hash="4df95674e5613914e9802ef0fa0fa8ba"/></dir><dir name="etc"><file name="config.xml" hash="042fd5e76f03266d2f22e4e7025d06b1"/><file name="system.xml" hash="70edfaadc7a8749c32a968f0d8c3d4f2"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Bubbleyes_BubblitPlugin.xml" hash="0691ad097f8ca937d80ad4936607fea5"/></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="Bubbleyes_BubblitPlugin.xml" hash="2b172171473b55f2c4596f1eacee7e63"/></dir><dir name="template"><dir name="BubblitPlugin"><file name="button.phtml" hash="18199c13f81a042985363824986156c0"/></dir></dir></dir></dir><dir name="Bubbleyes"><dir name="default"><dir name="etc"><file name="theme.xml" hash="5c4fce4eb634014e556a22cec2a76d20"/></dir><dir name="layout"><file name="local.xml" hash="01c78642851f6e17d1057882f893d3c1"/></dir><dir name="template"><dir name="catalog"><dir name="product"><dir name="view"><file name="sharing.phtml" hash="5be2544566332d003f3bb16579a96498"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>4.5.0</min><max>10.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bubbleyes_BubblitPlugin</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/bsd-license.php">BSDL</license>
7
  <channel>community</channel>
9
  <summary>Connect customers and web stores&#xD;
10
  in a unique and dynamic way: Bubbl!</summary>
11
  <description>It's simple. End-consumers from all over the world surf the Internet, finding products which interest them- but the prices are slightly higher than they are willing to pay. With a simple click, these products are stored in a single convenient collection.</description>
12
+ <notes>Support for multiple stores integration.</notes>
13
  <authors><author><name>Terje Lindstad</name><user>tlindstad</user><email>terjelindstad@bubbleyes.com</email></author></authors>
14
+ <date>2015-04-16</date>
15
+ <time>13:33:23</time>
16
+ <contents><target name="magecommunity"><dir><dir name="Bubbleyes"><dir name="BubblitPlugin"><dir name="Block"><file name="Button.php" hash="39db783537390fbc03c76602977c6008"/></dir><dir name="Helper"><file name="Data.php" hash="d3fa85918ee8d1c6073860ebea4b0af8"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Bubbllayout.php" hash="ea03544f51545df9803dc3fb0d69ce30"/><dir name="Helpinfo"><file name="Comment.php" hash="f522eebef8df7b53015d5033174afa01"/></dir></dir></dir><file name="Observer.php" hash="34e39693889445de5746ce8b4c04f7c4"/></dir><dir name="etc"><file name="config.xml" hash="89c5875e9f31e937796c294d778f6ffa"/><file name="system.xml" hash="02a77a78253deaaa1d39a535a7340cf7"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Bubbleyes_BubblitPlugin.xml" hash="0691ad097f8ca937d80ad4936607fea5"/></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="Bubbleyes_BubblitPlugin.xml" hash="2b172171473b55f2c4596f1eacee7e63"/></dir><dir name="template"><dir name="BubblitPlugin"><file name="button.phtml" hash="18199c13f81a042985363824986156c0"/></dir></dir></dir></dir><dir name="Bubbleyes"><dir name="default"><dir name="etc"><file name="theme.xml" hash="5c4fce4eb634014e556a22cec2a76d20"/></dir><dir name="layout"><file name="local.xml" hash="01c78642851f6e17d1057882f893d3c1"/></dir><dir name="template"><dir name="catalog"><dir name="product"><dir name="view"><file name="sharing.phtml" hash="c27124947cf5c5aec2582f50d422716e"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>4.5.0</min><max>10.0.0</max></php></required></dependencies>
19
  </package>