Skip to content

Commit 5f01ac9

Browse files
committed
Fixed conflicts
1 parent 90fefd7 commit 5f01ac9

File tree

55 files changed

+742
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+742
-218
lines changed

app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ protected function _prepareForm()
5757
'disabled' => $isElementDisabled
5858
]);
5959

60+
$fieldset->addField('meta_robots', 'select', array(
61+
'name' => 'meta_robots',
62+
'label' => Mage::helper('cms')->__('Robots'),
63+
'title' => Mage::helper('cms')->__('Meta Robots'),
64+
'options' => $model->getAvailableRobots(),
65+
'disabled' => $isElementDisabled
66+
));
67+
6068
Mage::dispatchEvent('adminhtml_cms_page_edit_tab_meta_prepare_form', ['form' => $form]);
6169

6270
$form->setValues($model->getData());

app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Robots.php

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public function toOptionArray()
2626
['value' => 'NOINDEX,FOLLOW', 'label' => 'NOINDEX, FOLLOW'],
2727
['value' => 'INDEX,NOFOLLOW', 'label' => 'INDEX, NOFOLLOW'],
2828
['value' => 'NOINDEX,NOFOLLOW', 'label' => 'NOINDEX, NOFOLLOW'],
29+
['value' => 'INDEX,FOLLOW,NOARCHIVE', 'label' => 'INDEX, FOLLOW, NOARCHIVE'],
30+
['value' => 'INDEX,NOINDEX,NOARCHIVE', 'label' => 'INDEX, NOINDEX, NOARCHIVE'],
31+
['value' => 'NOINDEX,NOFOLLOW,NOARCHIVE', 'label' => 'NOINDEX, NOFOLLOW, NOARCHIVE'],
2932
];
3033
}
3134
}

app/code/core/Mage/Catalog/Block/Category/View.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,20 @@ protected function _prepareLayout()
4747

4848
/** @var Mage_Catalog_Helper_Category $helper */
4949
$helper = $this->helper('catalog/category');
50+
51+
if ($robots = $category->getMetaRobots()) {
52+
if ($helper->canUseNoindexFollow() && Mage::helper('catalog/category')->isNotFirstCategoryPage()) {
53+
$headBlock->setRobots(Mage::getSingleton('catalog/category_attribute_source_robots')->getOptionLabel(3));
54+
} else {
55+
$headBlock->setRobots(Mage::getSingleton('catalog/category_attribute_source_robots')->getOptionLabel($robots));
56+
}
57+
}
58+
5059
if ($helper->canUseCanonicalTag()) {
5160
$headBlock->addLinkRel('canonical', $category->getUrl());
5261
}
53-
/*
54-
want to show rss feed in the url
55-
*/
62+
63+
// want to show rss feed in the url
5664
if ($this->isRssCatalogEnable() && $this->isTopCategory()) {
5765
$title = $this->helper('rss')->__('%s RSS Feed', $this->getCurrentCategory()->getName());
5866
$headBlock->addItem('rss', $this->getRssLink(), 'title="' . $title . '"');

app/code/core/Mage/Catalog/Block/Product/View.php

+6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ protected function _prepareLayout()
6565
} else {
6666
$headBlock->setDescription(Mage::helper('core/string')->substr($product->getDescription(), 0, 255));
6767
}
68+
$robots = $product->getMetaRobots();
69+
if ($robots) {
70+
$headBlock->setRobots(Mage::getSingleton('catalog/product_attribute_source_robots')->getOptionLabel($robots));
71+
} else {
72+
$headBlock->setRobots(Mage::getStoreConfig('design/head/default_robots'));
73+
}
6874

6975
/** @var Mage_Catalog_Helper_Product $helper */
7076
$helper = $this->helper('catalog/product');

app/code/core/Mage/Catalog/Helper/Category.php

+26
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Mage_Catalog_Helper_Category extends Mage_Core_Helper_Abstract
2424
public const XML_PATH_CATEGORY_URL_SUFFIX = 'catalog/seo/category_url_suffix';
2525
public const XML_PATH_USE_CATEGORY_CANONICAL_TAG = 'catalog/seo/category_canonical_tag';
2626
public const XML_PATH_CATEGORY_ROOT_ID = 'catalog/category/root_id';
27+
public const XML_PATH_CHANGE_CATEGORY_PAGES_ROBOTS = 'catalog/seo/category_pages_robots';
2728

2829
protected $_moduleName = 'Mage_Catalog';
2930

@@ -173,4 +174,29 @@ public function canUseCanonicalTag($store = null)
173174
{
174175
return Mage::getStoreConfig(self::XML_PATH_USE_CATEGORY_CANONICAL_TAG, $store);
175176
}
177+
178+
/**
179+
* Check if Robots NOINDEX,FOLLOW can be used for category pages
180+
*
181+
* @param null|string|bool|int|Mage_Core_Model_Store $store
182+
* @return bool
183+
*/
184+
public function canUseNoindexFollow($store = null)
185+
{
186+
return Mage::getStoreConfig(self::XML_PATH_CHANGE_CATEGORY_PAGES_ROBOTS, $store);
187+
}
188+
189+
190+
/**
191+
* Check if current category is first page
192+
*
193+
* @return boolean
194+
*/
195+
public function isNotFirstCategoryPage() {
196+
$url = Mage::helper('core/url')->getCurrentUrl();
197+
$parsedUrl = parse_url($url);
198+
if(isset($parsedUrl['query']) && (preg_match("/p=/i", $parsedUrl['query'])) && (!preg_match("/p=1/i", $parsedUrl['query']))){
199+
return true;
200+
}
201+
}
176202
}

app/code/core/Mage/Catalog/Model/Api2/Product.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function _isAttributeVisible(Mage_Catalog_Model_Resource_Eav_Attribute
6969
} else {
7070
$systemAttributesForNonAdmin = [
7171
'sku', 'name', 'short_description', 'description', 'tier_price', 'meta_title', 'meta_description',
72-
'meta_keyword',
72+
'meta_keyword', 'meta_robot'
7373
];
7474
if ($attribute->getIsUserDefined()) {
7575
$isAttributeVisible = $attribute->getIsVisibleOnFront();

app/code/core/Mage/Catalog/Model/Category.php

+15
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
*
5757
* @method string getMetaDescription()
5858
* @method string getMetaKeywords()
59+
* @method int getMetaRobots()
5960
* @method string getMetaTitle()
6061
* @method int getMovedCategoryId()
6162
*
@@ -93,6 +94,20 @@ class Mage_Catalog_Model_Category extends Mage_Catalog_Model_Abstract
9394

9495
public const CACHE_TAG = 'catalog_category';
9596

97+
/**
98+
* Category robots
99+
*/
100+
public const META_ROBOTS_INDEX_FOLLOW = 1;
101+
public const META_ROBOTS_INDEX_NOFOLLOW = 2;
102+
public const META_ROBOTS_NOINDEX_FOLLOW = 3;
103+
public const META_ROBOTS_NOINDEX_NOFOLLOW = 4;
104+
public const META_ROBOTS_INDEX_FOLLOW_NOARCHIVE = 5;
105+
public const META_ROBOTS_INDEX_NOFOLLOW_NOARCHIVE = 6;
106+
public const META_ROBOTS_NOINDEX_NOFOLLOW_NOARCHIVE = 7;
107+
108+
109+
const CACHE_TAG = 'catalog_category';
110+
96111
/**
97112
* Prefix of model events names
98113
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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 [email protected] 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.magento.com for more information.
20+
*
21+
* @category Mage
22+
* @package Mage_Catalog
23+
* @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
24+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25+
*/
26+
27+
/**
28+
* Catalog category robots attribute source
29+
*
30+
* @category Mage
31+
* @package Mage_Catalog
32+
* @author Magento Core Team <[email protected]>
33+
*/
34+
class Mage_Catalog_Model_Category_Attribute_Source_Robots extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
35+
{
36+
/**
37+
* @return array
38+
*/
39+
public function getAllOptions()
40+
{
41+
return array(
42+
Mage_Catalog_Model_Category::META_ROBOTS_INDEX_FOLLOW =>
43+
array(
44+
'value' => Mage_Catalog_Model_Category::META_ROBOTS_INDEX_FOLLOW,
45+
'label' => Mage::helper('cms')->__('INDEX,FOLLOW')
46+
),
47+
Mage_Catalog_Model_Category::META_ROBOTS_INDEX_NOFOLLOW =>
48+
array(
49+
'value' => Mage_Catalog_Model_Category::META_ROBOTS_INDEX_NOFOLLOW,
50+
'label' => Mage::helper('cms')->__('INDEX,NOFOLLOW')
51+
),
52+
Mage_Catalog_Model_Category::META_ROBOTS_NOINDEX_FOLLOW =>
53+
array(
54+
'value' => Mage_Catalog_Model_Category::META_ROBOTS_NOINDEX_FOLLOW,
55+
'label' => Mage::helper('cms')->__('NOINDEX,FOLLOW')
56+
),
57+
Mage_Catalog_Model_Category::META_ROBOTS_NOINDEX_NOFOLLOW =>
58+
array(
59+
'value' => Mage_Catalog_Model_Category::META_ROBOTS_NOINDEX_NOFOLLOW,
60+
'label' => Mage::helper('cms')->__('NOINDEX,NOFOLLOW')
61+
),
62+
Mage_Catalog_Model_Category::META_ROBOTS_INDEX_FOLLOW_NOARCHIVE =>
63+
array(
64+
'value' => Mage_Catalog_Model_Category::META_ROBOTS_INDEX_FOLLOW_NOARCHIVE,
65+
'label' => Mage::helper('cms')->__('INDEX,FOLLOW,NOARCHIVE')
66+
),
67+
Mage_Catalog_Model_Category::META_ROBOTS_INDEX_NOFOLLOW_NOARCHIVE =>
68+
array(
69+
'value' => Mage_Catalog_Model_Category::META_ROBOTS_INDEX_NOFOLLOW_NOARCHIVE,
70+
'label' => Mage::helper('cms')->__('INDEX,NOFOLLOW,NOARCHIVE')
71+
),
72+
Mage_Catalog_Model_Category::META_ROBOTS_NOINDEX_NOFOLLOW_NOARCHIVE =>
73+
array(
74+
'value' => Mage_Catalog_Model_Category::META_ROBOTS_NOINDEX_NOFOLLOW_NOARCHIVE,
75+
'label' => Mage::helper('cms')->__('NOINDEX,NOFOLLOW,NOARCHIVE')
76+
),
77+
);
78+
}
79+
80+
/**
81+
* @param int $key
82+
* @return string
83+
*/
84+
public function getOptionLabel($key) {
85+
$options = $this->getAllOptions();
86+
87+
return $options[$key]['label'];
88+
}
89+
}

app/code/core/Mage/Catalog/Model/Product.php

+13
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
* @method array getMediaGallery()
136136
* @method $this setMediaGallery(array $value)
137137
* @method string getMessage()
138+
* @method int getMetaRobot()
138139
* @method string getMetaDescription()
139140
* @method string getMetaKeyword()
140141
* @method string getMetaTitle()
@@ -262,6 +263,18 @@ class Mage_Catalog_Model_Product extends Mage_Catalog_Model_Abstract
262263
*/
263264
public const ENTITY = 'catalog_product';
264265
public const CACHE_TAG = 'catalog_product';
266+
267+
/**
268+
* Product robots
269+
*/
270+
public const META_ROBOTS_INDEX_FOLLOW = 1;
271+
public const META_ROBOTS_INDEX_NOFOLLOW = 2;
272+
public const META_ROBOTS_NOINDEX_FOLLOW = 3;
273+
public const META_ROBOTS_NOINDEX_NOFOLLOW = 4;
274+
public const META_ROBOTS_INDEX_FOLLOW_NOARCHIVE = 5;
275+
public const META_ROBOTS_INDEX_NOFOLLOW_NOARCHIVE = 6;
276+
public const META_ROBOTS_NOINDEX_NOFOLLOW_NOARCHIVE = 7;
277+
265278
protected $_cacheTag = 'catalog_product';
266279
protected $_eventPrefix = 'catalog_product';
267280
protected $_eventObject = 'product';

app/code/core/Mage/Catalog/Model/Product/Api.php

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class Mage_Catalog_Model_Product_Api extends Mage_Catalog_Model_Api_Resource
5151
'meta_title',
5252
'meta_keyword',
5353
'meta_description',
54+
'meta_robot',
5455
'custom_design',
5556
'custom_layout_update',
5657
'options_container',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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 [email protected] 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.magento.com for more information.
20+
*
21+
* @category Mage
22+
* @package Mage_Catalog
23+
* @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
24+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25+
*/
26+
27+
/**
28+
* Catalog product robots attribute source
29+
*
30+
* @category Mage
31+
* @package Mage_Catalog
32+
* @author Magento Core Team <[email protected]>
33+
*/
34+
class Mage_Catalog_Model_Product_Attribute_Source_Robots extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
35+
{
36+
/**
37+
* @return array
38+
*/
39+
public function getAllOptions()
40+
{
41+
return array(
42+
Mage_Catalog_Model_Product::META_ROBOTS_INDEX_FOLLOW =>
43+
array(
44+
'value' => Mage_Catalog_Model_Product::META_ROBOTS_INDEX_FOLLOW,
45+
'label' => Mage::helper('cms')->__('INDEX,FOLLOW')
46+
),
47+
Mage_Catalog_Model_Product::META_ROBOTS_INDEX_NOFOLLOW =>
48+
array(
49+
'value' => Mage_Catalog_Model_Product::META_ROBOTS_INDEX_NOFOLLOW,
50+
'label' => Mage::helper('cms')->__('INDEX,NOFOLLOW')
51+
),
52+
Mage_Catalog_Model_Product::META_ROBOTS_NOINDEX_FOLLOW =>
53+
array(
54+
'value' => Mage_Catalog_Model_Product::META_ROBOTS_NOINDEX_FOLLOW,
55+
'label' => Mage::helper('cms')->__('NOINDEX,FOLLOW')
56+
),
57+
Mage_Catalog_Model_Product::META_ROBOTS_NOINDEX_NOFOLLOW =>
58+
array(
59+
'value' => Mage_Catalog_Model_Product::META_ROBOTS_NOINDEX_NOFOLLOW,
60+
'label' => Mage::helper('cms')->__('NOINDEX,NOFOLLOW')
61+
),
62+
Mage_Catalog_Model_Product::META_ROBOTS_INDEX_FOLLOW_NOARCHIVE =>
63+
array(
64+
'value' => Mage_Catalog_Model_Product::META_ROBOTS_INDEX_FOLLOW_NOARCHIVE,
65+
'label' => Mage::helper('cms')->__('INDEX,FOLLOW,NOARCHIVE')
66+
),
67+
Mage_Catalog_Model_Product::META_ROBOTS_INDEX_NOFOLLOW_NOARCHIVE =>
68+
array(
69+
'value' => Mage_Catalog_Model_Product::META_ROBOTS_INDEX_NOFOLLOW_NOARCHIVE,
70+
'label' => Mage::helper('cms')->__('INDEX,NOFOLLOW,NOARCHIVE')
71+
),
72+
Mage_Catalog_Model_Product::META_ROBOTS_NOINDEX_NOFOLLOW_NOARCHIVE =>
73+
array(
74+
'value' => Mage_Catalog_Model_Product::META_ROBOTS_NOINDEX_NOFOLLOW_NOARCHIVE,
75+
'label' => Mage::helper('cms')->__('NOINDEX,NOFOLLOW,NOARCHIVE')
76+
),
77+
);
78+
}
79+
80+
/**
81+
* @param int $key
82+
* @return string
83+
*/
84+
public function getOptionLabel($key) {
85+
$options = $this->getAllOptions();
86+
87+
return $options[$key]['label'];
88+
}
89+
}

app/code/core/Mage/Catalog/Model/Resource/Setup.php

+20
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ public function getDefaultEntities()
147147
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
148148
'group' => 'General Information',
149149
],
150+
'meta_robots' => [
151+
'type' => 'int',
152+
'label' => 'Robots',
153+
'input' => 'select',
154+
'source' => 'catalog/category_attribute_source_robots',
155+
'required' => false,
156+
'sort_order' => 9,
157+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
158+
'group' => 'General Information',
159+
],
150160
'display_mode' => [
151161
'type' => 'varchar',
152162
'label' => 'Display Mode',
@@ -516,6 +526,16 @@ public function getDefaultEntities()
516526
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
517527
'group' => 'Meta Information',
518528
],
529+
'meta_robots' => [
530+
'type' => 'int',
531+
'label' => 'Robots',
532+
'input' => 'select',
533+
'source' => 'catalog/product_attribute_source_robots',
534+
'default' => '1',
535+
'sort_order' => 4,
536+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
537+
'group' => 'Meta Information',
538+
],
519539
'image' => [
520540
'type' => 'varchar',
521541
'label' => 'Base Image',

app/code/core/Mage/Catalog/controllers/Product/CompareController.php

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function indexAction()
5353
}
5454

5555
$this->loadLayout();
56+
$this->getLayout()->getBlock('head')->setRobots(Mage::getStoreConfig('web/robots_configuration/compare'));
5657
$this->renderLayout();
5758
}
5859

0 commit comments

Comments
 (0)