Version Notes
- bug fixing
Download this release
Release Info
| Developer | Terje Lindstad |
| Extension | Bubbleyes_BubblitPlugin |
| Version | 1.3.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.0 to 1.3.0
app/code/community/Bubbleyes/BubblitPlugin/Block/Button.php
CHANGED
|
@@ -20,9 +20,7 @@ class Bubbleyes_BubblitPlugin_Block_Button
|
|
| 20 |
'SKU' => $productSKU
|
| 21 |
);
|
| 22 |
|
| 23 |
-
$settings =
|
| 24 |
-
'Type' => $this->_helper->getBubblLayout()
|
| 25 |
-
);
|
| 26 |
|
| 27 |
$tmp = $this->_helper->CallAPIWithResponse('getProductScript', array('Product' => $productData, 'Settings' => $settings));
|
| 28 |
return $tmp["Script"];
|
| 20 |
'SKU' => $productSKU
|
| 21 |
);
|
| 22 |
|
| 23 |
+
$settings = NULL;
|
|
|
|
|
|
|
| 24 |
|
| 25 |
$tmp = $this->_helper->CallAPIWithResponse('getProductScript', array('Product' => $productData, 'Settings' => $settings));
|
| 26 |
return $tmp["Script"];
|
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.
|
| 6 |
static $ProductsPortionSize = 25;
|
| 7 |
|
| 8 |
public static function getProductPortionSize() {
|
| 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() {
|
app/code/community/Bubbleyes/BubblitPlugin/Model/Observer.php
CHANGED
|
@@ -17,34 +17,42 @@ class Bubbleyes_BubblitPlugin_Model_Observer
|
|
| 17 |
|
| 18 |
if($product->sku != null)
|
| 19 |
{
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
}
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
$productData = array(
|
| 34 |
-
'SKU' => $product->sku,
|
| 35 |
-
'Name' => $product->name,
|
| 36 |
-
'ShopUrl' => $product-> getProductUrl(),
|
| 37 |
-
'Description' => $product->short_description,
|
| 38 |
-
'Currency' => Mage::app()->getStore()->getCurrentCurrencyCode(),
|
| 39 |
-
'Price' => number_format($product->price, 2, '.', ''),
|
| 40 |
-
'DiscountedPrice' => $product-> special_price == null ? null : number_format($product-> special_price, 2, '.', ''),
|
| 41 |
-
'IsActive' => ($product -> status) == 1 ? "true" : "false",
|
| 42 |
-
'Image' => $productImage,
|
| 43 |
-
'Category' => $productCategory
|
| 44 |
-
);
|
| 45 |
-
|
| 46 |
-
$this->_helper->CallAPI('createOrEditProduct', array('Product' => $productData));
|
| 47 |
-
}
|
| 48 |
}
|
| 49 |
catch (Exception $ex) {
|
| 50 |
$this->_helper->LoggerForException($ex);
|
|
@@ -55,11 +63,7 @@ class Bubbleyes_BubblitPlugin_Model_Observer
|
|
| 55 |
{
|
| 56 |
try{
|
| 57 |
$product = $observer->getEvent()->getProduct();
|
| 58 |
-
$
|
| 59 |
-
'SKU' => $product->sku
|
| 60 |
-
);
|
| 61 |
-
|
| 62 |
-
$this->_helper->CallAPI('deleteProduct', array('Product' => $productData));
|
| 63 |
}
|
| 64 |
catch (Exception $ex) {
|
| 65 |
$this->_helper->LoggerForException($ex);
|
|
@@ -69,7 +73,9 @@ class Bubbleyes_BubblitPlugin_Model_Observer
|
|
| 69 |
public function HandleSettingsChanged(Varien_Event_Observer $observer)
|
| 70 |
{
|
| 71 |
try{
|
| 72 |
-
$products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect(array('name', 'short_description', 'price', 'special_price', 'currency', 'status', 'image'));
|
|
|
|
|
|
|
| 73 |
|
| 74 |
//do in portions
|
| 75 |
$itt = 0;
|
|
@@ -82,7 +88,7 @@ class Bubbleyes_BubblitPlugin_Model_Observer
|
|
| 82 |
if($itt == $this->_helper->getProductPortionSize())
|
| 83 |
{
|
| 84 |
try {
|
| 85 |
-
$this->_helper->CallAPI('importProducts', array('ProductsXML' => self::BuildProductsXML($productsPortion)));
|
| 86 |
}
|
| 87 |
catch (Exception $exPortion) {
|
| 88 |
$this->_helper->LoggerForException($exPortion);
|
|
@@ -92,16 +98,36 @@ class Bubbleyes_BubblitPlugin_Model_Observer
|
|
| 92 |
}
|
| 93 |
}
|
| 94 |
|
| 95 |
-
|
| 96 |
-
{
|
| 97 |
-
$this->_helper->CallAPI('importProducts', array('ProductsXML' => self::BuildProductsXML($productsPortion)));
|
| 98 |
-
}
|
| 99 |
}
|
| 100 |
catch (Exception $ex) {
|
| 101 |
$this->_helper->LoggerForException($ex);
|
| 102 |
}
|
| 103 |
}
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
public static function BuildProductsXML($products) {
|
| 106 |
$productsXML = new SimpleXMLElement('<products/>');
|
| 107 |
|
|
@@ -125,18 +151,15 @@ class Bubbleyes_BubblitPlugin_Model_Observer
|
|
| 125 |
|
| 126 |
$productXML -> addChild("active", ($product -> status) == 1 ? "true" : "false");
|
| 127 |
|
| 128 |
-
$categories = $product -> getCategoryCollection() -> addAttributeToSelect(array('name'));
|
| 129 |
if(count($categories) > 0)
|
| 130 |
{
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
$productImage = null;
|
| 135 |
-
try{
|
| 136 |
-
$productImage = $product -> getImage() != 'no_selection' ? $product -> getImageUrl() : null;
|
| 137 |
}
|
| 138 |
-
catch(Exception $exImage) { }
|
| 139 |
|
|
|
|
| 140 |
$productXML -> addChild("image", htmlspecialchars($productImage, ENT_QUOTES));
|
| 141 |
}
|
| 142 |
|
| 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);
|
| 63 |
{
|
| 64 |
try{
|
| 65 |
$product = $observer->getEvent()->getProduct();
|
| 66 |
+
self::DeleteProduct($product, $this->_helper);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
}
|
| 68 |
catch (Exception $ex) {
|
| 69 |
$this->_helper->LoggerForException($ex);
|
| 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;
|
| 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);
|
| 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 |
+
|
| 111 |
+
$productImage = $product->getImage();
|
| 112 |
+
|
| 113 |
+
if($productImage == 'no_selection') {
|
| 114 |
+
$productImage = NULL;
|
| 115 |
+
}
|
| 116 |
+
else {
|
| 117 |
+
$productImage = $productMediaConfig->getMediaUrl($productImage);
|
| 118 |
+
}
|
| 119 |
+
|
| 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) {
|
| 132 |
$productsXML = new SimpleXMLElement('<products/>');
|
| 133 |
|
| 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);
|
| 163 |
$productXML -> addChild("image", htmlspecialchars($productImage, ENT_QUOTES));
|
| 164 |
}
|
| 165 |
|
app/code/community/Bubbleyes/BubblitPlugin/etc/system.xml
CHANGED
|
@@ -60,7 +60,7 @@
|
|
| 60 |
<frontend_type>select</frontend_type>
|
| 61 |
<source_model>bubbleyes_bubblitplugin/config_source_bubbllayout</source_model>
|
| 62 |
<sort_order>3</sort_order>
|
| 63 |
-
<show_in_default>
|
| 64 |
<show_in_website>0</show_in_website>
|
| 65 |
<show_in_store>0</show_in_store>
|
| 66 |
</bubbllayout>
|
| 60 |
<frontend_type>select</frontend_type>
|
| 61 |
<source_model>bubbleyes_bubblitplugin/config_source_bubbllayout</source_model>
|
| 62 |
<sort_order>3</sort_order>
|
| 63 |
+
<show_in_default>0</show_in_default>
|
| 64 |
<show_in_website>0</show_in_website>
|
| 65 |
<show_in_store>0</show_in_store>
|
| 66 |
</bubbllayout>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Bubbleyes_BubblitPlugin</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/bsd-license.php">BSDL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -11,9 +11,9 @@ 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-
|
| 15 |
-
<time>
|
| 16 |
-
<contents><target name="magecommunity"><dir><dir name="Bubbleyes"><dir name="BubblitPlugin"><dir name="Block"><file name="Button.php" hash="
|
| 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>1.3.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/bsd-license.php">BSDL</license>
|
| 7 |
<channel>community</channel>
|
| 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>
|
