Version Notes
Available for: EE 1.11.0.0, PE 1.11.0.0, CE 1.6.0.0
Download this release
Release Info
Developer | Magento Core Team |
Extension | Mage_GoogleShopping |
Version | 1.6.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.3.5 to 1.6.0.0
- app/code/core/Mage/GoogleShopping/Block/Adminhtml/Items/Item.php +0 -9
- app/code/core/Mage/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php +12 -1
- app/code/core/Mage/GoogleShopping/Helper/Category.php +76 -0
- app/code/core/Mage/GoogleShopping/Helper/Data.php +12 -2
- app/code/core/Mage/GoogleShopping/Helper/Price.php +1 -0
- app/code/core/Mage/GoogleShopping/Model/Attribute/Availability.php +54 -0
- app/code/core/Mage/GoogleShopping/Model/Attribute/Condition.php +1 -1
- app/code/core/Mage/GoogleShopping/Model/Attribute/ContentLanguage.php +1 -1
- app/code/core/Mage/GoogleShopping/Model/Attribute/Destinations.php +1 -1
- app/code/core/Mage/GoogleShopping/Model/Attribute/GoogleProductCategory.php +62 -0
- app/code/core/Mage/GoogleShopping/Model/Attribute/Id.php +1 -1
- app/code/core/Mage/GoogleShopping/Model/Attribute/Link.php +1 -1
- app/code/core/Mage/GoogleShopping/Model/Attribute/ProductType.php +68 -0
- app/code/core/Mage/GoogleShopping/Model/Attribute/Quantity.php +1 -1
- app/code/core/Mage/GoogleShopping/Model/Attribute/ShippingWeight.php +1 -1
- app/code/core/Mage/GoogleShopping/Model/Attribute/TargetCountry.php +1 -1
- app/code/core/Mage/GoogleShopping/Model/Attribute/Tax.php +1 -1
- app/code/core/Mage/GoogleShopping/Model/Config.php +29 -0
- app/code/core/Mage/GoogleShopping/Model/MassOperations.php +77 -37
- app/code/core/Mage/GoogleShopping/Model/Mysql4/Attribute.php +1 -5
- app/code/core/Mage/GoogleShopping/Model/Mysql4/Attribute/Collection.php +2 -96
- app/code/core/Mage/GoogleShopping/Model/Mysql4/Item.php +1 -36
- app/code/core/Mage/GoogleShopping/Model/Mysql4/Item/Collection.php +1 -97
- app/code/core/Mage/GoogleShopping/Model/Mysql4/Type.php +1 -26
- app/code/core/Mage/GoogleShopping/Model/Mysql4/Type/Collection.php +1 -61
- app/code/core/Mage/GoogleShopping/Model/Observer.php +4 -1
- app/code/core/Mage/GoogleShopping/Model/Resource/Attribute.php +40 -0
- app/code/core/Mage/GoogleShopping/Model/Resource/Attribute/Collection.php +131 -0
- app/code/core/Mage/GoogleShopping/Model/Resource/Item.php +71 -0
- app/code/core/Mage/GoogleShopping/Model/Resource/Item/Collection.php +136 -0
- app/code/core/Mage/GoogleShopping/Model/Resource/Type.php +61 -0
- app/code/core/Mage/GoogleShopping/Model/Resource/Type/Collection.php +96 -0
- app/code/core/Mage/GoogleShopping/Model/Service.php +10 -5
- app/code/core/Mage/GoogleShopping/controllers/Adminhtml/Googleshopping/TypesController.php +12 -4
- app/code/core/Mage/GoogleShopping/data/googleshopping_setup/data-install-1.6.0.0.php +83 -0
- app/code/core/Mage/GoogleShopping/etc/config.xml +38 -53
- app/code/core/Mage/GoogleShopping/etc/system.xml +9 -0
- app/code/core/Mage/GoogleShopping/sql/googleshopping_setup/install-1.6.0.0.php +178 -0
- app/code/core/Mage/GoogleShopping/sql/googleshopping_setup/mysql4-data-install-0.2.0.php +1 -1
- app/code/core/Mage/GoogleShopping/sql/googleshopping_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +272 -0
- app/code/core/Mage/GoogleShopping/sql/googleshopping_setup/upgrade-1.6.0.0-1.6.0.0.1.php +45 -0
- lib/Varien/Gdata/Gshopping/Content.php +85 -7
- lib/Varien/Gdata/Gshopping/Entry.php +6 -6
- lib/Varien/Gdata/Gshopping/Extension/Attribute.php +6 -6
- lib/Varien/Gdata/Gshopping/Extension/Control.php +6 -6
- lib/Varien/Gdata/Gshopping/Extension/Shipping.php +7 -6
- lib/Varien/Gdata/Gshopping/Extension/Tax.php +6 -6
- lib/Varien/Gdata/Gshopping/HttpException.php +6 -6
- lib/Varien/Gdata/Gshopping/ItemQuery.php +5 -5
- package.xml +7 -10
app/code/core/Mage/GoogleShopping/Block/Adminhtml/Items/Item.php
CHANGED
@@ -69,15 +69,6 @@ class Mage_GoogleShopping_Block_Adminhtml_Items_Item extends Mage_Adminhtml_Bloc
|
|
69 |
'index' => 'name',
|
70 |
));
|
71 |
|
72 |
-
$this->addColumn('gcontent_item_id',
|
73 |
-
array(
|
74 |
-
'header' => $this->__('Google Content ID'),
|
75 |
-
'width' => '150px',
|
76 |
-
'index' => 'gcontent_item_id',
|
77 |
-
'renderer' => 'googleshopping/adminhtml_items_renderer_id',
|
78 |
-
|
79 |
-
));
|
80 |
-
|
81 |
$this->addColumn('expires',
|
82 |
array(
|
83 |
'header' => $this->__('Expires'),
|
69 |
'index' => 'name',
|
70 |
));
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
$this->addColumn('expires',
|
73 |
array(
|
74 |
'header' => $this->__('Expires'),
|
app/code/core/Mage/GoogleShopping/Block/Adminhtml/Types/Edit/Form.php
CHANGED
@@ -65,7 +65,8 @@ class Mage_GoogleShopping_Block_Adminhtml_Types_Edit_Form extends Mage_Adminhtml
|
|
65 |
$countrySelect->setDisabled(true);
|
66 |
}
|
67 |
|
68 |
-
$attributeSetsSelect = $this->getAttributeSetsSelectElement($targetCountry)
|
|
|
69 |
if ($itemType->getAttributeSetId()) {
|
70 |
$attributeSetsSelect->setDisabled(true);
|
71 |
}
|
@@ -77,6 +78,16 @@ class Mage_GoogleShopping_Block_Adminhtml_Types_Edit_Form extends Mage_Adminhtml
|
|
77 |
'text' => '<div id="attribute_set_select">' . $attributeSetsSelect->toHtml() . '</div>',
|
78 |
));
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
$attributesBlock = $this->getLayout()
|
81 |
->createBlock('googleshopping/adminhtml_types_edit_attributes')
|
82 |
->setTargetCountry($targetCountry);
|
65 |
$countrySelect->setDisabled(true);
|
66 |
}
|
67 |
|
68 |
+
$attributeSetsSelect = $this->getAttributeSetsSelectElement($targetCountry)
|
69 |
+
->setValue($itemType->getAttributeSetId());
|
70 |
if ($itemType->getAttributeSetId()) {
|
71 |
$attributeSetsSelect->setDisabled(true);
|
72 |
}
|
78 |
'text' => '<div id="attribute_set_select">' . $attributeSetsSelect->toHtml() . '</div>',
|
79 |
));
|
80 |
|
81 |
+
$categories = Mage::helper('googleshopping/category')->getCategories();
|
82 |
+
$fieldset->addField('category', 'select', array(
|
83 |
+
'label' => $this->__('Google Product Category'),
|
84 |
+
'title' => $this->__('Google Product Category'),
|
85 |
+
'required' => true,
|
86 |
+
'name' => 'category',
|
87 |
+
'options' => array_combine($categories, array_map('htmlspecialchars_decode', $categories)),
|
88 |
+
'value' => $itemType->getCategory(),
|
89 |
+
));
|
90 |
+
|
91 |
$attributesBlock = $this->getLayout()
|
92 |
->createBlock('googleshopping/adminhtml_types_edit_attributes')
|
93 |
->setTargetCountry($targetCountry);
|
app/code/core/Mage/GoogleShopping/Helper/Category.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento Enterprise Edition
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Magento Enterprise Edition License
|
8 |
+
* that is bundled with this package in the file LICENSE_EE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://www.magentocommerce.com/license/enterprise-edition
|
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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://www.magentocommerce.com/license/enterprise-edition
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Google Product Category helper
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Helper_Category
|
35 |
+
{
|
36 |
+
const CATEGORY_APPAREL = 'Apparel & Accessories';
|
37 |
+
const CATEGORY_CLOTHING = 'Apparel & Accessories > Clothing';
|
38 |
+
const CATEGORY_SHOES = 'Apparel & Accessories > Shoes';
|
39 |
+
const CATEGORY_BOOKS = 'Media > Books';
|
40 |
+
const CATEGORY_DVDS = 'Media > DVDs & Videos';
|
41 |
+
const CATEGORY_MUSIC = 'Media > Music';
|
42 |
+
const CATEGORY_VGAME = 'Software > Video Game Software';
|
43 |
+
const CATEGORY_OTHER = 'Other';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Retrieve list of Google Product Categories
|
47 |
+
*
|
48 |
+
* @return array
|
49 |
+
*/
|
50 |
+
public function getCategories($addOther = true)
|
51 |
+
{
|
52 |
+
$categories = array(
|
53 |
+
self::CATEGORY_APPAREL, self::CATEGORY_CLOTHING, self::CATEGORY_SHOES, self::CATEGORY_BOOKS,
|
54 |
+
self::CATEGORY_DVDS, self::CATEGORY_MUSIC, self::CATEGORY_VGAME
|
55 |
+
);
|
56 |
+
if ($addOther) {
|
57 |
+
$categories[] = self::CATEGORY_OTHER;
|
58 |
+
}
|
59 |
+
return $categories;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Get error message for required attributes
|
64 |
+
*
|
65 |
+
* @return string
|
66 |
+
*/
|
67 |
+
public function getMessage()
|
68 |
+
{
|
69 |
+
return sprintf(
|
70 |
+
Mage::helper('googleshopping')->__("For information on Google's required attributes for different product categories, please see this link: %s"),
|
71 |
+
'<a href="http://www.google.com/support/merchants/bin/answer.py?answer=1344057" target="_blank">'
|
72 |
+
. 'http://www.google.com/support/merchants/bin/answer.py?answer=1344057'
|
73 |
+
. '</a>'
|
74 |
+
);
|
75 |
+
}
|
76 |
+
}
|
app/code/core/Mage/GoogleShopping/Helper/Data.php
CHANGED
@@ -57,7 +57,8 @@ class Mage_GoogleShopping_Helper_Data extends Mage_Core_Helper_Abstract
|
|
57 |
*/
|
58 |
public function cleanAtomAttribute($string)
|
59 |
{
|
60 |
-
return Mage::helper('core/string')
|
|
|
61 |
}
|
62 |
|
63 |
/**
|
@@ -77,13 +78,22 @@ class Mage_GoogleShopping_Helper_Data extends Mage_Core_Helper_Abstract
|
|
77 |
* Parse Exception Response Body
|
78 |
*
|
79 |
* @param string $message Exception message to parse
|
|
|
80 |
* @return string
|
81 |
*/
|
82 |
-
public function parseGdataExceptionMessage($message)
|
83 |
{
|
84 |
$result = array();
|
85 |
foreach (explode("\n", $message) as $row) {
|
|
|
|
|
|
|
|
|
86 |
if (strip_tags($row) == $row) {
|
|
|
|
|
|
|
|
|
87 |
$result[] = $row;
|
88 |
continue;
|
89 |
}
|
57 |
*/
|
58 |
public function cleanAtomAttribute($string)
|
59 |
{
|
60 |
+
return Mage::helper('core/string')
|
61 |
+
->substr(preg_replace('/[\pC¢€•—™°½]|shipping/ui', '', $string), 0, 3500);
|
62 |
}
|
63 |
|
64 |
/**
|
78 |
* Parse Exception Response Body
|
79 |
*
|
80 |
* @param string $message Exception message to parse
|
81 |
+
* @param null|Mage_Catalog_Model_Product $product
|
82 |
* @return string
|
83 |
*/
|
84 |
+
public function parseGdataExceptionMessage($message, $product = null)
|
85 |
{
|
86 |
$result = array();
|
87 |
foreach (explode("\n", $message) as $row) {
|
88 |
+
if (trim($row) == '') {
|
89 |
+
continue;
|
90 |
+
}
|
91 |
+
|
92 |
if (strip_tags($row) == $row) {
|
93 |
+
$row = preg_replace('/@ (.*)/', $this->__("See '\\1'"), $row);
|
94 |
+
if (!is_null($product)) {
|
95 |
+
$row .= ' ' . $this->__("for product '%s' (in '%s' store)", $product->getName(), Mage::app()->getStore($product->getStoreId())->getName());
|
96 |
+
}
|
97 |
$result[] = $row;
|
98 |
continue;
|
99 |
}
|
app/code/core/Mage/GoogleShopping/Helper/Price.php
CHANGED
@@ -32,6 +32,7 @@
|
|
32 |
*
|
33 |
* @category Mage
|
34 |
* @package Mage_GoogleShopping
|
|
|
35 |
*/
|
36 |
class Mage_GoogleShopping_Helper_Price
|
37 |
{
|
32 |
*
|
33 |
* @category Mage
|
34 |
* @package Mage_GoogleShopping
|
35 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
36 |
*/
|
37 |
class Mage_GoogleShopping_Helper_Price
|
38 |
{
|
app/code/core/Mage/GoogleShopping/Model/Attribute/Availability.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Availability attribute model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Model_Attribute_Availability extends Mage_GoogleShopping_Model_Attribute_Default
|
35 |
+
{
|
36 |
+
protected $_googleAvailabilityMap = array(
|
37 |
+
0 => 'out of stock',
|
38 |
+
1 => 'in stock'
|
39 |
+
);
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Set current attribute to entry (for specified product)
|
43 |
+
*
|
44 |
+
* @param Mage_Catalog_Model_Product $product
|
45 |
+
* @param Varien_Gdata_Gshopping_Entry $entry
|
46 |
+
* @return Varien_Gdata_Gshopping_Entry
|
47 |
+
*/
|
48 |
+
public function convertAttribute($product, $entry)
|
49 |
+
{
|
50 |
+
$value = $this->_googleAvailabilityMap[(int)$product->isSalable()];
|
51 |
+
$this->_setAttribute($entry, 'availability', self::ATTRIBUTE_TYPE_TEXT, $value);
|
52 |
+
return $entry;
|
53 |
+
}
|
54 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/Condition.php
CHANGED
@@ -64,4 +64,4 @@ class Mage_GoogleShopping_Model_Attribute_Condition extends Mage_GoogleShopping_
|
|
64 |
|
65 |
return $this->_setAttribute($entry, 'condition', self::ATTRIBUTE_TYPE_TEXT, $condition);
|
66 |
}
|
67 |
-
}
|
64 |
|
65 |
return $this->_setAttribute($entry, 'condition', self::ATTRIBUTE_TYPE_TEXT, $condition);
|
66 |
}
|
67 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/ContentLanguage.php
CHANGED
@@ -48,4 +48,4 @@ class Mage_GoogleShopping_Model_Attribute_ContentLanguage extends Mage_GoogleSho
|
|
48 |
|
49 |
return $this->_setAttribute($entry, 'content_language', self::ATTRIBUTE_TYPE_TEXT, $value);
|
50 |
}
|
51 |
-
}
|
48 |
|
49 |
return $this->_setAttribute($entry, 'content_language', self::ATTRIBUTE_TYPE_TEXT, $value);
|
50 |
}
|
51 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/Destinations.php
CHANGED
@@ -48,4 +48,4 @@ class Mage_GoogleShopping_Model_Attribute_Destinations extends Mage_GoogleShoppi
|
|
48 |
|
49 |
return $entry;
|
50 |
}
|
51 |
-
}
|
48 |
|
49 |
return $entry;
|
50 |
}
|
51 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/GoogleProductCategory.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* GoogleProductCategory attribute model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Model_Attribute_GoogleProductCategory extends Mage_GoogleShopping_Model_Attribute_Default
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Set current attribute to entry (for specified product)
|
38 |
+
*
|
39 |
+
* @param Mage_Catalog_Model_Product $product
|
40 |
+
* @param Varien_Gdata_Gshopping_Entry $entry
|
41 |
+
* @return Varien_Gdata_Gshopping_Entry
|
42 |
+
*/
|
43 |
+
public function convertAttribute($product, $entry)
|
44 |
+
{
|
45 |
+
$targetCountry = Mage::getSingleton('googleshopping/config')
|
46 |
+
->getTargetCountry($product->getStoreId());
|
47 |
+
$value = Mage::getModel('googleshopping/type')
|
48 |
+
->loadByAttributeSetId($product->getAttributeSetId(), $targetCountry);
|
49 |
+
|
50 |
+
$val = ($value->getCategory() == Mage_GoogleShopping_Helper_Category::CATEGORY_OTHER)
|
51 |
+
? ''
|
52 |
+
: $value->getCategory();
|
53 |
+
|
54 |
+
$this->_setAttribute(
|
55 |
+
$entry,
|
56 |
+
'google_product_category',
|
57 |
+
self::ATTRIBUTE_TYPE_TEXT,
|
58 |
+
htmlspecialchars_decode($val, ENT_NOQUOTES)
|
59 |
+
);
|
60 |
+
return $entry;
|
61 |
+
}
|
62 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/Id.php
CHANGED
@@ -45,4 +45,4 @@ class Mage_GoogleShopping_Model_Attribute_Id extends Mage_GoogleShopping_Model_A
|
|
45 |
$value = Mage::helper('googleshopping')->buildContentProductId($product->getId(), $product->getStoreId());
|
46 |
return $this->_setAttribute($entry, 'id', self::ATTRIBUTE_TYPE_TEXT, $value);
|
47 |
}
|
48 |
-
}
|
45 |
$value = Mage::helper('googleshopping')->buildContentProductId($product->getId(), $product->getStoreId());
|
46 |
return $this->_setAttribute($entry, 'id', self::ATTRIBUTE_TYPE_TEXT, $value);
|
47 |
}
|
48 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/Link.php
CHANGED
@@ -71,4 +71,4 @@ class Mage_GoogleShopping_Model_Attribute_Link extends Mage_GoogleShopping_Model
|
|
71 |
|
72 |
return $entry;
|
73 |
}
|
74 |
-
}
|
71 |
|
72 |
return $entry;
|
73 |
}
|
74 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/ProductType.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* ProductType attribute model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Model_Attribute_ProductType extends Mage_GoogleShopping_Model_Attribute_Default
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Set current attribute to entry (for specified product)
|
38 |
+
*
|
39 |
+
* @param Mage_Catalog_Model_Product $product
|
40 |
+
* @param Varien_Gdata_Gshopping_Entry $entry
|
41 |
+
* @return Varien_Gdata_Gshopping_Entry
|
42 |
+
*/
|
43 |
+
public function convertAttribute($product, $entry)
|
44 |
+
{
|
45 |
+
|
46 |
+
$productCategories = $product->getCategoryIds();
|
47 |
+
|
48 |
+
// TODO: set Default value for product_type attribute if product isn't assigned for any category
|
49 |
+
$value = 'Shop';
|
50 |
+
|
51 |
+
if (!empty($productCategories)) {
|
52 |
+
$category = Mage::getModel('catalog/category')->load(
|
53 |
+
array_shift($productCategories)
|
54 |
+
);
|
55 |
+
|
56 |
+
$breadcrumbs = array();
|
57 |
+
|
58 |
+
foreach ($category->getParentCategories() as $cat) {
|
59 |
+
$breadcrumbs[] = $cat->getName();
|
60 |
+
}
|
61 |
+
|
62 |
+
$value = implode(' > ', $breadcrumbs);
|
63 |
+
}
|
64 |
+
|
65 |
+
$this->_setAttribute($entry, 'product_type', self::ATTRIBUTE_TYPE_TEXT, $value);
|
66 |
+
return $entry;
|
67 |
+
}
|
68 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/Quantity.php
CHANGED
@@ -50,4 +50,4 @@ class Mage_GoogleShopping_Model_Attribute_Quantity extends Mage_GoogleShopping_M
|
|
50 |
|
51 |
return $entry;
|
52 |
}
|
53 |
-
}
|
50 |
|
51 |
return $entry;
|
52 |
}
|
53 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/ShippingWeight.php
CHANGED
@@ -61,4 +61,4 @@ class Mage_GoogleShopping_Model_Attribute_ShippingWeight extends Mage_GoogleShop
|
|
61 |
|
62 |
return $entry;
|
63 |
}
|
64 |
-
}
|
61 |
|
62 |
return $entry;
|
63 |
}
|
64 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/TargetCountry.php
CHANGED
@@ -46,4 +46,4 @@ class Mage_GoogleShopping_Model_Attribute_TargetCountry extends Mage_GoogleShopp
|
|
46 |
->getTargetCountry($product->getStoreId());
|
47 |
return $this->_setAttribute($entry, 'target_country', self::ATTRIBUTE_TYPE_TEXT, $value);
|
48 |
}
|
49 |
-
}
|
46 |
->getTargetCountry($product->getStoreId());
|
47 |
return $this->_setAttribute($entry, 'target_country', self::ATTRIBUTE_TYPE_TEXT, $value);
|
48 |
}
|
49 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Attribute/Tax.php
CHANGED
@@ -63,4 +63,4 @@ class Mage_GoogleShopping_Model_Attribute_Tax extends Mage_GoogleShopping_Model_
|
|
63 |
|
64 |
return $entry;
|
65 |
}
|
66 |
-
}
|
63 |
|
64 |
return $entry;
|
65 |
}
|
66 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Config.php
CHANGED
@@ -247,4 +247,33 @@ class Mage_GoogleShopping_Model_Config extends Varien_Object
|
|
247 |
return array_keys($this->getConfigData('base_attributes'));
|
248 |
}
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
247 |
return array_keys($this->getConfigData('base_attributes'));
|
248 |
}
|
249 |
|
250 |
+
/**
|
251 |
+
* Check whether debug mode is enabled
|
252 |
+
*
|
253 |
+
* @param int $storeId
|
254 |
+
* @return bool
|
255 |
+
*/
|
256 |
+
public function getIsDebug($storeId)
|
257 |
+
{
|
258 |
+
return (bool)$this->getConfigData('debug', $storeId);
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Returns all required attributes
|
263 |
+
*
|
264 |
+
* @return array
|
265 |
+
*/
|
266 |
+
public function getRequiredAttributes()
|
267 |
+
{
|
268 |
+
$requiredAttributes = array();
|
269 |
+
foreach ($this->getAttributes() as $group => $attributes) {
|
270 |
+
foreach ($attributes as $attributeName => $attribute) {
|
271 |
+
if ($attribute['required']) {
|
272 |
+
$requiredAttributes[$attributeName] = $attribute;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
return $requiredAttributes;
|
278 |
+
}
|
279 |
}
|
app/code/core/Mage/GoogleShopping/Model/MassOperations.php
CHANGED
@@ -40,6 +40,13 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
40 |
*/
|
41 |
const ERROR_CODE_SQL_UNIQUE_INDEX = 23000;
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* Add product to Google Content.
|
45 |
*
|
@@ -70,27 +77,31 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
70 |
$this->_getSession()->addError(Mage::helper('googleshopping')->__($e->getMessage()));
|
71 |
throw $e;
|
72 |
} catch (Zend_Gdata_App_Exception $e) {
|
73 |
-
$this->
|
74 |
-
|
75 |
-
|
|
|
76 |
} catch (Zend_Db_Statement_Exception $e) {
|
77 |
if ($e->getCode() == self::ERROR_CODE_SQL_UNIQUE_INDEX) {
|
78 |
-
$this->_getSession()->addError(
|
79 |
-
"The Google Content item for product '%s' (in '%s' store) has already exist.",
|
80 |
-
|
81 |
-
|
|
|
82 |
);
|
83 |
} else {
|
84 |
-
$this->_getSession()->addError(
|
85 |
}
|
86 |
} catch (Exception $e) {
|
87 |
Mage::logException($e);
|
88 |
-
$this->_getSession()->addError(
|
89 |
-
'The product "%s" hasn\'t been added to Google Content.',
|
90 |
-
|
91 |
-
));
|
92 |
}
|
93 |
}
|
|
|
|
|
|
|
94 |
}
|
95 |
|
96 |
if ($totalAdded > 0) {
|
@@ -98,7 +109,9 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
98 |
Mage::helper('googleshopping')->__('Total of %d product(s) have been added to Google Content.', $totalAdded)
|
99 |
);
|
100 |
} elseif (is_null($productIds)) {
|
101 |
-
$this->_getSession()->addError(
|
|
|
|
|
102 |
} else {
|
103 |
$this->_getSession()->addError(Mage::helper('googleshopping')->__('No products were added to Google Content'));
|
104 |
}
|
@@ -109,7 +122,7 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
109 |
/**
|
110 |
* Update Google Content items.
|
111 |
*
|
112 |
-
* @param array|
|
113 |
* @throws Zend_Gdata_App_CaptchaRequiredException
|
114 |
* @return Mage_GoogleShopping_Model_MassOperations
|
115 |
*/
|
@@ -120,7 +133,11 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
120 |
$totalFailed = 0;
|
121 |
|
122 |
$itemsCollection = $this->_getItemsCollection($items);
|
|
|
123 |
if ($itemsCollection) {
|
|
|
|
|
|
|
124 |
foreach ($itemsCollection as $item) {
|
125 |
try {
|
126 |
$item->updateItem();
|
@@ -132,29 +149,34 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
132 |
$item->delete();
|
133 |
$totalDeleted++;
|
134 |
} else {
|
135 |
-
$this->
|
136 |
-
|
137 |
-
|
|
|
|
|
138 |
$totalFailed++;
|
139 |
}
|
140 |
} catch (Zend_Gdata_App_CaptchaRequiredException $e) {
|
141 |
// Google requires CAPTCHA for login
|
142 |
-
$this->_getSession()->addError(
|
143 |
throw $e;
|
144 |
} catch (Zend_Gdata_App_Exception $e) {
|
145 |
-
$this->
|
146 |
-
|
147 |
-
|
|
|
|
|
148 |
$totalFailed++;
|
149 |
} catch (Exception $e) {
|
150 |
Mage::logException($e);
|
151 |
-
$this->_getSession()->addError(
|
152 |
-
'The item "%s" hasn\'t been updated.',
|
153 |
-
|
154 |
-
));
|
155 |
$totalFailed++;
|
156 |
}
|
157 |
}
|
|
|
|
|
158 |
}
|
159 |
|
160 |
$this->_getSession()->addSuccess(
|
@@ -170,7 +192,7 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
170 |
/**
|
171 |
* Remove Google Content items.
|
172 |
*
|
173 |
-
* @param array|
|
174 |
* @throws Zend_Gdata_App_CaptchaRequiredException
|
175 |
* @return Mage_GoogleShopping_Model_MassOperations
|
176 |
*/
|
@@ -179,6 +201,9 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
179 |
$totalDeleted = 0;
|
180 |
$itemsCollection = $this->_getItemsCollection($items);
|
181 |
if ($itemsCollection) {
|
|
|
|
|
|
|
182 |
foreach ($itemsCollection as $item) {
|
183 |
try {
|
184 |
$item->deleteItem()->delete();
|
@@ -186,21 +211,25 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
186 |
$totalDeleted++;
|
187 |
} catch (Zend_Gdata_App_CaptchaRequiredException $e) {
|
188 |
// Google requires CAPTCHA for login
|
189 |
-
$this->_getSession()->addError(
|
190 |
throw $e;
|
191 |
} catch (Zend_Gdata_App_Exception $e) {
|
192 |
-
$this->
|
193 |
-
|
194 |
-
|
|
|
|
|
195 |
} catch (Exception $e) {
|
196 |
Mage::logException($e);
|
197 |
-
$this->_getSession()->addError(
|
198 |
-
'The item "%s" hasn\'t been deleted.',
|
199 |
-
|
200 |
-
));
|
201 |
}
|
202 |
}
|
|
|
|
|
203 |
}
|
|
|
204 |
if ($totalDeleted > 0) {
|
205 |
$this->_getSession()->addSuccess(
|
206 |
Mage::helper('googleshopping')->__('Total of %d items(s) have been removed from Google Content.', $totalDeleted)
|
@@ -215,14 +244,14 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
215 |
/**
|
216 |
* Return items collection by IDs
|
217 |
*
|
218 |
-
* @param array|
|
219 |
* @throws Mage_Core_Exception
|
220 |
-
* @return null|
|
221 |
*/
|
222 |
protected function _getItemsCollection($items)
|
223 |
{
|
224 |
$itemsCollection = null;
|
225 |
-
if ($items instanceof
|
226 |
$itemsCollection = $items;
|
227 |
} else if (is_array($items)) {
|
228 |
$itemsCollection = Mage::getResourceModel('googleshopping/item_collection')
|
@@ -241,4 +270,15 @@ class Mage_GoogleShopping_Model_MassOperations
|
|
241 |
{
|
242 |
return Mage::getSingleton('adminhtml/session');
|
243 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
}
|
40 |
*/
|
41 |
const ERROR_CODE_SQL_UNIQUE_INDEX = 23000;
|
42 |
|
43 |
+
/**
|
44 |
+
* Whether general error information were added
|
45 |
+
*
|
46 |
+
* @var bool
|
47 |
+
*/
|
48 |
+
protected $_hasError = false;
|
49 |
+
|
50 |
/**
|
51 |
* Add product to Google Content.
|
52 |
*
|
77 |
$this->_getSession()->addError(Mage::helper('googleshopping')->__($e->getMessage()));
|
78 |
throw $e;
|
79 |
} catch (Zend_Gdata_App_Exception $e) {
|
80 |
+
$this->_addGeneralError();
|
81 |
+
$this->_getSession()->addError(
|
82 |
+
Mage::helper('googleshopping')->parseGdataExceptionMessage($e->getMessage(), $product)
|
83 |
+
);
|
84 |
} catch (Zend_Db_Statement_Exception $e) {
|
85 |
if ($e->getCode() == self::ERROR_CODE_SQL_UNIQUE_INDEX) {
|
86 |
+
$this->_getSession()->addError(
|
87 |
+
Mage::helper('googleshopping')->__("The Google Content item for product '%s' (in '%s' store) has already exist.",
|
88 |
+
$product->getName(),
|
89 |
+
Mage::app()->getStore($product->getStoreId())->getName()
|
90 |
+
)
|
91 |
);
|
92 |
} else {
|
93 |
+
$this->_getSession()->addError($e->getMessage());
|
94 |
}
|
95 |
} catch (Exception $e) {
|
96 |
Mage::logException($e);
|
97 |
+
$this->_getSession()->addError(
|
98 |
+
Mage::helper('googleshopping')->__('The product "%s" hasn\'t been added to Google Content.', $product->getName())
|
99 |
+
);
|
|
|
100 |
}
|
101 |
}
|
102 |
+
if (empty($productIds)) {
|
103 |
+
return $this;
|
104 |
+
}
|
105 |
}
|
106 |
|
107 |
if ($totalAdded > 0) {
|
109 |
Mage::helper('googleshopping')->__('Total of %d product(s) have been added to Google Content.', $totalAdded)
|
110 |
);
|
111 |
} elseif (is_null($productIds)) {
|
112 |
+
$this->_getSession()->addError(
|
113 |
+
Mage::helper('googleshopping')->__('Session expired during export. Please revise exported products and repeat the process if necessary.')
|
114 |
+
);
|
115 |
} else {
|
116 |
$this->_getSession()->addError(Mage::helper('googleshopping')->__('No products were added to Google Content'));
|
117 |
}
|
122 |
/**
|
123 |
* Update Google Content items.
|
124 |
*
|
125 |
+
* @param array|Mage_GoogleShopping_Model_Resource_Item_Collection $items
|
126 |
* @throws Zend_Gdata_App_CaptchaRequiredException
|
127 |
* @return Mage_GoogleShopping_Model_MassOperations
|
128 |
*/
|
133 |
$totalFailed = 0;
|
134 |
|
135 |
$itemsCollection = $this->_getItemsCollection($items);
|
136 |
+
|
137 |
if ($itemsCollection) {
|
138 |
+
if (count($itemsCollection) < 1) {
|
139 |
+
return $this;
|
140 |
+
}
|
141 |
foreach ($itemsCollection as $item) {
|
142 |
try {
|
143 |
$item->updateItem();
|
149 |
$item->delete();
|
150 |
$totalDeleted++;
|
151 |
} else {
|
152 |
+
$this->_addGeneralError();
|
153 |
+
$this->_getSession()->addError(
|
154 |
+
Mage::helper('googleshopping')
|
155 |
+
->parseGdataExceptionMessage($e->getMessage(), $item->getProduct())
|
156 |
+
);
|
157 |
$totalFailed++;
|
158 |
}
|
159 |
} catch (Zend_Gdata_App_CaptchaRequiredException $e) {
|
160 |
// Google requires CAPTCHA for login
|
161 |
+
$this->_getSession()->addError($e->getMessage());
|
162 |
throw $e;
|
163 |
} catch (Zend_Gdata_App_Exception $e) {
|
164 |
+
$this->_addGeneralError();
|
165 |
+
$this->_getSession()->addError(
|
166 |
+
Mage::helper('googleshopping')
|
167 |
+
->parseGdataExceptionMessage($e->getMessage(), $item->getProduct())
|
168 |
+
);
|
169 |
$totalFailed++;
|
170 |
} catch (Exception $e) {
|
171 |
Mage::logException($e);
|
172 |
+
$this->_getSession()->addError(
|
173 |
+
Mage::helper('googleshopping')->__('The item "%s" hasn\'t been updated.', $item->getProduct()->getName())
|
174 |
+
);
|
|
|
175 |
$totalFailed++;
|
176 |
}
|
177 |
}
|
178 |
+
} else {
|
179 |
+
return $this;
|
180 |
}
|
181 |
|
182 |
$this->_getSession()->addSuccess(
|
192 |
/**
|
193 |
* Remove Google Content items.
|
194 |
*
|
195 |
+
* @param array|Mage_GoogleShopping_Model_Resource_Item_Collection $items
|
196 |
* @throws Zend_Gdata_App_CaptchaRequiredException
|
197 |
* @return Mage_GoogleShopping_Model_MassOperations
|
198 |
*/
|
201 |
$totalDeleted = 0;
|
202 |
$itemsCollection = $this->_getItemsCollection($items);
|
203 |
if ($itemsCollection) {
|
204 |
+
if (count($itemsCollection) < 1) {
|
205 |
+
return $this;
|
206 |
+
}
|
207 |
foreach ($itemsCollection as $item) {
|
208 |
try {
|
209 |
$item->deleteItem()->delete();
|
211 |
$totalDeleted++;
|
212 |
} catch (Zend_Gdata_App_CaptchaRequiredException $e) {
|
213 |
// Google requires CAPTCHA for login
|
214 |
+
$this->_getSession()->addError($e->getMessage());
|
215 |
throw $e;
|
216 |
} catch (Zend_Gdata_App_Exception $e) {
|
217 |
+
$this->_addGeneralError();
|
218 |
+
$this->_getSession()->addError(
|
219 |
+
Mage::helper('googleshopping')
|
220 |
+
->parseGdataExceptionMessage($e->getMessage(), $item->getProduct())
|
221 |
+
);
|
222 |
} catch (Exception $e) {
|
223 |
Mage::logException($e);
|
224 |
+
$this->_getSession()->addError(
|
225 |
+
Mage::helper('googleshopping')->__('The item "%s" hasn\'t been deleted.', $item->getProduct()->getName())
|
226 |
+
);
|
|
|
227 |
}
|
228 |
}
|
229 |
+
} else {
|
230 |
+
return $this;
|
231 |
}
|
232 |
+
|
233 |
if ($totalDeleted > 0) {
|
234 |
$this->_getSession()->addSuccess(
|
235 |
Mage::helper('googleshopping')->__('Total of %d items(s) have been removed from Google Content.', $totalDeleted)
|
244 |
/**
|
245 |
* Return items collection by IDs
|
246 |
*
|
247 |
+
* @param array|Mage_GoogleShopping_Model_Resource_Item_Collection $items
|
248 |
* @throws Mage_Core_Exception
|
249 |
+
* @return null|Mage_GoogleShopping_Model_Resource_Item_Collection
|
250 |
*/
|
251 |
protected function _getItemsCollection($items)
|
252 |
{
|
253 |
$itemsCollection = null;
|
254 |
+
if ($items instanceof Mage_GoogleShopping_Model_Resource_Item_Collection) {
|
255 |
$itemsCollection = $items;
|
256 |
} else if (is_array($items)) {
|
257 |
$itemsCollection = Mage::getResourceModel('googleshopping/item_collection')
|
270 |
{
|
271 |
return Mage::getSingleton('adminhtml/session');
|
272 |
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Provides general error information
|
276 |
+
*/
|
277 |
+
protected function _addGeneralError()
|
278 |
+
{
|
279 |
+
if (!$this->_hasError) {
|
280 |
+
$this->_getSession()->addError(Mage::helper('googleshopping/category')->getMessage());
|
281 |
+
$this->_hasError = true;
|
282 |
+
}
|
283 |
+
}
|
284 |
}
|
app/code/core/Mage/GoogleShopping/Model/Mysql4/Attribute.php
CHANGED
@@ -31,10 +31,6 @@
|
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_GoogleShopping_Model_Mysql4_Attribute extends
|
35 |
{
|
36 |
-
protected function _construct()
|
37 |
-
{
|
38 |
-
$this->_init('googleshopping/attributes', 'id');
|
39 |
-
}
|
40 |
}
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_GoogleShopping_Model_Mysql4_Attribute extends Mage_GoogleShopping_Model_Resource_Attribute
|
35 |
{
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/GoogleShopping/Model/Mysql4/Attribute/Collection.php
CHANGED
@@ -31,101 +31,7 @@
|
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
|
|
35 |
{
|
36 |
-
/**
|
37 |
-
* Whether to join attribute_set_id to attributes or not
|
38 |
-
*
|
39 |
-
* @var bool
|
40 |
-
*/
|
41 |
-
protected $_joinAttributeSetFlag = true;
|
42 |
-
|
43 |
-
protected function _construct()
|
44 |
-
{
|
45 |
-
$this->_init('googleshopping/attribute');
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Add attribute set filter
|
50 |
-
*
|
51 |
-
* @param int $attributeSetId
|
52 |
-
* @param string $targetCountry two words ISO format
|
53 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
54 |
-
*/
|
55 |
-
public function addAttributeSetFilter($attributeSetId, $targetCountry)
|
56 |
-
{
|
57 |
-
if (!$this->getJoinAttributeSetFlag()) {
|
58 |
-
return $this;
|
59 |
-
}
|
60 |
-
$this->getSelect()->where('attribute_set_id = ?', $attributeSetId);
|
61 |
-
$this->getSelect()->where('target_country = ?', $targetCountry);
|
62 |
-
return $this;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Add type filter
|
67 |
-
*
|
68 |
-
* @param int $type_id
|
69 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
70 |
-
*/
|
71 |
-
public function addTypeFilter($type_id)
|
72 |
-
{
|
73 |
-
$this->getSelect()->where('main_table.type_id = ?', $type_id);
|
74 |
-
return $this;
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Load collection data
|
79 |
-
*
|
80 |
-
* @param bool $printQuery
|
81 |
-
* @param bool $logQuery
|
82 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
83 |
-
*/
|
84 |
-
public function load($printQuery = false, $logQuery = false)
|
85 |
-
{
|
86 |
-
if ($this->isLoaded()) {
|
87 |
-
return $this;
|
88 |
-
}
|
89 |
-
if ($this->getJoinAttributeSetFlag()) {
|
90 |
-
$this->_joinAttributeSet();
|
91 |
-
}
|
92 |
-
parent::load($printQuery, $logQuery);
|
93 |
-
return $this;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Join attribute sets data to select
|
98 |
-
*
|
99 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
100 |
-
*/
|
101 |
-
protected function _joinAttributeSet()
|
102 |
-
{
|
103 |
-
$this->getSelect()
|
104 |
-
->joinInner(
|
105 |
-
array('types'=>$this->getTable('googleshopping/types')),
|
106 |
-
'main_table.type_id=types.type_id',
|
107 |
-
array('attribute_set_id' => 'types.attribute_set_id', 'target_country' => 'types.target_country'));
|
108 |
-
return $this;
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Get flag - whether to join attribute_set_id to attributes or not
|
113 |
-
*
|
114 |
-
* @return bool
|
115 |
-
*/
|
116 |
-
public function getJoinAttributeSetFlag()
|
117 |
-
{
|
118 |
-
return $this->_joinAttributeSetFlag;
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Set flag - whether to join attribute_set_id to attributes or not
|
123 |
-
*
|
124 |
-
* @param bool $flag
|
125 |
-
* @return bool
|
126 |
-
*/
|
127 |
-
public function setJoinAttributeSetFlag($flag)
|
128 |
-
{
|
129 |
-
return $this->_joinAttributeSetFlag = (bool)$flag;
|
130 |
-
}
|
131 |
}
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
35 |
+
extends Mage_GoogleShopping_Model_Resource_Attribute_Collection
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
app/code/core/Mage/GoogleShopping/Model/Mysql4/Item.php
CHANGED
@@ -31,41 +31,6 @@
|
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_GoogleShopping_Model_Mysql4_Item extends
|
35 |
{
|
36 |
-
protected function _construct()
|
37 |
-
{
|
38 |
-
$this->_init('googleshopping/items', 'item_id');
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Load Item model by product
|
43 |
-
*
|
44 |
-
* @param Mage_GoogleShopping_Model_Item $model
|
45 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Item
|
46 |
-
*/
|
47 |
-
public function loadByProduct($model)
|
48 |
-
{
|
49 |
-
if (!($model->getProduct() instanceof Varien_Object)) {
|
50 |
-
return $this;
|
51 |
-
}
|
52 |
-
|
53 |
-
$product = $model->getProduct();
|
54 |
-
$productId = $product->getId();
|
55 |
-
$storeId = $model->getStoreId() ? $model->getStoreId() : $product->getStoreId();
|
56 |
-
|
57 |
-
$read = $this->_getReadAdapter();
|
58 |
-
$select = $read->select();
|
59 |
-
|
60 |
-
if ($productId !== null) {
|
61 |
-
$select->from($this->getMainTable())
|
62 |
-
->where("product_id = ?", $productId)
|
63 |
-
->where('store_id = ?', (int)$storeId);
|
64 |
-
|
65 |
-
$data = $read->fetchRow($select);
|
66 |
-
$data = is_array($data) ? $data : array();
|
67 |
-
$model->addData($data);
|
68 |
-
}
|
69 |
-
return $this;
|
70 |
-
}
|
71 |
}
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_GoogleShopping_Model_Mysql4_Item extends Mage_GoogleShopping_Model_Resource_Item
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/GoogleShopping/Model/Mysql4/Item/Collection.php
CHANGED
@@ -31,102 +31,6 @@
|
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_GoogleShopping_Model_Mysql4_Item_Collection extends
|
35 |
{
|
36 |
-
protected function _construct()
|
37 |
-
{
|
38 |
-
$this->_init('googleshopping/item');
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Init collection select
|
43 |
-
*
|
44 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
45 |
-
*/
|
46 |
-
protected function _initSelect()
|
47 |
-
{
|
48 |
-
parent::_initSelect();
|
49 |
-
$this->_joinTables();
|
50 |
-
return $this;
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Filter collection by specified store ids
|
55 |
-
*
|
56 |
-
* @param array|int $storeIds
|
57 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
58 |
-
*/
|
59 |
-
public function addStoreFilter($storeIds)
|
60 |
-
{
|
61 |
-
$this->getSelect()->where('main_table.store_id IN (?)', $storeIds);
|
62 |
-
return $this;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Filter collection by specified product id
|
67 |
-
*
|
68 |
-
* @param int $productId
|
69 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
70 |
-
*/
|
71 |
-
public function addProductFilterId($productId)
|
72 |
-
{
|
73 |
-
$this->getSelect()->where('main_table.product_id=?', $productId);
|
74 |
-
return $this;
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Add field filter to collection
|
79 |
-
*
|
80 |
-
* @see self::_getConditionSql for $condition
|
81 |
-
* @param string $field
|
82 |
-
* @param null|string|array $condition
|
83 |
-
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
84 |
-
*/
|
85 |
-
public function addFieldToFilter($field, $condition=null)
|
86 |
-
{
|
87 |
-
if ($field == 'name') {
|
88 |
-
$conditionSql = $this->_getConditionSql('IFNULL(p.value, p_d.value)', $condition);
|
89 |
-
$this->getSelect()->where($conditionSql, null, Varien_Db_Select::TYPE_CONDITION);
|
90 |
-
return $this;
|
91 |
-
} else {
|
92 |
-
return parent::addFieldToFilter($field, $condition);
|
93 |
-
}
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Join product and type data
|
98 |
-
*
|
99 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
100 |
-
*/
|
101 |
-
protected function _joinTables()
|
102 |
-
{
|
103 |
-
$entityType = Mage::getSingleton('eav/config')->getEntityType('catalog_product');
|
104 |
-
$attribute = Mage::getSingleton('eav/config')->getAttribute($entityType->getEntityTypeId(),'name');
|
105 |
-
|
106 |
-
$joinConditionDefault = sprintf("p_d.attribute_id=%d AND p_d.store_id='0' AND main_table.product_id=p_d.entity_id",
|
107 |
-
$attribute->getAttributeId()
|
108 |
-
);
|
109 |
-
$joinCondition = sprintf("p.attribute_id=%d AND p.store_id=main_table.store_id AND main_table.product_id=p.entity_id",
|
110 |
-
$attribute->getAttributeId()
|
111 |
-
);
|
112 |
-
|
113 |
-
$this->getSelect()
|
114 |
-
->joinLeft(
|
115 |
-
array('p_d' => $attribute->getBackend()->getTable()),
|
116 |
-
$joinConditionDefault,
|
117 |
-
array());
|
118 |
-
|
119 |
-
$this->getSelect()
|
120 |
-
->joinLeft(
|
121 |
-
array('p' => $attribute->getBackend()->getTable()),
|
122 |
-
$joinCondition,
|
123 |
-
array('name' => new Zend_Db_Expr('IFNULL(p.value, p_d.value)')));
|
124 |
-
|
125 |
-
$this->getSelect()
|
126 |
-
->joinLeft(
|
127 |
-
array('types' => $this->getTable('googleshopping/types')),
|
128 |
-
'main_table.type_id=types.type_id');
|
129 |
-
|
130 |
-
return $this;
|
131 |
-
}
|
132 |
}
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_GoogleShopping_Model_Mysql4_Item_Collection extends Mage_GoogleShopping_Model_Resource_Item_Collection
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/GoogleShopping/Model/Mysql4/Type.php
CHANGED
@@ -31,31 +31,6 @@
|
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_GoogleShopping_Model_Mysql4_Type extends
|
35 |
{
|
36 |
-
protected function _construct()
|
37 |
-
{
|
38 |
-
$this->_init('googleshopping/types', 'type_id');
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Return Type ID by Attribute Set Id and target country
|
43 |
-
*
|
44 |
-
* @param Mage_GoogleShopping_Model_Type $model
|
45 |
-
* @param int $attributeSetId Attribute Set
|
46 |
-
* @param string $targetCountry Two-letters country ISO code
|
47 |
-
* @return Mage_GoogleShopping_Model_Type
|
48 |
-
*/
|
49 |
-
public function loadByAttributeSetIdAndTargetCountry($model, $attributeSetId, $targetCountry)
|
50 |
-
{
|
51 |
-
$select = $this->_getReadAdapter()->select()
|
52 |
-
->from($this->getMainTable())
|
53 |
-
->where('attribute_set_id=?', $attributeSetId)
|
54 |
-
->where('target_country=?', $targetCountry);
|
55 |
-
|
56 |
-
$data = $this->_getReadAdapter()->fetchRow($select);
|
57 |
-
$data = is_array($data) ? $data : array();
|
58 |
-
$model->setData($data);
|
59 |
-
return $model;
|
60 |
-
}
|
61 |
}
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_GoogleShopping_Model_Mysql4_Type extends Mage_GoogleShopping_Model_Resource_Type
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/GoogleShopping/Model/Mysql4/Type/Collection.php
CHANGED
@@ -31,66 +31,6 @@
|
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
-
class Mage_GoogleShopping_Model_Mysql4_Type_Collection extends
|
35 |
{
|
36 |
-
|
37 |
-
protected function _construct()
|
38 |
-
{
|
39 |
-
$this->_init('googleshopping/type');
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Init collection select
|
44 |
-
*
|
45 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Type_Collection
|
46 |
-
*/
|
47 |
-
protected function _initSelect()
|
48 |
-
{
|
49 |
-
parent::_initSelect();
|
50 |
-
$this->_joinAttributeSet();
|
51 |
-
return $this;
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Add total count of Items for each type
|
56 |
-
*
|
57 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Type_Collection
|
58 |
-
*/
|
59 |
-
public function addItemsCount()
|
60 |
-
{
|
61 |
-
$this->getSelect()
|
62 |
-
->joinLeft(
|
63 |
-
array('items'=>$this->getTable('googleshopping/items')),
|
64 |
-
'main_table.type_id=items.type_id',
|
65 |
-
array('items_total' => 'COUNT(items.item_id)'))
|
66 |
-
->group('main_table.type_id');
|
67 |
-
return $this;
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Add country ISO filter to collection
|
72 |
-
*
|
73 |
-
* @param string $iso Two-letter country ISO code
|
74 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Type_Collection
|
75 |
-
*/
|
76 |
-
public function addCountryFilter($iso)
|
77 |
-
{
|
78 |
-
$this->getSelect()->where('target_country=?', $iso);
|
79 |
-
return $this;
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Join Attribute Set data
|
84 |
-
*
|
85 |
-
* @return Mage_GoogleShopping_Model_Mysql4_Type_Collection
|
86 |
-
*/
|
87 |
-
protected function _joinAttributeSet()
|
88 |
-
{
|
89 |
-
$this->getSelect()
|
90 |
-
->join(
|
91 |
-
array('set'=>$this->getTable('eav/attribute_set')),
|
92 |
-
'main_table.attribute_set_id=set.attribute_set_id',
|
93 |
-
array('attribute_set_name' => 'set.attribute_set_name'));
|
94 |
-
return $this;
|
95 |
-
}
|
96 |
}
|
31 |
* @package Mage_GoogleShopping
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
+
class Mage_GoogleShopping_Model_Mysql4_Type_Collection extends Mage_GoogleShopping_Model_Resource_Type_Collection
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
app/code/core/Mage/GoogleShopping/Model/Observer.php
CHANGED
@@ -78,7 +78,7 @@ class Mage_GoogleShopping_Model_Observer
|
|
78 |
}
|
79 |
|
80 |
/**
|
81 |
-
* Get items which are
|
82 |
*
|
83 |
* @param Mage_Catalog_Model_Product $product
|
84 |
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
@@ -87,6 +87,9 @@ class Mage_GoogleShopping_Model_Observer
|
|
87 |
{
|
88 |
$items = Mage::getResourceModel('googleshopping/item_collection')
|
89 |
->addProductFilterId($product->getId());
|
|
|
|
|
|
|
90 |
|
91 |
foreach ($items as $item) {
|
92 |
if (!Mage::getStoreConfigFlag('google/googleshopping/observed', $item->getStoreId())) {
|
78 |
}
|
79 |
|
80 |
/**
|
81 |
+
* Get items which are available for update/delete when product is saved
|
82 |
*
|
83 |
* @param Mage_Catalog_Model_Product $product
|
84 |
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
87 |
{
|
88 |
$items = Mage::getResourceModel('googleshopping/item_collection')
|
89 |
->addProductFilterId($product->getId());
|
90 |
+
if ($product->getStoreId()) {
|
91 |
+
$items->addStoreFilter($product->getStoreId());
|
92 |
+
}
|
93 |
|
94 |
foreach ($items as $item) {
|
95 |
if (!Mage::getStoreConfigFlag('google/googleshopping/observed', $item->getStoreId())) {
|
app/code/core/Mage/GoogleShopping/Model/Resource/Attribute.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Google Content Attributes resource model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Model_Resource_Attribute extends Mage_Core_Model_Resource_Db_Abstract
|
35 |
+
{
|
36 |
+
protected function _construct()
|
37 |
+
{
|
38 |
+
$this->_init('googleshopping/attributes', 'id');
|
39 |
+
}
|
40 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Resource/Attribute/Collection.php
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* GoogleShopping Attributes collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Model_Resource_Attribute_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Whether to join attribute_set_id to attributes or not
|
38 |
+
*
|
39 |
+
* @var bool
|
40 |
+
*/
|
41 |
+
protected $_joinAttributeSetFlag = true;
|
42 |
+
|
43 |
+
protected function _construct()
|
44 |
+
{
|
45 |
+
$this->_init('googleshopping/attribute');
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Add attribute set filter
|
50 |
+
*
|
51 |
+
* @param int $attributeSetId
|
52 |
+
* @param string $targetCountry two words ISO format
|
53 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
54 |
+
*/
|
55 |
+
public function addAttributeSetFilter($attributeSetId, $targetCountry)
|
56 |
+
{
|
57 |
+
if (!$this->getJoinAttributeSetFlag()) {
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
$this->getSelect()->where('attribute_set_id = ?', $attributeSetId);
|
61 |
+
$this->getSelect()->where('target_country = ?', $targetCountry);
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Add type filter
|
67 |
+
*
|
68 |
+
* @param int $type_id
|
69 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
70 |
+
*/
|
71 |
+
public function addTypeFilter($type_id)
|
72 |
+
{
|
73 |
+
$this->getSelect()->where('main_table.type_id = ?', $type_id);
|
74 |
+
return $this;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Load collection data
|
79 |
+
*
|
80 |
+
* @param bool $printQuery
|
81 |
+
* @param bool $logQuery
|
82 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
83 |
+
*/
|
84 |
+
public function load($printQuery = false, $logQuery = false)
|
85 |
+
{
|
86 |
+
if ($this->isLoaded()) {
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
if ($this->getJoinAttributeSetFlag()) {
|
90 |
+
$this->_joinAttributeSet();
|
91 |
+
}
|
92 |
+
parent::load($printQuery, $logQuery);
|
93 |
+
return $this;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Join attribute sets data to select
|
98 |
+
*
|
99 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Attribute_Collection
|
100 |
+
*/
|
101 |
+
protected function _joinAttributeSet()
|
102 |
+
{
|
103 |
+
$this->getSelect()
|
104 |
+
->joinInner(
|
105 |
+
array('types'=>$this->getTable('googleshopping/types')),
|
106 |
+
'main_table.type_id=types.type_id',
|
107 |
+
array('attribute_set_id' => 'types.attribute_set_id', 'target_country' => 'types.target_country'));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Get flag - whether to join attribute_set_id to attributes or not
|
113 |
+
*
|
114 |
+
* @return bool
|
115 |
+
*/
|
116 |
+
public function getJoinAttributeSetFlag()
|
117 |
+
{
|
118 |
+
return $this->_joinAttributeSetFlag;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Set flag - whether to join attribute_set_id to attributes or not
|
123 |
+
*
|
124 |
+
* @param bool $flag
|
125 |
+
* @return bool
|
126 |
+
*/
|
127 |
+
public function setJoinAttributeSetFlag($flag)
|
128 |
+
{
|
129 |
+
return $this->_joinAttributeSetFlag = (bool)$flag;
|
130 |
+
}
|
131 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Resource/Item.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Google Content Item resource model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Model_Resource_Item extends Mage_Core_Model_Resource_Db_Abstract
|
35 |
+
{
|
36 |
+
protected function _construct()
|
37 |
+
{
|
38 |
+
$this->_init('googleshopping/items', 'item_id');
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Load Item model by product
|
43 |
+
*
|
44 |
+
* @param Mage_GoogleShopping_Model_Item $model
|
45 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Item
|
46 |
+
*/
|
47 |
+
public function loadByProduct($model)
|
48 |
+
{
|
49 |
+
if (!($model->getProduct() instanceof Varien_Object)) {
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
|
53 |
+
$product = $model->getProduct();
|
54 |
+
$productId = $product->getId();
|
55 |
+
$storeId = $model->getStoreId() ? $model->getStoreId() : $product->getStoreId();
|
56 |
+
|
57 |
+
$read = $this->_getReadAdapter();
|
58 |
+
$select = $read->select();
|
59 |
+
|
60 |
+
if ($productId !== null) {
|
61 |
+
$select->from($this->getMainTable())
|
62 |
+
->where("product_id = ?", $productId)
|
63 |
+
->where('store_id = ?', (int)$storeId);
|
64 |
+
|
65 |
+
$data = $read->fetchRow($select);
|
66 |
+
$data = is_array($data) ? $data : array();
|
67 |
+
$model->addData($data);
|
68 |
+
}
|
69 |
+
return $this;
|
70 |
+
}
|
71 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Resource/Item/Collection.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Google Content items collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Model_Resource_Item_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
35 |
+
{
|
36 |
+
protected function _construct()
|
37 |
+
{
|
38 |
+
$this->_init('googleshopping/item');
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Init collection select
|
43 |
+
*
|
44 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
45 |
+
*/
|
46 |
+
protected function _initSelect()
|
47 |
+
{
|
48 |
+
parent::_initSelect();
|
49 |
+
$this->_joinTables();
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Filter collection by specified store ids
|
55 |
+
*
|
56 |
+
* @param array|int $storeIds
|
57 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
58 |
+
*/
|
59 |
+
public function addStoreFilter($storeIds)
|
60 |
+
{
|
61 |
+
$this->getSelect()->where('main_table.store_id IN (?)', $storeIds);
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Filter collection by specified product id
|
67 |
+
*
|
68 |
+
* @param int $productId
|
69 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
70 |
+
*/
|
71 |
+
public function addProductFilterId($productId)
|
72 |
+
{
|
73 |
+
$this->getSelect()->where('main_table.product_id=?', $productId);
|
74 |
+
return $this;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Add field filter to collection
|
79 |
+
*
|
80 |
+
* @see self::_getConditionSql for $condition
|
81 |
+
* @param string $field
|
82 |
+
* @param null|string|array $condition
|
83 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
84 |
+
*/
|
85 |
+
public function addFieldToFilter($field, $condition=null)
|
86 |
+
{
|
87 |
+
if ($field == 'name') {
|
88 |
+
$conditionSql = $this->_getConditionSql(
|
89 |
+
$this->getConnection()->getIfNullSql('p.value', 'p_d.value'), $condition
|
90 |
+
);
|
91 |
+
$this->getSelect()->where($conditionSql, null, Varien_Db_Select::TYPE_CONDITION);
|
92 |
+
return $this;
|
93 |
+
} else {
|
94 |
+
return parent::addFieldToFilter($field, $condition);
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Join product and type data
|
100 |
+
*
|
101 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Item_Collection
|
102 |
+
*/
|
103 |
+
protected function _joinTables()
|
104 |
+
{
|
105 |
+
$entityType = Mage::getSingleton('eav/config')->getEntityType('catalog_product');
|
106 |
+
$attribute = Mage::getSingleton('eav/config')->getAttribute($entityType->getEntityTypeId(),'name');
|
107 |
+
|
108 |
+
$joinConditionDefault =
|
109 |
+
sprintf("p_d.attribute_id=%d AND p_d.store_id='0' AND main_table.product_id=p_d.entity_id",
|
110 |
+
$attribute->getAttributeId()
|
111 |
+
);
|
112 |
+
$joinCondition =
|
113 |
+
sprintf("p.attribute_id=%d AND p.store_id=main_table.store_id AND main_table.product_id=p.entity_id",
|
114 |
+
$attribute->getAttributeId()
|
115 |
+
);
|
116 |
+
|
117 |
+
$this->getSelect()
|
118 |
+
->joinLeft(
|
119 |
+
array('p_d' => $attribute->getBackend()->getTable()),
|
120 |
+
$joinConditionDefault,
|
121 |
+
array());
|
122 |
+
|
123 |
+
$this->getSelect()
|
124 |
+
->joinLeft(
|
125 |
+
array('p' => $attribute->getBackend()->getTable()),
|
126 |
+
$joinCondition,
|
127 |
+
array('name' => $this->getConnection()->getIfNullSql('p.value', 'p_d.value')));
|
128 |
+
|
129 |
+
$this->getSelect()
|
130 |
+
->joinLeft(
|
131 |
+
array('types' => $this->getTable('googleshopping/types')),
|
132 |
+
'main_table.type_id=types.type_id');
|
133 |
+
|
134 |
+
return $this;
|
135 |
+
}
|
136 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Resource/Type.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Google Content Type resource model
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Model_Resource_Type extends Mage_Core_Model_Resource_Db_Abstract
|
35 |
+
{
|
36 |
+
protected function _construct()
|
37 |
+
{
|
38 |
+
$this->_init('googleshopping/types', 'type_id');
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Return Type ID by Attribute Set Id and target country
|
43 |
+
*
|
44 |
+
* @param Mage_GoogleShopping_Model_Type $model
|
45 |
+
* @param int $attributeSetId Attribute Set
|
46 |
+
* @param string $targetCountry Two-letters country ISO code
|
47 |
+
* @return Mage_GoogleShopping_Model_Type
|
48 |
+
*/
|
49 |
+
public function loadByAttributeSetIdAndTargetCountry($model, $attributeSetId, $targetCountry)
|
50 |
+
{
|
51 |
+
$select = $this->_getReadAdapter()->select()
|
52 |
+
->from($this->getMainTable())
|
53 |
+
->where('attribute_set_id=?', $attributeSetId)
|
54 |
+
->where('target_country=?', $targetCountry);
|
55 |
+
|
56 |
+
$data = $this->_getReadAdapter()->fetchRow($select);
|
57 |
+
$data = is_array($data) ? $data : array();
|
58 |
+
$model->setData($data);
|
59 |
+
return $model;
|
60 |
+
}
|
61 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Resource/Type/Collection.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* GoogleShopping Item Types collection
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_GoogleShopping_Model_Resource_Type_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
35 |
+
{
|
36 |
+
|
37 |
+
protected function _construct()
|
38 |
+
{
|
39 |
+
$this->_init('googleshopping/type');
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Init collection select
|
44 |
+
*
|
45 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Type_Collection
|
46 |
+
*/
|
47 |
+
protected function _initSelect()
|
48 |
+
{
|
49 |
+
parent::_initSelect();
|
50 |
+
$this->_joinAttributeSet();
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Add total count of Items for each type
|
56 |
+
*
|
57 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Type_Collection
|
58 |
+
*/
|
59 |
+
public function addItemsCount()
|
60 |
+
{
|
61 |
+
$this->getSelect()
|
62 |
+
->joinLeft(
|
63 |
+
array('items'=>$this->getTable('googleshopping/items')),
|
64 |
+
'main_table.type_id=items.type_id',
|
65 |
+
array('items_total' => new Zend_Db_Expr('COUNT(items.item_id)')))
|
66 |
+
->group('main_table.type_id');
|
67 |
+
return $this;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Add country ISO filter to collection
|
72 |
+
*
|
73 |
+
* @param string $iso Two-letter country ISO code
|
74 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Type_Collection
|
75 |
+
*/
|
76 |
+
public function addCountryFilter($iso)
|
77 |
+
{
|
78 |
+
$this->getSelect()->where('target_country=?', $iso);
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Join Attribute Set data
|
84 |
+
*
|
85 |
+
* @return Mage_GoogleShopping_Model_Mysql4_Type_Collection
|
86 |
+
*/
|
87 |
+
protected function _joinAttributeSet()
|
88 |
+
{
|
89 |
+
$this->getSelect()
|
90 |
+
->join(
|
91 |
+
array('set'=>$this->getTable('eav/attribute_set')),
|
92 |
+
'main_table.attribute_set_id=set.attribute_set_id',
|
93 |
+
array('attribute_set_name' => 'set.attribute_set_name'));
|
94 |
+
return $this;
|
95 |
+
}
|
96 |
+
}
|
app/code/core/Mage/GoogleShopping/Model/Service.php
CHANGED
@@ -58,10 +58,9 @@ class Mage_GoogleShopping_Model_Service extends Varien_Object
|
|
58 |
$errorMsg = Mage::helper('googleshopping')->__('Unable to connect to Google Content. Please, check Account settings in configuration.');
|
59 |
try {
|
60 |
if (!Mage::registry($this->_clientRegistryId)) {
|
61 |
-
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
|
62 |
-
$loginToken, $loginCaptcha,
|
63 |
-
Zend_Gdata_ClientLogin::CLIENTLOGIN_URI,
|
64 |
-
$type
|
65 |
);
|
66 |
$configTimeout = array('timeout' => 60);
|
67 |
$client->setConfig($configTimeout);
|
@@ -92,7 +91,7 @@ class Mage_GoogleShopping_Model_Service extends Varien_Object
|
|
92 |
}
|
93 |
|
94 |
/**
|
95 |
-
*
|
96 |
*
|
97 |
* @param int $storeId
|
98 |
* @return Varien_Gdata_Gshopping_Content
|
@@ -101,6 +100,12 @@ class Mage_GoogleShopping_Model_Service extends Varien_Object
|
|
101 |
{
|
102 |
if (!$this->_service) {
|
103 |
$this->_service = $this->_connect($storeId);
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
return $this->_service;
|
106 |
}
|
58 |
$errorMsg = Mage::helper('googleshopping')->__('Unable to connect to Google Content. Please, check Account settings in configuration.');
|
59 |
try {
|
60 |
if (!Mage::registry($this->_clientRegistryId)) {
|
61 |
+
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
|
62 |
+
Varien_Gdata_Gshopping_Content::AUTH_SERVICE_NAME, null, '', $loginToken, $loginCaptcha,
|
63 |
+
Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, $type
|
|
|
64 |
);
|
65 |
$configTimeout = array('timeout' => 60);
|
66 |
$client->setConfig($configTimeout);
|
91 |
}
|
92 |
|
93 |
/**
|
94 |
+
* Return Google Content Service Instance
|
95 |
*
|
96 |
* @param int $storeId
|
97 |
* @return Varien_Gdata_Gshopping_Content
|
100 |
{
|
101 |
if (!$this->_service) {
|
102 |
$this->_service = $this->_connect($storeId);
|
103 |
+
|
104 |
+
if ($this->getConfig()->getIsDebug($storeId)) {
|
105 |
+
$this->_service
|
106 |
+
->setLogAdapter(Mage::getModel('core/log_adapter', 'googleshopping.log'), 'log')
|
107 |
+
->setDebug(true);
|
108 |
+
}
|
109 |
}
|
110 |
return $this->_service;
|
111 |
}
|
app/code/core/Mage/GoogleShopping/controllers/Adminhtml/Googleshopping/TypesController.php
CHANGED
@@ -164,6 +164,7 @@ class Mage_GoogleShopping_Adminhtml_Googleshopping_TypesController extends Mage_
|
|
164 |
*/
|
165 |
public function saveAction()
|
166 |
{
|
|
|
167 |
$typeModel = Mage::getModel('googleshopping/type');
|
168 |
$id = $this->getRequest()->getParam('type_id');
|
169 |
if (!is_null($id)) {
|
@@ -171,6 +172,7 @@ class Mage_GoogleShopping_Adminhtml_Googleshopping_TypesController extends Mage_
|
|
171 |
}
|
172 |
|
173 |
try {
|
|
|
174 |
if ($typeModel->getId()) {
|
175 |
$collection = Mage::getResourceModel('googleshopping/attribute_collection')
|
176 |
->addTypeFilter($typeModel->getId())
|
@@ -178,13 +180,14 @@ class Mage_GoogleShopping_Adminhtml_Googleshopping_TypesController extends Mage_
|
|
178 |
foreach ($collection as $attribute) {
|
179 |
$attribute->delete();
|
180 |
}
|
|
|
|
|
|
|
181 |
}
|
182 |
-
$typeModel->
|
183 |
-
->setTargetCountry($this->getRequest()->getParam('target_country'))
|
184 |
-
->save();
|
185 |
-
|
186 |
|
187 |
$attributes = $this->getRequest()->getParam('attributes');
|
|
|
188 |
if (is_array($attributes)) {
|
189 |
$typeId = $typeModel->getId();
|
190 |
foreach ($attributes as $attrInfo) {
|
@@ -196,10 +199,15 @@ class Mage_GoogleShopping_Adminhtml_Googleshopping_TypesController extends Mage_
|
|
196 |
->setGcontentAttribute($attrInfo['gcontent_attribute'])
|
197 |
->setTypeId($typeId)
|
198 |
->save();
|
|
|
199 |
}
|
200 |
}
|
201 |
|
202 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('googleshopping')->__('The attribute mapping has been saved.'));
|
|
|
|
|
|
|
|
|
203 |
} catch (Exception $e) {
|
204 |
Mage::logException($e);
|
205 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('googleshopping')->__("Can't save Attribute Set Mapping."));
|
164 |
*/
|
165 |
public function saveAction()
|
166 |
{
|
167 |
+
/** @var $typeModel Mage_GoogleShopping_Model_Type */
|
168 |
$typeModel = Mage::getModel('googleshopping/type');
|
169 |
$id = $this->getRequest()->getParam('type_id');
|
170 |
if (!is_null($id)) {
|
172 |
}
|
173 |
|
174 |
try {
|
175 |
+
$typeModel->setCategory($this->getRequest()->getParam('category'));
|
176 |
if ($typeModel->getId()) {
|
177 |
$collection = Mage::getResourceModel('googleshopping/attribute_collection')
|
178 |
->addTypeFilter($typeModel->getId())
|
180 |
foreach ($collection as $attribute) {
|
181 |
$attribute->delete();
|
182 |
}
|
183 |
+
} else {
|
184 |
+
$typeModel->setAttributeSetId($this->getRequest()->getParam('attribute_set_id'))
|
185 |
+
->setTargetCountry($this->getRequest()->getParam('target_country'));
|
186 |
}
|
187 |
+
$typeModel->save();
|
|
|
|
|
|
|
188 |
|
189 |
$attributes = $this->getRequest()->getParam('attributes');
|
190 |
+
$requiredAttributes = Mage::getSingleton('googleshopping/config')->getRequiredAttributes();
|
191 |
if (is_array($attributes)) {
|
192 |
$typeId = $typeModel->getId();
|
193 |
foreach ($attributes as $attrInfo) {
|
199 |
->setGcontentAttribute($attrInfo['gcontent_attribute'])
|
200 |
->setTypeId($typeId)
|
201 |
->save();
|
202 |
+
unset($requiredAttributes[$attrInfo['gcontent_attribute']]);
|
203 |
}
|
204 |
}
|
205 |
|
206 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('googleshopping')->__('The attribute mapping has been saved.'));
|
207 |
+
if (!empty($requiredAttributes)) {
|
208 |
+
Mage::getSingleton('adminhtml/session')
|
209 |
+
->addSuccess(Mage::helper('googleshopping/category')->getMessage());
|
210 |
+
}
|
211 |
} catch (Exception $e) {
|
212 |
Mage::logException($e);
|
213 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('googleshopping')->__("Can't save Attribute Set Mapping."));
|
app/code/core/Mage/GoogleShopping/data/googleshopping_setup/data-install-1.6.0.0.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/** @var $this Mage_Core_Model_Resource_Setup */
|
28 |
+
$installer = $this;
|
29 |
+
|
30 |
+
if (Mage::helper('googleshopping')->isModuleEnabled('Mage_GoogleBase')) {
|
31 |
+
$typesInsert = $installer->getConnection()
|
32 |
+
->select()
|
33 |
+
->from(
|
34 |
+
$installer->getTable('googlebase/types'),
|
35 |
+
array(
|
36 |
+
'type_id',
|
37 |
+
'attribute_set_id',
|
38 |
+
'target_country',
|
39 |
+
'category' => new Zend_Db_Expr('NULL')
|
40 |
+
)
|
41 |
+
)
|
42 |
+
->insertFromSelect($installer->getTable('googleshopping/types'));
|
43 |
+
|
44 |
+
$itemsInsert = $installer->getConnection()
|
45 |
+
->select()
|
46 |
+
->from(
|
47 |
+
$installer->getTable('googlebase/items'),
|
48 |
+
array(
|
49 |
+
'item_id',
|
50 |
+
'type_id',
|
51 |
+
'product_id',
|
52 |
+
'gbase_item_id',
|
53 |
+
'store_id',
|
54 |
+
'published',
|
55 |
+
'expires'
|
56 |
+
)
|
57 |
+
)
|
58 |
+
->insertFromSelect($installer->getTable('googleshopping/items'));
|
59 |
+
|
60 |
+
$attributes = '';
|
61 |
+
foreach (Mage::getModel('googleshopping/config')->getAttributes() as $destAttribtues) {
|
62 |
+
foreach ($destAttribtues as $code => $info) {
|
63 |
+
$attributes .= "'$code',";
|
64 |
+
}
|
65 |
+
}
|
66 |
+
$attributes = rtrim($attributes, ',');
|
67 |
+
$attributesInsert = $installer->getConnection()
|
68 |
+
->select()
|
69 |
+
->from(
|
70 |
+
$installer->getTable('googlebase/attributes'),
|
71 |
+
array(
|
72 |
+
'id',
|
73 |
+
'attribute_id',
|
74 |
+
'gbase_attribute' => new Zend_Db_Expr("IF(gbase_attribute IN ($attributes), gbase_attribute, '')"),
|
75 |
+
'type_id',
|
76 |
+
)
|
77 |
+
)
|
78 |
+
->insertFromSelect($installer->getTable('googleshopping/attributes'));
|
79 |
+
|
80 |
+
$installer->run($typesInsert);
|
81 |
+
$installer->run($attributesInsert);
|
82 |
+
$installer->run($itemsInsert);
|
83 |
+
}
|
app/code/core/Mage/GoogleShopping/etc/config.xml
CHANGED
@@ -28,17 +28,18 @@
|
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_GoogleShopping>
|
31 |
-
<version>0.
|
32 |
</Mage_GoogleShopping>
|
33 |
</modules>
|
34 |
<global>
|
35 |
<models>
|
36 |
<googleshopping>
|
37 |
<class>Mage_GoogleShopping_Model</class>
|
38 |
-
<resourceModel>
|
39 |
</googleshopping>
|
40 |
-
<
|
41 |
-
<class>
|
|
|
42 |
<entities>
|
43 |
<types>
|
44 |
<table>googleshopping_types</table>
|
@@ -50,7 +51,7 @@
|
|
50 |
<table>googleshopping_attributes</table>
|
51 |
</attributes>
|
52 |
</entities>
|
53 |
-
</
|
54 |
</models>
|
55 |
<helpers>
|
56 |
<googleshopping>
|
@@ -121,8 +122,8 @@
|
|
121 |
<target_country>US</target_country>
|
122 |
<account_type>HOSTED_OR_GOOGLE</account_type>
|
123 |
|
124 |
-
<!-- Availabled target countries. Each country must have
|
125 |
-
language code (ISO 639-1) and currency code (ISO 3166)
|
126 |
according to Google Content documentation. -->
|
127 |
<allowed_countries>
|
128 |
<AU translate="name currency_name">
|
@@ -222,6 +223,10 @@
|
|
222 |
<name>Image link</name>
|
223 |
<required>0</required>
|
224 |
</image_link>
|
|
|
|
|
|
|
|
|
225 |
-->
|
226 |
<title translate="name">
|
227 |
<name>Title</name>
|
@@ -242,12 +247,6 @@
|
|
242 |
|
243 |
</Item>
|
244 |
<ProductSearch>
|
245 |
-
<!-- These attributes aren't available for mapping
|
246 |
-
<quantity translate="name">
|
247 |
-
<name>Quantity</name>
|
248 |
-
<required>0</required>
|
249 |
-
</quantity>
|
250 |
-
-->
|
251 |
<condition translate="name">
|
252 |
<name>Condition</name>
|
253 |
<required>1</required>
|
@@ -271,45 +270,25 @@
|
|
271 |
<required>0</required>
|
272 |
<country>US</country>
|
273 |
</sale_price_effective_date_to>
|
274 |
-
<
|
275 |
-
<name>
|
276 |
-
<required>
|
277 |
-
</
|
278 |
-
<availability translate="name">
|
279 |
-
<name>Availability</name>
|
280 |
-
<required>0</required>
|
281 |
-
</availability>
|
282 |
<brand translate="name">
|
283 |
<name>Brand</name>
|
284 |
-
<required>
|
285 |
</brand>
|
286 |
<color translate="name">
|
287 |
<name>Color</name>
|
288 |
-
<required>
|
289 |
</color>
|
290 |
-
<
|
291 |
-
<name>
|
292 |
-
<required>
|
293 |
-
</
|
294 |
-
<feature translate="name">
|
295 |
-
<name>Feature</name>
|
296 |
-
<required>0</required>
|
297 |
-
</feature>
|
298 |
-
<featured_product translate="name">
|
299 |
-
<name>Featured Product</name>
|
300 |
-
<required>0</required>
|
301 |
-
</featured_product>
|
302 |
-
<genre translate="name">
|
303 |
-
<name>Genre</name>
|
304 |
-
<required>0</required>
|
305 |
-
</genre>
|
306 |
-
<manufacturer translate="name">
|
307 |
-
<name>Manufacturer</name>
|
308 |
-
<required>0</required>
|
309 |
-
</manufacturer>
|
310 |
<mpn translate="name">
|
311 |
<name>Manufacturer\'s Part Number (MPN)</name>
|
312 |
-
<required>
|
313 |
</mpn>
|
314 |
<online_only translate="name">
|
315 |
<name>Online Only</name>
|
@@ -317,7 +296,7 @@
|
|
317 |
</online_only>
|
318 |
<gtin translate="name">
|
319 |
<name>GTIN</name>
|
320 |
-
<required>
|
321 |
</gtin>
|
322 |
<product_type translate="name">
|
323 |
<name>Product Type (Category)</name>
|
@@ -337,12 +316,16 @@
|
|
337 |
</shipping_weight>
|
338 |
<size translate="name">
|
339 |
<name>Size</name>
|
340 |
-
<required>
|
341 |
</size>
|
342 |
-
<
|
343 |
-
<name>
|
344 |
-
<required>
|
345 |
-
</
|
|
|
|
|
|
|
|
|
346 |
</ProductSearch>
|
347 |
<ProductAds>
|
348 |
<adwords_grouping translate="name">
|
@@ -372,7 +355,7 @@
|
|
372 |
<sale_price_effective_date/>
|
373 |
<sale_price_effective_date_from/>
|
374 |
<sale_price_effective_date_to/>
|
375 |
-
</price>
|
376 |
<shipping_weight>
|
377 |
<weight/>
|
378 |
</shipping_weight>
|
@@ -384,7 +367,7 @@
|
|
384 |
</content>
|
385 |
</attribute_groups>
|
386 |
|
387 |
-
<!-- Base attributes are required and auto-calculated.
|
388 |
They will be added to entry even without mapping. -->
|
389 |
<base_attributes>
|
390 |
<id/>
|
@@ -392,12 +375,14 @@
|
|
392 |
<link/>
|
393 |
<content/>
|
394 |
<price/>
|
395 |
-
<quantity/>
|
396 |
<image_link/>
|
397 |
<condition/>
|
398 |
<target_country/>
|
399 |
<content_language/>
|
400 |
<destinations/>
|
|
|
|
|
|
|
401 |
</base_attributes>
|
402 |
</googleshopping>
|
403 |
</google>
|
28 |
<config>
|
29 |
<modules>
|
30 |
<Mage_GoogleShopping>
|
31 |
+
<version>1.6.0.0.1</version>
|
32 |
</Mage_GoogleShopping>
|
33 |
</modules>
|
34 |
<global>
|
35 |
<models>
|
36 |
<googleshopping>
|
37 |
<class>Mage_GoogleShopping_Model</class>
|
38 |
+
<resourceModel>googleshopping_resource</resourceModel>
|
39 |
</googleshopping>
|
40 |
+
<googleshopping_resource>
|
41 |
+
<class>Mage_GoogleShopping_Model_Resource</class>
|
42 |
+
<deprecatedNode>googleshopping_mysql4</deprecatedNode>
|
43 |
<entities>
|
44 |
<types>
|
45 |
<table>googleshopping_types</table>
|
51 |
<table>googleshopping_attributes</table>
|
52 |
</attributes>
|
53 |
</entities>
|
54 |
+
</googleshopping_resource>
|
55 |
</models>
|
56 |
<helpers>
|
57 |
<googleshopping>
|
122 |
<target_country>US</target_country>
|
123 |
<account_type>HOSTED_OR_GOOGLE</account_type>
|
124 |
|
125 |
+
<!-- Availabled target countries. Each country must have
|
126 |
+
language code (ISO 639-1) and currency code (ISO 3166)
|
127 |
according to Google Content documentation. -->
|
128 |
<allowed_countries>
|
129 |
<AU translate="name currency_name">
|
223 |
<name>Image link</name>
|
224 |
<required>0</required>
|
225 |
</image_link>
|
226 |
+
<item_group_id translate="name">
|
227 |
+
<name>Item Group ID</name>
|
228 |
+
<required>0</required>
|
229 |
+
</item_group_id>
|
230 |
-->
|
231 |
<title translate="name">
|
232 |
<name>Title</name>
|
247 |
|
248 |
</Item>
|
249 |
<ProductSearch>
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
<condition translate="name">
|
251 |
<name>Condition</name>
|
252 |
<required>1</required>
|
270 |
<required>0</required>
|
271 |
<country>US</country>
|
272 |
</sale_price_effective_date_to>
|
273 |
+
<age_group translate="name">
|
274 |
+
<name>Age Group</name>
|
275 |
+
<required>1</required>
|
276 |
+
</age_group>
|
|
|
|
|
|
|
|
|
277 |
<brand translate="name">
|
278 |
<name>Brand</name>
|
279 |
+
<required>1</required>
|
280 |
</brand>
|
281 |
<color translate="name">
|
282 |
<name>Color</name>
|
283 |
+
<required>1</required>
|
284 |
</color>
|
285 |
+
<gender translate="name">
|
286 |
+
<name>Gender</name>
|
287 |
+
<required>1</required>
|
288 |
+
</gender>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
<mpn translate="name">
|
290 |
<name>Manufacturer\'s Part Number (MPN)</name>
|
291 |
+
<required>1</required>
|
292 |
</mpn>
|
293 |
<online_only translate="name">
|
294 |
<name>Online Only</name>
|
296 |
</online_only>
|
297 |
<gtin translate="name">
|
298 |
<name>GTIN</name>
|
299 |
+
<required>1</required>
|
300 |
</gtin>
|
301 |
<product_type translate="name">
|
302 |
<name>Product Type (Category)</name>
|
316 |
</shipping_weight>
|
317 |
<size translate="name">
|
318 |
<name>Size</name>
|
319 |
+
<required>1</required>
|
320 |
</size>
|
321 |
+
<material translate="name">
|
322 |
+
<name>Material</name>
|
323 |
+
<required>1</required>
|
324 |
+
</material>
|
325 |
+
<pattern translate="name">
|
326 |
+
<name>Pattern/Graphic</name>
|
327 |
+
<required>1</required>
|
328 |
+
</pattern>
|
329 |
</ProductSearch>
|
330 |
<ProductAds>
|
331 |
<adwords_grouping translate="name">
|
355 |
<sale_price_effective_date/>
|
356 |
<sale_price_effective_date_from/>
|
357 |
<sale_price_effective_date_to/>
|
358 |
+
</price>
|
359 |
<shipping_weight>
|
360 |
<weight/>
|
361 |
</shipping_weight>
|
367 |
</content>
|
368 |
</attribute_groups>
|
369 |
|
370 |
+
<!-- Base attributes are required and auto-calculated.
|
371 |
They will be added to entry even without mapping. -->
|
372 |
<base_attributes>
|
373 |
<id/>
|
375 |
<link/>
|
376 |
<content/>
|
377 |
<price/>
|
|
|
378 |
<image_link/>
|
379 |
<condition/>
|
380 |
<target_country/>
|
381 |
<content_language/>
|
382 |
<destinations/>
|
383 |
+
<availability/>
|
384 |
+
<google_product_category/>
|
385 |
+
<product_type/>
|
386 |
</base_attributes>
|
387 |
</googleshopping>
|
388 |
</google>
|
app/code/core/Mage/GoogleShopping/etc/system.xml
CHANGED
@@ -89,6 +89,15 @@
|
|
89 |
<show_in_website>1</show_in_website>
|
90 |
<show_in_store>1</show_in_store>
|
91 |
</observed>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
<destinations translate="label">
|
93 |
<label>Destinations</label>
|
94 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
89 |
<show_in_website>1</show_in_website>
|
90 |
<show_in_store>1</show_in_store>
|
91 |
</observed>
|
92 |
+
<debug translate="label">
|
93 |
+
<label>Debug</label>
|
94 |
+
<frontend_type>select</frontend_type>
|
95 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
96 |
+
<sort_order>140</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>0</show_in_store>
|
100 |
+
</debug>
|
101 |
<destinations translate="label">
|
102 |
<label>Destinations</label>
|
103 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
app/code/core/Mage/GoogleShopping/sql/googleshopping_setup/install-1.6.0.0.php
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* GoogleShopping install
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
/** @var $installer Mage_Core_Model_Resource_Setup */
|
35 |
+
$installer = $this;
|
36 |
+
|
37 |
+
$installer->startSetup();
|
38 |
+
|
39 |
+
$connection = $installer->getConnection();
|
40 |
+
|
41 |
+
$table = $connection->newTable($this->getTable('googleshopping/types'))
|
42 |
+
->addColumn('type_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
43 |
+
'identity' => true,
|
44 |
+
'unsigned' => true,
|
45 |
+
'nullable' => false,
|
46 |
+
'primary' => true
|
47 |
+
), 'Type ID')
|
48 |
+
->addColumn('attribute_set_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
49 |
+
'unsigned' => true,
|
50 |
+
'nullable' => false
|
51 |
+
), 'Attribute Set Id')
|
52 |
+
->addColumn('target_country', Varien_Db_Ddl_Table::TYPE_TEXT, 2, array(
|
53 |
+
'nullable' => false,
|
54 |
+
'default' => 'US'
|
55 |
+
), 'Target country')
|
56 |
+
->addForeignKey(
|
57 |
+
$installer->getFkName(
|
58 |
+
'googleshopping/types',
|
59 |
+
'attribute_set_id',
|
60 |
+
'eav/attribute_set',
|
61 |
+
'attribute_set_id'
|
62 |
+
),
|
63 |
+
'attribute_set_id',
|
64 |
+
$this->getTable('eav/attribute_set'),
|
65 |
+
'attribute_set_id',
|
66 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE)
|
67 |
+
->addIndex(
|
68 |
+
$installer->getIdxName(
|
69 |
+
'googleshopping/types',
|
70 |
+
array('attribute_set_id', 'target_country'),
|
71 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
72 |
+
),
|
73 |
+
array('attribute_set_id', 'target_country'),
|
74 |
+
array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
|
75 |
+
->setComment('Google Content Item Types link Attribute Sets');
|
76 |
+
$installer->getConnection()->createTable($table);
|
77 |
+
|
78 |
+
$table = $connection->newTable($this->getTable('googleshopping/items'))
|
79 |
+
->addColumn('item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
80 |
+
'identity' => true,
|
81 |
+
'nullable' => false,
|
82 |
+
'unsigned' => true,
|
83 |
+
'primary' => true
|
84 |
+
), 'Item Id')
|
85 |
+
->addColumn('type_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
86 |
+
'nullable' => false,
|
87 |
+
'unsigned' => true,
|
88 |
+
'default' => 0
|
89 |
+
), 'Type Id')
|
90 |
+
->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
91 |
+
'nullable' => false,
|
92 |
+
'unsigned' => true
|
93 |
+
), 'Product Id')
|
94 |
+
->addColumn('gcontent_item_id', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
95 |
+
'nullable' => false
|
96 |
+
), 'Google Content Item Id')
|
97 |
+
->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
98 |
+
'nullable' => false,
|
99 |
+
'unsigned' => true
|
100 |
+
), 'Store Id')
|
101 |
+
->addColumn('published', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(), 'Published date')
|
102 |
+
->addColumn('expires', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(), 'Expires date')
|
103 |
+
->addForeignKey(
|
104 |
+
$installer->getFkName(
|
105 |
+
'googleshopping/items',
|
106 |
+
'product_id',
|
107 |
+
'catalog/product',
|
108 |
+
'entity_id'
|
109 |
+
),
|
110 |
+
'product_id',
|
111 |
+
$this->getTable('catalog/product'),
|
112 |
+
'entity_id',
|
113 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
114 |
+
)
|
115 |
+
->addForeignKey(
|
116 |
+
$installer->getFkName(
|
117 |
+
'googleshopping/items',
|
118 |
+
'store_id',
|
119 |
+
'core/store',
|
120 |
+
'store_id'
|
121 |
+
),
|
122 |
+
'store_id',
|
123 |
+
$this->getTable('core/store'),
|
124 |
+
'store_id',
|
125 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
126 |
+
)
|
127 |
+
->addIndex($installer->getIdxName('googleshopping/items', array('product_id', 'store_id')),
|
128 |
+
array('product_id', 'store_id'))
|
129 |
+
->setComment('Google Content Items Products');
|
130 |
+
$installer->getConnection()->createTable($table);
|
131 |
+
|
132 |
+
$table = $connection->newTable($this->getTable('googleshopping/attributes'))
|
133 |
+
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array(
|
134 |
+
'identity' => true,
|
135 |
+
'nullable' => false,
|
136 |
+
'unsigned' => true,
|
137 |
+
'primary' => true
|
138 |
+
), 'Id')
|
139 |
+
->addColumn('attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
|
140 |
+
'nullable' => false,
|
141 |
+
'unsigned' => true
|
142 |
+
), 'Attribute Id')
|
143 |
+
->addColumn('gcontent_attribute', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
|
144 |
+
'nullable' => false
|
145 |
+
), 'Google Content Attribute')
|
146 |
+
->addColumn('type_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
147 |
+
'nullable' => false,
|
148 |
+
'unsigned' => true
|
149 |
+
), 'Type Id')
|
150 |
+
->addForeignKey(
|
151 |
+
$installer->getFkName(
|
152 |
+
'googleshopping/attributes',
|
153 |
+
'attribute_id',
|
154 |
+
'eav/attribute',
|
155 |
+
'attribute_id'
|
156 |
+
),
|
157 |
+
'attribute_id',
|
158 |
+
$this->getTable('eav/attribute'),
|
159 |
+
'attribute_id',
|
160 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
161 |
+
)
|
162 |
+
->addForeignKey(
|
163 |
+
$installer->getFkName(
|
164 |
+
'googleshopping/attributes',
|
165 |
+
'type_id',
|
166 |
+
'googleshopping/types',
|
167 |
+
'type_id'
|
168 |
+
),
|
169 |
+
'type_id',
|
170 |
+
$this->getTable('googleshopping/types'),
|
171 |
+
'type_id',
|
172 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE
|
173 |
+
)
|
174 |
+
->setComment('Google Content Attributes link Product Attributes');
|
175 |
+
$installer->getConnection()->createTable($table);
|
176 |
+
|
177 |
+
$installer->endSetup();
|
178 |
+
|
app/code/core/Mage/GoogleShopping/sql/googleshopping_setup/mysql4-data-install-0.2.0.php
CHANGED
@@ -79,4 +79,4 @@ if (Mage::helper('googleshopping')->isModuleEnabled('Mage_GoogleBase')) {
|
|
79 |
$installer->run($typesInsert);
|
80 |
$installer->run($attributesInsert);
|
81 |
$installer->run($itemsInsert);
|
82 |
-
}
|
79 |
$installer->run($typesInsert);
|
80 |
$installer->run($attributesInsert);
|
81 |
$installer->run($itemsInsert);
|
82 |
+
}
|
app/code/core/Mage/GoogleShopping/sql/googleshopping_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php
ADDED
@@ -0,0 +1,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* GoogleShopping upgrade
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
|
35 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
36 |
+
$installer = $this;
|
37 |
+
$installer->startSetup();
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Drop foreign keys
|
41 |
+
*/
|
42 |
+
$installer->getConnection()->dropForeignKey(
|
43 |
+
$installer->getTable('googleshopping/types'),
|
44 |
+
'GOOGLESHOPPING_TYPES_ATTRIBUTE_SET_ID'
|
45 |
+
);
|
46 |
+
|
47 |
+
$installer->getConnection()->dropForeignKey(
|
48 |
+
$installer->getTable('googleshopping/items'),
|
49 |
+
'GOOGLESHOPPING_ITEMS_PRODUCT_ID'
|
50 |
+
);
|
51 |
+
|
52 |
+
$installer->getConnection()->dropForeignKey(
|
53 |
+
$installer->getTable('googleshopping/items'),
|
54 |
+
'GOOGLESHOPPING_ITEMS_STORE_ID'
|
55 |
+
);
|
56 |
+
|
57 |
+
$installer->getConnection()->dropForeignKey(
|
58 |
+
$installer->getTable('googleshopping/attributes'),
|
59 |
+
'GOOGLESHOPPING_ATTRIBUTES_ATTRIBUTE_ID'
|
60 |
+
);
|
61 |
+
|
62 |
+
$installer->getConnection()->dropForeignKey(
|
63 |
+
$installer->getTable('googleshopping/attributes'),
|
64 |
+
'GOOGLESHOPPING_ATTRIBUTES_TYPE_ID'
|
65 |
+
);
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Drop indexes
|
69 |
+
*/
|
70 |
+
$installer->getConnection()->dropIndex(
|
71 |
+
$installer->getTable('googleshopping/types'),
|
72 |
+
'GOOGLESHOPPING_TYPES_ATTRIBUTE_SET_COUNTRY'
|
73 |
+
);
|
74 |
+
|
75 |
+
$installer->getConnection()->dropIndex(
|
76 |
+
$installer->getTable('googleshopping/items'),
|
77 |
+
'GOOGLESHOPPING_ITEMS_PRODUCT_STORE_ID'
|
78 |
+
);
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Change columns
|
82 |
+
*/
|
83 |
+
|
84 |
+
$tables = array(
|
85 |
+
$installer->getTable('googleshopping/types') => array(
|
86 |
+
'columns' => array(
|
87 |
+
'type_id' => array(
|
88 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
89 |
+
'identity' => true,
|
90 |
+
'unsigned' => true,
|
91 |
+
'nullable' => false,
|
92 |
+
'primary' => true,
|
93 |
+
'comment' => 'Type ID',
|
94 |
+
),
|
95 |
+
'attribute_set_id' => array(
|
96 |
+
'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
97 |
+
'unsigned' => true,
|
98 |
+
'nullable' => false,
|
99 |
+
'comment' => 'Attribute Set Id',
|
100 |
+
),
|
101 |
+
'target_country' => array(
|
102 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
103 |
+
'length' => 2,
|
104 |
+
'nullable' => false,
|
105 |
+
'default' => 'US',
|
106 |
+
'comment' => 'Target country',
|
107 |
+
),
|
108 |
+
),
|
109 |
+
'comment' => 'Google Content Item Types link Attribute Sets'
|
110 |
+
),
|
111 |
+
$installer->getTable('googleshopping/items') => array(
|
112 |
+
'columns' => array(
|
113 |
+
'item_id' => array(
|
114 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
115 |
+
'identity' => true,
|
116 |
+
'nullable' => false,
|
117 |
+
'unsigned' => true,
|
118 |
+
'primary' => true,
|
119 |
+
'comment' => 'Item Id',
|
120 |
+
),
|
121 |
+
'type_id' => array(
|
122 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
123 |
+
'nullable' => false,
|
124 |
+
'unsigned' => true,
|
125 |
+
'default' => 0,
|
126 |
+
'comment' => 'Type Id',
|
127 |
+
),
|
128 |
+
'product_id' => array(
|
129 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
130 |
+
'nullable' => false,
|
131 |
+
'unsigned' => true,
|
132 |
+
'comment' => 'Product Id',
|
133 |
+
),
|
134 |
+
'gcontent_item_id' => array(
|
135 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
136 |
+
'length' => 255,
|
137 |
+
'nullable' => false,
|
138 |
+
'comment' => 'Google Content Item Id',
|
139 |
+
),
|
140 |
+
'store_id' => array(
|
141 |
+
'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
142 |
+
'nullable' => false,
|
143 |
+
'unsigned' => true,
|
144 |
+
'comment' => 'Store Id',
|
145 |
+
),
|
146 |
+
'published' => array(
|
147 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DATETIME,
|
148 |
+
'nullable' => true,
|
149 |
+
'comment' => 'Published date',
|
150 |
+
),
|
151 |
+
'expires' => array(
|
152 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DATETIME,
|
153 |
+
'nullable' => true,
|
154 |
+
'comment' => 'Expires date',
|
155 |
+
),
|
156 |
+
),
|
157 |
+
'comment' => 'Google Content Items Products'
|
158 |
+
),
|
159 |
+
$installer->getTable('googleshopping/attributes') => array(
|
160 |
+
'columns' => array(
|
161 |
+
'id' => array(
|
162 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
163 |
+
'length' => 10,
|
164 |
+
'identity' => true,
|
165 |
+
'nullable' => false,
|
166 |
+
'unsigned' => true,
|
167 |
+
'primary' => true,
|
168 |
+
'comment' => 'Id',
|
169 |
+
),
|
170 |
+
'attribute_id' => array(
|
171 |
+
'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
|
172 |
+
'nullable' => false,
|
173 |
+
'unsigned' => true,
|
174 |
+
'comment' => 'Attribute Id',
|
175 |
+
),
|
176 |
+
'gcontent_attribute' => array(
|
177 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
178 |
+
'length' => 255,
|
179 |
+
'nullable' => false,
|
180 |
+
'comment' => 'Google Content Attribute',
|
181 |
+
),
|
182 |
+
'type_id' => array(
|
183 |
+
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
|
184 |
+
'nullable' => false,
|
185 |
+
'unsigned' => true,
|
186 |
+
'comment' => 'Type Id',
|
187 |
+
),
|
188 |
+
),
|
189 |
+
'comment' => 'Google Content Attributes link Product Attributes'
|
190 |
+
),
|
191 |
+
);
|
192 |
+
|
193 |
+
$installer->getConnection()->modifyTables($tables);
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Add indexes
|
197 |
+
*/
|
198 |
+
$installer->getConnection()->addIndex(
|
199 |
+
$this->getTable('googleshopping/types'),
|
200 |
+
$installer->getIdxName(
|
201 |
+
'googleshopping/types',
|
202 |
+
array('attribute_set_id', 'target_country'),
|
203 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
204 |
+
),
|
205 |
+
array('attribute_set_id', 'target_country'),
|
206 |
+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
|
207 |
+
);
|
208 |
+
|
209 |
+
$installer->getConnection()->addIndex(
|
210 |
+
$this->getTable('googleshopping/items'),
|
211 |
+
$installer->getIdxName('googleshopping/items', array('product_id', 'store_id')),
|
212 |
+
array('product_id', 'store_id')
|
213 |
+
);
|
214 |
+
|
215 |
+
$installer->getConnection()->addIndex(
|
216 |
+
$this->getTable('googleshopping/items'),
|
217 |
+
$installer->getIdxName('googleshopping/items', array('product_id', 'store_id')),
|
218 |
+
array('product_id', 'store_id')
|
219 |
+
);
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Add foreign keys
|
223 |
+
*/
|
224 |
+
$installer->getConnection()->addForeignKey(
|
225 |
+
$installer->getFkName('googleshopping/types', 'attribute_set_id', 'eav/attribute_set', 'attribute_set_id'),
|
226 |
+
$installer->getTable('googleshopping/types'),
|
227 |
+
'attribute_set_id',
|
228 |
+
$this->getTable('eav/attribute_set'),
|
229 |
+
'attribute_set_id',
|
230 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
231 |
+
Varien_Db_Ddl_Table::ACTION_NO_ACTION
|
232 |
+
);
|
233 |
+
|
234 |
+
$installer->getConnection()->addForeignKey(
|
235 |
+
$installer->getFkName('googleshopping/items', 'product_id', 'catalog/product', 'entity_id'),
|
236 |
+
$installer->getTable('googleshopping/items'),
|
237 |
+
'product_id',
|
238 |
+
$this->getTable('catalog/product'),
|
239 |
+
'entity_id',
|
240 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
241 |
+
Varien_Db_Ddl_Table::ACTION_NO_ACTION
|
242 |
+
);
|
243 |
+
|
244 |
+
$installer->getConnection()->addForeignKey(
|
245 |
+
$installer->getFkName('googleshopping/items', 'store_id', 'core/store', 'store_id'),
|
246 |
+
$installer->getTable('googleshopping/items'),
|
247 |
+
'store_id',
|
248 |
+
$this->getTable('core/store'),
|
249 |
+
'store_id',
|
250 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
251 |
+
Varien_Db_Ddl_Table::ACTION_NO_ACTION
|
252 |
+
);
|
253 |
+
|
254 |
+
$installer->getConnection()->addForeignKey(
|
255 |
+
$installer->getFkName('googleshopping/attributes', 'attribute_id', 'eav/attribute', 'attribute_id'),
|
256 |
+
$installer->getTable('googleshopping/attributes'),
|
257 |
+
'attribute_id',
|
258 |
+
$this->getTable('eav/attribute'),
|
259 |
+
'attribute_id',
|
260 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
261 |
+
Varien_Db_Ddl_Table::ACTION_NO_ACTION
|
262 |
+
);
|
263 |
+
|
264 |
+
$installer->getConnection()->addForeignKey(
|
265 |
+
$installer->getFkName('googleshopping/attributes', 'type_id', 'googleshopping/types', 'type_id'),
|
266 |
+
$installer->getTable('googleshopping/attributes'),
|
267 |
+
'type_id',
|
268 |
+
$this->getTable('googleshopping/types'),
|
269 |
+
'type_id',
|
270 |
+
Varien_Db_Ddl_Table::ACTION_CASCADE,
|
271 |
+
Varien_Db_Ddl_Table::ACTION_NO_ACTION
|
272 |
+
);
|
app/code/core/Mage/GoogleShopping/sql/googleshopping_setup/upgrade-1.6.0.0-1.6.0.0.1.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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 Mage
|
22 |
+
* @package Mage_GoogleShopping
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* GoogleShopping upgrade
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_GoogleShopping
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
/** @var $installer Mage_Core_Model_Resource_Setup */
|
35 |
+
$installer = $this;
|
36 |
+
|
37 |
+
$installer->startSetup();
|
38 |
+
|
39 |
+
$installer->getConnection()->addColumn($installer->getTable('googleshopping/types'), 'category', array(
|
40 |
+
'TYPE' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
41 |
+
'LENGTH' => 40,
|
42 |
+
'COMMENT' => 'Google product category',
|
43 |
+
));
|
44 |
+
|
45 |
+
$installer->endSetup();
|
lib/Varien/Gdata/Gshopping/Content.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
-
* This source file is subject to the
|
8 |
-
* that is bundled with this package in the file
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://
|
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.
|
@@ -21,7 +21,7 @@
|
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://
|
25 |
*/
|
26 |
|
27 |
/**
|
@@ -43,6 +43,27 @@ class Varien_Gdata_Gshopping_Content extends Zend_Gdata
|
|
43 |
*/
|
44 |
protected $_accountId;
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
/**
|
47 |
* Array with namespaces for entry
|
48 |
*
|
@@ -186,9 +207,66 @@ class Varien_Gdata_Gshopping_Content extends Zend_Gdata
|
|
186 |
public function performHttpRequest($method, $url, $headers = null, $body = null, $contentType = null, $remainingRedirects = null)
|
187 |
{
|
188 |
try {
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
} catch (Zend_Gdata_App_HttpException $e) {
|
|
|
|
|
191 |
throw new Varien_Gdata_Gshopping_HttpException($e);
|
192 |
}
|
193 |
}
|
194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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.
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
/**
|
43 |
*/
|
44 |
protected $_accountId;
|
45 |
|
46 |
+
/**
|
47 |
+
* Debug flag
|
48 |
+
*
|
49 |
+
* @var bool
|
50 |
+
*/
|
51 |
+
protected $_debug = false;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Log adapter instance
|
55 |
+
*
|
56 |
+
* @var null|object
|
57 |
+
*/
|
58 |
+
protected $_logAdapter = null;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Log method name in log adapter
|
62 |
+
*
|
63 |
+
* @var string
|
64 |
+
*/
|
65 |
+
protected $_logAdapterLogAction;
|
66 |
+
|
67 |
/**
|
68 |
* Array with namespaces for entry
|
69 |
*
|
207 |
public function performHttpRequest($method, $url, $headers = null, $body = null, $contentType = null, $remainingRedirects = null)
|
208 |
{
|
209 |
try {
|
210 |
+
$url .= '?warnings';
|
211 |
+
$debugData = array(
|
212 |
+
'method' => $method,
|
213 |
+
'url' => $url,
|
214 |
+
'headers' => $headers,
|
215 |
+
'body' => $body,
|
216 |
+
'content_type' => $contentType,
|
217 |
+
'remaining_redirects' => $remainingRedirects
|
218 |
+
);
|
219 |
+
$result = parent::performHttpRequest($method, $url, $headers, $body, $contentType, $remainingRedirects);
|
220 |
+
$debugData['response'] = $result;
|
221 |
+
$this->debugData($debugData);
|
222 |
+
return $result;
|
223 |
} catch (Zend_Gdata_App_HttpException $e) {
|
224 |
+
$debugData['response'] = $e->getResponse();
|
225 |
+
$this->debugData($debugData);
|
226 |
throw new Varien_Gdata_Gshopping_HttpException($e);
|
227 |
}
|
228 |
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Log debug data
|
232 |
+
*
|
233 |
+
* @param mixed $debugData
|
234 |
+
* @return Varien_Gdata_Gshopping_Content
|
235 |
+
*/
|
236 |
+
public function debugData($debugData)
|
237 |
+
{
|
238 |
+
if ($this->_debug && !is_null($this->_logAdapter)) {
|
239 |
+
$method = $this->_logAdapterLogAction;
|
240 |
+
$this->_logAdapter->$method($debugData);
|
241 |
+
}
|
242 |
+
return $this;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Set debug flag
|
247 |
+
*
|
248 |
+
* @param bool $flag
|
249 |
+
* @return Varien_Gdata_Gshopping_Content
|
250 |
+
*/
|
251 |
+
public function setDebug($flag)
|
252 |
+
{
|
253 |
+
$this->_debug = $flag;
|
254 |
+
return $this;
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Set log adapter
|
259 |
+
*
|
260 |
+
* @param object $instance
|
261 |
+
* @param string $method
|
262 |
+
* @return Varien_Gdata_Gshopping_Content
|
263 |
+
*/
|
264 |
+
public function setLogAdapter($instance, $method)
|
265 |
+
{
|
266 |
+
if (method_exists($instance, $method)) {
|
267 |
+
$this->_logAdapter = $instance;
|
268 |
+
$this->_logAdapterLogAction = $method;
|
269 |
+
}
|
270 |
+
return $this;
|
271 |
+
}
|
272 |
+
}
|
lib/Varien/Gdata/Gshopping/Entry.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
-
* This source file is subject to the
|
8 |
-
* that is bundled with this package in the file
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://
|
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.
|
@@ -21,7 +21,7 @@
|
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://
|
25 |
*/
|
26 |
|
27 |
/**
|
@@ -342,4 +342,4 @@ class Varien_Gdata_Gshopping_Entry extends Zend_Gdata_Entry
|
|
342 |
{
|
343 |
return strtolower(preg_replace('/[\s_]+/', '_', $name));
|
344 |
}
|
345 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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.
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
/**
|
342 |
{
|
343 |
return strtolower(preg_replace('/[\s_]+/', '_', $name));
|
344 |
}
|
345 |
+
}
|
lib/Varien/Gdata/Gshopping/Extension/Attribute.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
-
* This source file is subject to the
|
8 |
-
* that is bundled with this package in the file
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://
|
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.
|
@@ -21,7 +21,7 @@
|
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://
|
25 |
*/
|
26 |
|
27 |
/**
|
@@ -126,4 +126,4 @@ class Varien_Gdata_Gshopping_Extension_Attribute extends Zend_Gdata_App_Extensio
|
|
126 |
|
127 |
return $this;
|
128 |
}
|
129 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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.
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
/**
|
126 |
|
127 |
return $this;
|
128 |
}
|
129 |
+
}
|
lib/Varien/Gdata/Gshopping/Extension/Control.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
-
* This source file is subject to the
|
8 |
-
* that is bundled with this package in the file
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://
|
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.
|
@@ -21,7 +21,7 @@
|
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://
|
25 |
*/
|
26 |
|
27 |
/**
|
@@ -133,4 +133,4 @@ class Varien_Gdata_Gshopping_Extension_Control extends Zend_Gdata_App_Extension_
|
|
133 |
{
|
134 |
return $this->_destinations;
|
135 |
}
|
136 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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.
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
/**
|
133 |
{
|
134 |
return $this->_destinations;
|
135 |
}
|
136 |
+
}
|
lib/Varien/Gdata/Gshopping/Extension/Shipping.php
CHANGED
@@ -1,13 +1,14 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
|
|
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
-
* This source file is subject to the
|
8 |
-
* that is bundled with this package in the file
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://
|
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.
|
@@ -21,7 +22,7 @@
|
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://
|
25 |
*/
|
26 |
|
27 |
/**
|
@@ -91,4 +92,4 @@ class Varien_Gdata_Gshopping_Extension_Shipping extends Zend_Gdata_App_Extension
|
|
91 |
}
|
92 |
parent::takeChildFromDOM($child);
|
93 |
}
|
94 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
*
|
6 |
* NOTICE OF LICENSE
|
7 |
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
* If you did not receive a copy of the license and are unable to
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
22 |
* @category Varien
|
23 |
* @package Varien_Gdata
|
24 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
|
28 |
/**
|
92 |
}
|
93 |
parent::takeChildFromDOM($child);
|
94 |
}
|
95 |
+
}
|
lib/Varien/Gdata/Gshopping/Extension/Tax.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
-
* This source file is subject to the
|
8 |
-
* that is bundled with this package in the file
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://
|
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.
|
@@ -21,7 +21,7 @@
|
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://
|
25 |
*/
|
26 |
|
27 |
/**
|
@@ -91,4 +91,4 @@ class Varien_Gdata_Gshopping_Extension_Tax extends Zend_Gdata_App_Extension_Elem
|
|
91 |
}
|
92 |
parent::takeChildFromDOM($child);
|
93 |
}
|
94 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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.
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
/**
|
91 |
}
|
92 |
parent::takeChildFromDOM($child);
|
93 |
}
|
94 |
+
}
|
lib/Varien/Gdata/Gshopping/HttpException.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
-
* This source file is subject to the
|
8 |
-
* that is bundled with this package in the file
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://
|
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.
|
@@ -21,7 +21,7 @@
|
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://
|
25 |
*/
|
26 |
|
27 |
/**
|
@@ -163,4 +163,4 @@ class Varien_Gdata_Gshopping_HttpException extends Zend_Gdata_App_HttpException
|
|
163 |
}
|
164 |
return $this;
|
165 |
}
|
166 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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.
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
/**
|
163 |
}
|
164 |
return $this;
|
165 |
}
|
166 |
+
}
|
lib/Varien/Gdata/Gshopping/ItemQuery.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
-
* This source file is subject to the
|
8 |
-
* that is bundled with this package in the file
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://
|
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.
|
@@ -21,7 +21,7 @@
|
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://
|
25 |
*/
|
26 |
|
27 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Magento
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-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.
|
21 |
* @category Varien
|
22 |
* @package Varien_Gdata
|
23 |
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
/**
|
package.xml
CHANGED
@@ -1,22 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mage_GoogleShopping</name>
|
4 |
-
<version>0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Google Content API for Shopping</summary>
|
10 |
-
<description>
|
11 |
-
Google Base Data API will be fully retired on June 1, 2011 and merchants using Base API to upload products to Google should migrate to new Content API till that time. 
|
12 |
-

|
13 |
-
This extension covers the new Content API logic and it is designed for managing merchant item being uploaded to Google Base — in Magento it will simply replace the current Google Base API logic.
|
14 |
</description>
|
15 |
-
<notes>Available for: EE 1.
|
16 |
<authors><author><name>Magento Core Team</name><user>core</user><email>core@magentocommerce.com</email></author></authors>
|
17 |
-
<date>2011-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magecore"><dir name="Mage"><dir name="GoogleShopping"><dir name="Block"><dir name="Adminhtml"><file name="Captcha.php" hash="ea05eb2061e8e437582c4caf058c66d7"/><dir name="Items"><file name="Item.php" hash="
|
20 |
<compatible/>
|
21 |
-
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mage_GoogleShopping</name>
|
4 |
+
<version>1.6.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Google Content API for Shopping</summary>
|
10 |
+
<description>This extension covers the new Content API logic and it is designed for managing merchant item being uploaded to Google Base — in Magento it will simply replace the current Google Base API logic.
|
|
|
|
|
|
|
11 |
</description>
|
12 |
+
<notes>Available for: EE 1.11.0.0, PE 1.11.0.0, CE 1.6.0.0</notes>
|
13 |
<authors><author><name>Magento Core Team</name><user>core</user><email>core@magentocommerce.com</email></author></authors>
|
14 |
+
<date>2011-09-27</date>
|
15 |
+
<time>18:22:28</time>
|
16 |
+
<contents><target name="magecore"><dir name="Mage"><dir name="GoogleShopping"><dir name="Block"><dir name="Adminhtml"><file name="Captcha.php" hash="ea05eb2061e8e437582c4caf058c66d7"/><dir name="Items"><file name="Item.php" hash="9a3fc54ada4628ce366c9fb48b8dc480"/><file name="Product.php" hash="61aed8d6d40c0aaca0d25645693d4ebd"/><dir name="Renderer"><file name="Id.php" hash="cefa0391a8b3813d3e202a5d0f139fbe"/></dir></dir><file name="Items.php" hash="294888165eb0466eda558f73dd7289af"/><dir name="Store"><file name="Switcher.php" hash="ab15774cdaf0e952a3f81a0b2284e0d5"/></dir><dir name="Types"><dir name="Edit"><file name="Attributes.php" hash="d8c2b7a504b976bacc033e7e68d3e200"/><file name="Form.php" hash="ba8a02d545ccffbf6e3637d3c4d94f72"/><file name="Select.php" hash="6da0a303340669857a1e8616f32ea2ba"/></dir><file name="Edit.php" hash="216bbf408dec87b4947fc40404482444"/><file name="Grid.php" hash="f0f520d4f546e105f2d09c7f25b3b0f1"/><dir name="Renderer"><file name="Country.php" hash="de8f08ac971c2fac89f4ee8e19c1743c"/></dir></dir><file name="Types.php" hash="49406cbf81bfc30319238d62c3c0a421"/></dir></dir><dir name="Helper"><file name="Category.php" hash="24efa624e2f07fb729a77973de969cfe"/><file name="Data.php" hash="3260a53e4f38875a80643ec8258e27bf"/><file name="Price.php" hash="17f6cbcdba36b50dd6d5630bfb3f1f40"/><file name="Product.php" hash="2de2d41ea134a5973677181cd268141f"/></dir><dir name="Model"><dir name="Attribute"><file name="Availability.php" hash="daca8e2b912ad40711689c11efd57e21"/><file name="Condition.php" hash="b73009ebfdf6cf55460a4678e3a0a022"/><file name="Content.php" hash="64636a4857fbf73d682c657c3022377d"/><file name="ContentLanguage.php" hash="ebbd5379070a14001abe9eeffabb6ca5"/><file name="Default.php" hash="d7e21c2adf8214342ea0b004274fd54a"/><file name="Destinations.php" hash="d92aa128ed7633f4547ca75d698031c7"/><file name="GoogleProductCategory.php" hash="09c9d0eae3e39a6e395eb5e4f750be71"/><file name="Id.php" hash="7e44ac3b7248b31655e5d4adeb9cbfdf"/><file name="ImageLink.php" hash="e1a35914393a9aeb83fbd4471b712063"/><file name="Link.php" hash="f02af7c3d3a48d90414f53fa6b5a2e39"/><file name="Price.php" hash="29b90e888f627c62f55865dd24749de4"/><file name="ProductType.php" hash="9b232fe6d3ade2553216e057c3507f12"/><file name="Quantity.php" hash="f19003712642137a7296d75174ac0dd3"/><file name="SalePriceEffectiveDate.php" hash="d628a45c0f5ad438520e54174acbd076"/><file name="ShippingWeight.php" hash="f06166d20e0c659426757e71ee4d1213"/><file name="TargetCountry.php" hash="f2bcb21c55b5ebba58b715071d1a47ef"/><file name="Tax.php" hash="8b012a19669daccf24d9ce0c7e3eb896"/><file name="Title.php" hash="edff637d4c7d006050d93a624c5adad2"/></dir><file name="Attribute.php" hash="dc0d78dcaf4659272dd377b2f56d6672"/><file name="Config.php" hash="19fd3c4d4f507b73e7cc5d9065e76df2"/><file name="Item.php" hash="5dfab25bf6a6d892b1a78a779cc64b31"/><file name="MassOperations.php" hash="8b9bebdcf2cb2077aedcb111584f6a3a"/><dir name="Mysql4"><dir name="Attribute"><file name="Collection.php" hash="bb3558471c5570af8fb365fa685100f1"/></dir><file name="Attribute.php" hash="e442368f9b82ae9db8fb33096f59d5f6"/><dir name="Item"><file name="Collection.php" hash="fd0a3b207dd16de6a98774b4630b0910"/></dir><file name="Item.php" hash="f81ac710c07a2da0499c0968d879b58b"/><dir name="Type"><file name="Collection.php" hash="083bf7f1343d6139f69bf4acb88a3e53"/></dir><file name="Type.php" hash="c00872c1434ce583df7d2923308d44dc"/></dir><file name="Observer.php" hash="0373e33117ab9a327299caaffb91658d"/><dir name="Resource"><dir name="Attribute"><file name="Collection.php" hash="183fecaf7657feacd305c3095cd44dd7"/></dir><file name="Attribute.php" hash="bd10d1b5b18f2b3bcd9c12303360ac38"/><dir name="Item"><file name="Collection.php" hash="6d38784b25505e41faa0ffebf41a9772"/></dir><file name="Item.php" hash="88054714027092a94ef932a3987ecda5"/><dir name="Type"><file name="Collection.php" hash="4234032149303495cf86d6960242d77c"/></dir><file name="Type.php" hash="f11c34fe7ced4e8e6b324f8117c6cadb"/></dir><dir name="Service"><file name="Item.php" hash="5404d55ce543908bef92bf85bbe3d1c8"/></dir><file name="Service.php" hash="7e50d9b3fc37f8b93e2e21e7ddaa06f3"/><dir name="Source"><file name="Accounttype.php" hash="67c3d9382c81764e8916e18e72999a7f"/><file name="Authtype.php" hash="6a8d921b4b3187aa1599e877f350698c"/><file name="Country.php" hash="d9fcb1b1a2bc5c102c5089dd398c4b67"/><file name="Destinationstates.php" hash="822f609ecbde48d41d24ececaacfe710"/><file name="Statuses.php" hash="df4d98192a9a5b6741f8591d5832b1b7"/></dir><file name="Type.php" hash="1307a8a32025b32c05650ffb64444d51"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Googleshopping"><file name="ItemsController.php" hash="05eb895ade70fae5bb50a0a5e2168fa9"/><file name="SelectionController.php" hash="81bd827f70cd2c735594dbea9e9f69b8"/><file name="TypesController.php" hash="04e2abe64c8d1a91fa919e50bab992f1"/></dir></dir></dir><dir name="data"><dir name="googleshopping_setup"><file name="data-install-1.6.0.0.php" hash="e0dd4af7846ab74de190fd72392ada1f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="07a794026267210b8df0b2c199ec120d"/><file name="config.xml" hash="e103eec2e524a3dfe6d9ad45f638f308"/><file name="system.xml" hash="efa04cb6665dfd4a6ba0893f0bafe159"/></dir><dir name="sql"><dir name="googleshopping_setup"><file name="install-1.6.0.0.php" hash="fa8bee454f714c73c0a5a7754e3d7fd0"/><file name="mysql4-data-install-0.2.0.php" hash="af7889c602512e2ae3919b3ba6c42ab9"/><file name="mysql4-install-0.2.0.php" hash="9bdbf6870e4ef8154f0a4a3d7b10a19a"/><file name="mysql4-upgrade-0.2.1-0.2.2.php" hash="65f4f4b5187a590eff013072aa5c30dd"/><file name="mysql4-upgrade-1.5.9.9-1.6.0.0.php" hash="16361053ace6f30804e7a9333ec8f935"/><file name="upgrade-1.6.0.0-1.6.0.0.1.php" hash="5a1ac1d248ed2594eaece4dd8f122ad3"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="googleshopping"><file name="captcha.phtml" hash="87dde00ae934ad825a4269cb0e4c9342"/><file name="items.phtml" hash="ce2b4eed794ef7a23c6a9e3c0bde002e"/><dir name="types"><dir name="edit"><file name="attributes.phtml" hash="aafc6e2f5b8abc264f6b457b243ce97a"/><file name="select.phtml" hash="2d02979ddc211171f1ff2085f40ddd47"/></dir><file name="edit.phtml" hash="f512b2c1468f4f8d7970c18162274ce5"/></dir></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="Varien"><dir name="Gdata"><dir name="Gshopping"><file name="Content.php" hash="c7068958fc703a7218928c776ef418ce"/><file name="Entry.php" hash="859e7f4ac186179c09fa47c1905fd056"/><dir name="Extension"><file name="Attribute.php" hash="79b90aa71c69919301ed4915651d2591"/><file name="Control.php" hash="7b15a224cee2784f5d34cafd36da8d2d"/><file name="Shipping.php" hash="9e0ff59b68f0437cf5f0119d552d2566"/><file name="Tax.php" hash="2d4d18d2e3bfe4cb3cb71b9fa2ad6a70"/></dir><file name="HttpException.php" hash="c2274331db8c5dfc48cd8df7c155ea3d"/><file name="ItemQuery.php" hash="cd3bd236e9bbbf1faf72f12dcffc743f"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_GoogleShopping.xml" hash="a87312ac5073f44d046483063160a91e"/></dir></target></contents>
|
17 |
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.7</max></package></required></dependencies>
|
19 |
</package>
|