Version Notes
Introducing the first version of simple seo
Download this release
Release Info
Developer | Hitesh Agrawal |
Extension | Kvh_Simpleseo |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
app/code/local/Kvh/SimpleSeo/Block/Catalog/Category/View.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Catalog
|
23 |
+
* @copyright Copyright (c) 2013 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 |
+
* Category View block
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Catalog
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Kvh_Simpleseo_Block_Catalog_Category_View extends Mage_Catalog_Block_Category_View
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* Add meta information from product to head block
|
38 |
+
*
|
39 |
+
* @return Mage_Catalog_Block_Product_View
|
40 |
+
*/
|
41 |
+
protected function _prepareLayout()
|
42 |
+
{
|
43 |
+
parent::_prepareLayout();
|
44 |
+
|
45 |
+
$simpleseo_enable = Mage::getStoreConfig('catalog/simpleseo/simpleseo_enable');
|
46 |
+
|
47 |
+
if(!$simpleseo_enable) return;
|
48 |
+
|
49 |
+
$category_meta_title = Mage::getStoreConfig('catalog/simpleseo/category_meta_title');
|
50 |
+
$category_meta_keyword = Mage::getStoreConfig('catalog/simpleseo/category_meta_keyword');
|
51 |
+
$category_meta_description = Mage::getStoreConfig('catalog/simpleseo/category_meta_description');
|
52 |
+
|
53 |
+
$string=$category_meta_title." ".$category_meta_keyword." ".$category_meta_description;
|
54 |
+
|
55 |
+
preg_match_all("/\[(.*?)\]/",$string,$words);
|
56 |
+
|
57 |
+
|
58 |
+
$category = $this->getCurrentCategory();
|
59 |
+
|
60 |
+
$word=array_unique($words[1]);
|
61 |
+
|
62 |
+
|
63 |
+
foreach($word as $w)
|
64 |
+
{
|
65 |
+
$p= strpos($w,'category_');
|
66 |
+
|
67 |
+
if($p==0)
|
68 |
+
{
|
69 |
+
$attribute=substr($w,9);
|
70 |
+
$attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode("catalog_category",$attribute);
|
71 |
+
|
72 |
+
$attrtype=$attributeModel->getFrontendInput();
|
73 |
+
|
74 |
+
switch($attrtype)
|
75 |
+
{
|
76 |
+
case "text":
|
77 |
+
$data=$category->getData($attribute);
|
78 |
+
break;
|
79 |
+
case "select":
|
80 |
+
$data=$category->getAttributeText($attribute);
|
81 |
+
break;
|
82 |
+
|
83 |
+
}
|
84 |
+
$category_meta_title=str_replace("[".$w."]",$data,$category_meta_title);
|
85 |
+
$category_meta_keyword=str_replace("[".$w."]",$data,$category_meta_keyword);
|
86 |
+
$category_meta_description=str_replace("[".$w."]",$data,$category_meta_description);
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
90 |
+
$headBlock = $this->getLayout()->getBlock('head');
|
91 |
+
if ($headBlock) {
|
92 |
+
|
93 |
+
$title = $category->getMetaTitle();
|
94 |
+
|
95 |
+
if (!$title) {
|
96 |
+
$headBlock->setTitle($category_meta_title);
|
97 |
+
}
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
|
102 |
+
$keyword = $category->getMetaKeyword();
|
103 |
+
|
104 |
+
if (!$keyword) {
|
105 |
+
$headBlock->setKeywords($category_meta_keyword);
|
106 |
+
}
|
107 |
+
|
108 |
+
$description = $category->getMetaDescription();
|
109 |
+
if (!$description) {
|
110 |
+
$headBlock->setDescription($category_meta_description);
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
}
|
app/code/local/Kvh/SimpleSeo/Block/Catalog/Product/View.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
|
4 |
+
*
|
5 |
+
* @category CP
|
6 |
+
* @package CP_Catalog
|
7 |
+
* @author CP
|
8 |
+
*/
|
9 |
+
class Kvh_Simpleseo_Block_Catalog_Product_View extends Mage_Catalog_Block_Product_View
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Add meta information from product to head block
|
13 |
+
*
|
14 |
+
* @return Mage_Catalog_Block_Product_View
|
15 |
+
*/
|
16 |
+
protected function _prepareLayout()
|
17 |
+
{
|
18 |
+
parent::_prepareLayout();
|
19 |
+
|
20 |
+
$simpleseo_enable = Mage::getStoreConfig('catalog/simpleseo/simpleseo_enable');
|
21 |
+
|
22 |
+
if(!$simpleseo_enable) return;
|
23 |
+
|
24 |
+
$product_meta_title = Mage::getStoreConfig('catalog/simpleseo/product_meta_title');
|
25 |
+
$product_meta_keyword = Mage::getStoreConfig('catalog/simpleseo/product_meta_keyword');
|
26 |
+
$product_meta_description = Mage::getStoreConfig('catalog/simpleseo/product_meta_description');
|
27 |
+
|
28 |
+
$string=$product_meta_title." ".$product_meta_keyword." ".$product_meta_description;
|
29 |
+
|
30 |
+
preg_match_all("/\[(.*?)\]/",$string,$words);
|
31 |
+
|
32 |
+
|
33 |
+
$product = $this->getProduct();
|
34 |
+
|
35 |
+
$word=array_unique($words[1]);
|
36 |
+
|
37 |
+
|
38 |
+
foreach($word as $w)
|
39 |
+
{
|
40 |
+
$p= strpos($w,'product_');
|
41 |
+
|
42 |
+
if($p==0)
|
43 |
+
{
|
44 |
+
$attribute=substr($w,8);
|
45 |
+
$attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode("catalog_product",$attribute);
|
46 |
+
|
47 |
+
$attrtype=$attributeModel->getFrontendInput();
|
48 |
+
|
49 |
+
switch($attrtype)
|
50 |
+
{
|
51 |
+
case "text":
|
52 |
+
$data=$product->getData($attribute);
|
53 |
+
break;
|
54 |
+
case "select":
|
55 |
+
$data=$product->getAttributeText($attribute);
|
56 |
+
break;
|
57 |
+
|
58 |
+
}
|
59 |
+
$product_meta_title=str_replace("[".$w."]",$data,$product_meta_title);
|
60 |
+
$product_meta_keyword=str_replace("[".$w."]",$data,$product_meta_keyword);
|
61 |
+
$product_meta_description=str_replace("[".$w."]",$data,$product_meta_description);
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
65 |
+
$headBlock = $this->getLayout()->getBlock('head');
|
66 |
+
if ($headBlock) {
|
67 |
+
|
68 |
+
$title = $product->getMetaTitle();
|
69 |
+
|
70 |
+
if (!$title) {
|
71 |
+
$headBlock->setTitle($product_meta_title);
|
72 |
+
}
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
$keyword = $product->getMetaKeyword();
|
78 |
+
|
79 |
+
if (!$keyword) {
|
80 |
+
$headBlock->setKeywords($product_meta_keyword);
|
81 |
+
}
|
82 |
+
|
83 |
+
$description = $product->getMetaDescription();
|
84 |
+
if (!$description) {
|
85 |
+
$headBlock->setDescription($product_meta_description);
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
}
|
app/code/local/Kvh/SimpleSeo/etc/config.xml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Kvh_Simpleseo>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Kvh_Simpleseo>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
|
11 |
+
|
12 |
+
<blocks>
|
13 |
+
<simpleseo>
|
14 |
+
<class>Kvh_Simpleseo_Block</class>
|
15 |
+
</simpleseo>
|
16 |
+
<catalog>
|
17 |
+
<rewrite>
|
18 |
+
<product_view>Kvh_Simpleseo_Block_Catalog_Product_View</product_view>
|
19 |
+
<category_view>Kvh_Simpleseo_Block_Catalog_Category_View</category_view>
|
20 |
+
</rewrite>
|
21 |
+
</catalog>
|
22 |
+
</blocks>
|
23 |
+
</global>
|
24 |
+
</config>
|
app/code/local/Kvh/SimpleSeo/etc/system.xml
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
|
3 |
+
|
4 |
+
<sections>
|
5 |
+
<catalog>
|
6 |
+
<groups>
|
7 |
+
<simpleseo translate="label">
|
8 |
+
<label>Simple Seo</label>
|
9 |
+
<frontend_type>text</frontend_type>
|
10 |
+
<sort_order>50</sort_order>
|
11 |
+
<show_in_default>1</show_in_default>
|
12 |
+
<show_in_website>1</show_in_website>
|
13 |
+
<show_in_store>1</show_in_store>
|
14 |
+
<fields>
|
15 |
+
<simpleseo_enable translate="label comment">
|
16 |
+
<label>Enable: </label>
|
17 |
+
<frontend_type>select</frontend_type>
|
18 |
+
<source_model>
|
19 |
+
adminhtml/system_config_source_yesno
|
20 |
+
</source_model>
|
21 |
+
<sort_order>0</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
</simpleseo_enable>
|
26 |
+
|
27 |
+
<category_meta_title translate="label">
|
28 |
+
<label>Category Meta Title Forumla
|
29 |
+
</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</category_meta_title>
|
36 |
+
<category_meta_keyword translate="label">
|
37 |
+
<label>Caegory Meta Keyword Forumla
|
38 |
+
</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>2</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</category_meta_keyword>
|
45 |
+
<category_meta_description translate="label">
|
46 |
+
<label>Category Meta Description Forumla
|
47 |
+
</label>
|
48 |
+
<frontend_type>textarea</frontend_type>
|
49 |
+
<sort_order>3</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</category_meta_description>
|
54 |
+
|
55 |
+
|
56 |
+
<product_meta_title translate="label">
|
57 |
+
<label>Products Meta Title Forumla
|
58 |
+
</label>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<sort_order>4</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</product_meta_title>
|
65 |
+
<product_meta_keyword translate="label">
|
66 |
+
<label>Products Meta Keyword Forumla
|
67 |
+
</label>
|
68 |
+
<frontend_type>text</frontend_type>
|
69 |
+
<sort_order>5</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
</product_meta_keyword>
|
74 |
+
<product_meta_description translate="label">
|
75 |
+
<label>Products Meta Description Forumla
|
76 |
+
</label>
|
77 |
+
<frontend_type>textarea</frontend_type>
|
78 |
+
<sort_order>6</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>1</show_in_store>
|
82 |
+
</product_meta_description>
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
</fields>
|
88 |
+
</simpleseo>
|
89 |
+
</groups>
|
90 |
+
|
91 |
+
</catalog>
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
+
|
96 |
+
</sections>
|
97 |
+
</config>
|
app/etc/modules/Kvh_Simpleseo.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
|
5 |
+
<modules>
|
6 |
+
|
7 |
+
<Kvh_Simpleseo>
|
8 |
+
|
9 |
+
<active>true</active>
|
10 |
+
|
11 |
+
<codePool>local</codePool>
|
12 |
+
|
13 |
+
</Kvh_Simpleseo>
|
14 |
+
|
15 |
+
</modules>
|
16 |
+
|
17 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Kvh_Simpleseo</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Simple Seo for Set Meta data on Fly</summary>
|
10 |
+
<description>SimpleSeo extension is use for set Dynamic Meta Data on Fly with a simple configuration
|
11 |
+

|
12 |
+
You can set Meta Title , Meta Keyword and Meta Description dynamic
|
13 |
+

|
14 |
+
Example if your product name is XYZ Product
|
15 |
+
and you want to set meta title like Buy XYZ Product from ABC Brand then you can set it by set configuration like
|
16 |
+
Buy [product_name] from [product_manufacturer] Brand
|
17 |
+

|
18 |
+
Instruction
|
19 |
+

|
20 |
+
1) Go to System > Configuration 
|
21 |
+
2) Select Catalog from left bar
|
22 |
+
3) Select Simple Seo Section
|
23 |
+
4) If you want to set the meta data formula then and want to use category attributes like name then you have to use like this
|
24 |
+
[category_name] Where category_ is the prefix and name is the category attribute, you have to use prefix category_ for category attributes and prefix product_ for product attribute, please check screenshot for more information
|
25 |
+

|
26 |
+
if you need any assistance for installation and configuration then contact us at kvhsolutions@gmail.com
|
27 |
+

|
28 |
+

|
29 |
+

|
30 |
+

|
31 |
+

|
32 |
+

|
33 |
+

|
34 |
+

|
35 |
+

|
36 |
+
</description>
|
37 |
+
<notes>Introducing the first version of simple seo</notes>
|
38 |
+
<authors><author><name>Hitesh Agrawal</name><user>hiteshmca111</user><email>hiteshagrawal84@gmail.com</email></author></authors>
|
39 |
+
<date>2014-04-19</date>
|
40 |
+
<time>10:00:34</time>
|
41 |
+
<contents><target name="magelocal"><dir name="Kvh"><dir name="SimpleSeo"><dir name="Block"><dir name="Catalog"><dir name="Category"><file name="View.php" hash="323bfab0a57537cf31bb194249d742b0"/></dir><dir name="Product"><file name="View.php" hash="e779f1ea6d2ebb5cb088f33874abe2ac"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="5fadf3f0393b37b97081a4523d33a9fd"/><file name="system.xml" hash="d211de5b39a2be97d9c9b34807df4de9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Kvh_Simpleseo.xml" hash="6cb871dc56b9e5b4e0b13ef121723011"/></dir></target></contents>
|
42 |
+
<compatible/>
|
43 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
44 |
+
</package>
|