Creare_DynamicSitemap - Version 1.0.0

Version Notes

no notes yet

Download this release

Release Info

Developer E-Commerce Web Design
Extension Creare_DynamicSitemap
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Creare/DynamicSitemap/Block/Dynamicsitemap.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Creare_DynamicSitemap_Block_Dynamicsitemap extends Mage_Core_Block_Template{
3
+
4
+ public function getCreareCMSPages(){
5
+
6
+ $cms = Mage::getModel('cms/page')->getCollection();
7
+ $url = Mage::getBaseUrl();
8
+ $html = "";
9
+ foreach($cms as $cmspage):
10
+ $page = $cmspage->getData();
11
+ if($page['identifier'] == "no-route" || $page['identifier'] == "enable-cookies" || $page['identifier'] == "empty"){ /* do nothing or something here */ } else {
12
+ if($page['identifier'] == "home"){
13
+ $html .= "<li><a href=\"$url\" title=\"".$page['title']."\">".$page['title']."</a></li>\n"; // this is for a nice local link to home
14
+ } else {
15
+ $html .= "<li><a href=\"$url".$page['identifier']."\" title=\"".$page['title']."\">".$page['title']."</a></li>\n";
16
+ }
17
+ }
18
+ endforeach;
19
+
20
+
21
+ return $html;
22
+ }
23
+
24
+ public function getCrearePopularProducts(){
25
+
26
+ /* get the product id's */
27
+
28
+ $products = array('4138','4137','4136','4132','4131','4125','4124','4120','3938','3932');
29
+ $html = "";
30
+
31
+ foreach($products as $productId):
32
+ $product = Mage::getModel('catalog/product')->load($productId);
33
+ $html .= "<li><a href=\"".$product->getUrlPath()."\" title=\"".$product->getName()."\">".$product->getName()."</a></li>\n";
34
+ endforeach;
35
+
36
+ return $html;
37
+
38
+ }
39
+
40
+
41
+
42
+
43
+ }
app/code/local/Creare/DynamicSitemap/controllers/IndexController.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Creare_DynamicSitemap_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+
5
+ protected function _prepareLayout() {
6
+
7
+ if ($headBlock = $this->getLayout()->getBlock('head')) {
8
+ $headBlock->setTitle($title);
9
+ }
10
+
11
+ return parent::_prepareLayout();
12
+ }
13
+
14
+ public function IndexAction() {
15
+
16
+ $this->loadLayout();
17
+ $this->renderLayout();
18
+
19
+ }
20
+ }
app/code/local/Creare/DynamicSitemap/etc/config.xml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Creare_DynamicSitemap>
5
+ <version>0.1.0</version>
6
+ </Creare_DynamicSitemap>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <dynamicsitemap>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Creare_DynamicSitemap</module>
14
+ <frontName>sitemap</frontName>
15
+ </args>
16
+ </dynamicsitemap>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <dynamicsitemap>
21
+ <file>dynamicsitemap.xml</file>
22
+ </dynamicsitemap>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <blocks>
28
+ <dynamicsitemap><class>Creare_DynamicSitemap_Block</class></dynamicsitemap>
29
+ </blocks>
30
+ </global>
31
+ </config>
app/design/frontend/default/default/layout/dynamicsitemap.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0">
3
+ <dynamicsitemap_index_index>
4
+
5
+ <reference name="root">
6
+ <action method="unsetChild"><alias>breadcrumbs</alias></action>
7
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
8
+ <!--<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs">
9
+ <action method="addCrumb">
10
+ <crumbName>Home</crumbName>
11
+ <crumbInfo>
12
+ <label>Home</label>
13
+ <title>Home</title>
14
+ <link>/home</link>
15
+ </crumbInfo>
16
+ </action>
17
+ <action method="addCrumb">
18
+ <crumbName>Sitemap</crumbName>
19
+ <crumbInfo>
20
+ <label>Sitemap</label>
21
+ <title>Sitemap</title>
22
+ </crumbInfo>
23
+ </action>
24
+ </block> -->
25
+ </reference>
26
+
27
+ <reference name="head">
28
+ <action method="setTitle" translate="title"><title>Sitemap</title></action>
29
+ <action method="addCss"><stylesheet>css/dynamicsitemap.css</stylesheet></action>
30
+ </reference>
31
+
32
+ <reference name="content">
33
+ <block type="dynamicsitemap/dynamicsitemap" name="dynamicsitemap.dynamicsitemap" template="dynamicsitemap/sitemap.phtml"/>
34
+ </reference>
35
+ </dynamicsitemap_index_index>
36
+ </layout>
37
+
app/design/frontend/default/default/template/dynamicsitemap/sitemap.phtml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="ones-column">
2
+ <div class="sitempan">
3
+ <h2 class="smh2">Our Main Pages</h2>
4
+ <ul class="siteul">
5
+ <?php echo $this->getCreareCMSPages(); // prints out our cms pages ?>
6
+ <?php $sitemap = Mage::getModel('sitemap/sitemap')->load(1); ?>
7
+ <?php $sitemapfilename = $sitemap->getSitemapFilename(); ?>
8
+ <?php if($sitemapfilename != ""): ?>
9
+ <li><a href="<?php echo Mage::getBaseUrl().$sitemapfilename; ?>" title="XML Sitemap">XML Sitemap</a></li>
10
+ <?php endif; ?>
11
+ </ul>
12
+ <ul class="siteul">
13
+ <li><a href="<?php echo Mage::getBaseUrl(); ?>" title="Home">Home</a></li>
14
+ <li><a href="<?php echo Mage::getBaseUrl(); ?>contacts" title="Contact">Contact</a></li>
15
+ <?php
16
+ if($this->helper('customer')->isLoggedIn()) {
17
+ echo '<li><a href="'.Mage::getBaseUrl().'customer/account/index/" title="Account">Account</a></li>';
18
+ echo '<li><a href="'.Mage::getBaseUrl().'customer/account/logout/" title="Log Out">Log Out</a></li>';
19
+ } else {
20
+ echo '<li><a href="'.Mage::getBaseUrl().'customer/account/" title="Register/Log In">Register/Log In</a></li>';
21
+ }
22
+ ?>
23
+ <li><a href="<?php echo Mage::getBaseUrl(); ?>catalogsearch/advanced" title="Advanced Search">Advanced Search</a></li>
24
+ </ul>
25
+ </div>
26
+ <?php
27
+ //<h2 class="smh2">Our Most Popular Products</h2>
28
+ // <ul class="siteul">
29
+ // <?php echo $this->getCrearePopularProducts(); // prints out our manual list of products ?>
30
+ <?php
31
+ // </ul>
32
+ ?>
33
+ <div class="sitempan">
34
+ <h2 class="smh2">Our Categories</h2>
35
+ <?php // Thanks to Luci @ Creare for the following code ?>
36
+ <?php $_helper = Mage::helper('catalog/category') ?>
37
+ <?php $_categories = $_helper->getStoreCategories() ?>
38
+ <?php if (count($_categories) > 0): ?>
39
+ <ul class="sitecatul">
40
+ <?php foreach($_categories as $_category): ?>
41
+ <?php //echo $_category->isEnabled(); ?>
42
+ <li class="cat">
43
+ <a href="<?php echo $_helper->getCategoryUrl($_category) ?>" title="<?php echo $_category->getName() ?>"><strong class="strongsm"><?php echo $_category->getName() ?></strong></a>
44
+ <?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
45
+ <?php $_subcategories = $_category->getChildrenCategories() ?>
46
+ <?php if (count($_subcategories) > 0): ?>
47
+ <ul>
48
+ <?php foreach($_subcategories as $_subcategory): ?>
49
+ <?php $_nextcategory = Mage::getModel('catalog/category')->load($_subcategory->getId()) ?>
50
+ <?php $_nextsubcategories = $_nextcategory->getChildrenCategories() ?>
51
+ <li>
52
+ <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>" title="<?php echo $_subcategory->getName() ?>">
53
+ <?php echo $_subcategory->getName() ?>
54
+ </a>
55
+ <?php if (count($_nextsubcategories) > 0): ?>
56
+ <ul>
57
+ <?php foreach($_nextsubcategories as $_nextsubcat): ?>
58
+ <li>
59
+ <a href="<?php echo $_helper->getCategoryUrl($_nextsubcat) ?>" title="<?php echo $_subcategory->getName() ?> - <?php echo $_nextsubcat->getName() ?>">
60
+ <?php echo $_nextsubcat->getName() ?>
61
+ </a>
62
+ </li>
63
+ <?php endforeach; ?>
64
+ </ul>
65
+ <?php endif; ?>
66
+ </li>
67
+ <?php endforeach; ?>
68
+ </ul>
69
+ <?php endif; ?>
70
+ </li>
71
+ <?php endforeach; ?>
72
+ </ul>
73
+ <?php endif; ?>
74
+ </div>
75
+ </div>
app/etc/modules/Creare_DynamicSitemap.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Creare_DynamicSitemap>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>1.0</version>
8
+ </Creare_DynamicSitemap>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Creare_DynamicSitemap</name>
4
+ <version>1.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>A dynamic sitemap which lists all categories and main pages automatically.</summary>
10
+ <description>This dynamic sitemap lists all of your categories in cascading style. Nicely styled on a dedicated sitemap page. This sitemap is SEO friendly and is intended to replace the default Magento paginated sitemap.&#xD;
11
+ &#xD;
12
+ It lists all of your CMS pages and also a few static pages that need a mention.&#xD;
13
+ &#xD;
14
+ The purpose of this extension is to make sure that your categories are indexed correctly as well as making your website more user-friendly.</description>
15
+ <notes>no notes yet</notes>
16
+ <authors><author><name>E-Commerce Web Design</name><user>EcommerceWD</user><email>dev@e-commercewebdesign.co.uk</email></author></authors>
17
+ <date>2011-10-11</date>
18
+ <time>16:00:17</time>
19
+ <contents><target name="magelocal"><dir name="Creare"><dir name="DynamicSitemap"><dir name="Block"><file name="Dynamicsitemap.php" hash="87b42503c1a8aa877c39a03c8e4e12d2"/></dir><dir name="controllers"><file name="IndexController.php" hash="95ff6b1aacceb990e3fb92ffd88cdb43"/></dir><dir name="etc"><file name="config.xml" hash="e9d0142ab70ad5ec7f75a89abbe6b590"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Creare_DynamicSitemap.xml" hash="de1cdb59ce6cdfd540055534f1aa1d9c"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="dynamicsitemap.xml" hash="817f2de40f841369ff6165908a19766e"/></dir><dir name="template"><dir name="dynamicsitemap"><file name="sitemap.phtml" hash="c116f0991378cc9910b07eda6e9fb684"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="dynamicsitemap.css" hash="85ace1d1d4c2d0a074fa4fce5dfd2175"/></dir></dir></dir></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
22
+ </package>
skin/frontend/default/default/css/dynamicsitemap.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Creare DynamicSitemap */
2
+
3
+ .sitempan { width: 100%; float: left; }
4
+ .smh2 { font-size: 1.4em; padding: 10px; display: block; }
5
+ .strongsm { font-size: 1.4em; display: block; }
6
+ .siteul { margin: 5px; padding: 0 0 0 10px; float: left; width: 45%; }
7
+ .siteul li { list-style:inside; font-size:1em!important; }
8
+ .sitecatul { margin: 0 5px; padding: 0 0 0 10px; float: left; width: 100%; }
9
+ .sitecatul li.cat { list-style:none; font-size:1em!important; display: block; float: left; width: 45%; margin: 0 0 10px 0; }
10
+ .sitecatul li.cat ul { margin: 0 5px; padding: 0 0 0 10px; }
11
+ .sitecatul li.cat ul li { list-style:inside; }
12
+ .two-column { width: 50%; float: left; display: block; }