-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
190 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
app/code/community/AndrejSinicyn/CatalogTuner/Helper/Data.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* Magento | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* | ||
* @category AndrejSinicyn | ||
* @package AndrejSinicyn_CatalogTuner | ||
* @copyright Copyright (c) 2014 Andrej Sinicyn | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
class AndrejSinicyn_CatalogTuner_Helper_Data extends Mage_Core_Helper_Abstract | ||
{ | ||
} |
32 changes: 32 additions & 0 deletions
32
app/code/community/AndrejSinicyn/CatalogTuner/Model/Observer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Magento | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* | ||
* @category AndrejSinicyn | ||
* @package AndrejSinicyn_CatalogTuner | ||
* @copyright Copyright (c) 2014 Andrej Sinicyn | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
class AndrejSinicyn_CatalogTuner_Model_Observer | ||
{ | ||
const XML_PATH_ADD_BREADCRUMBS = 'catalog/tuning/add_catalog_breadcrumbs_to_product'; | ||
|
||
public function onCatalogControllerProductInit(Varien_Event_Observer $observer) | ||
{ | ||
if (Mage::getStoreConfig(self::XML_PATH_ADD_BREADCRUMBS) && !Mage::registry('current_category') && ($product = Mage::registry('current_product'))) { | ||
$productCategories = $product->getCategoryIds(); | ||
if (count($productCategories) > 0) { | ||
// Assigning the first product category as current category if no category was set previously. | ||
$category = Mage::getModel('catalog/category')->load($productCategories[0]); | ||
$product->setCategory($category); | ||
Mage::register('current_category', $category); | ||
} | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
app/code/community/AndrejSinicyn/CatalogTuner/etc/config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0"?> | ||
<config> | ||
<modules> | ||
<AndrejSinicyn_CatalogTuner> | ||
<version>1.0.0</version> | ||
</AndrejSinicyn_CatalogTuner> | ||
</modules> | ||
<global> | ||
<helpers> | ||
<catalogtuner> | ||
<class>AndrejSinicyn_CatalogTuner_Helper</class> | ||
</catalogtuner> | ||
</helpers> | ||
<models> | ||
<catalogtuner> | ||
<class>AndrejSinicyn_CatalogTuner_Model</class> | ||
<resourceModel>catalogtuner_mysql4</resourceModel> | ||
</catalogtuner> | ||
</models> | ||
<events> | ||
<catalog_controller_product_init> | ||
<observers> | ||
<catalog_controller_product_init_handler> | ||
<type>model</type> | ||
<class>catalogtuner/observer</class> | ||
<method>onCatalogControllerProductInit</method> | ||
</catalog_controller_product_init_handler> | ||
</observers> | ||
</catalog_controller_product_init> | ||
</events> | ||
</global> | ||
<adminhtml> | ||
<translate> | ||
<modules> | ||
<AndrejSinicyn_CatalogTuner> | ||
<files> | ||
<default>AndrejSinicyn_CatalogTuner.csv</default> | ||
</files> | ||
</AndrejSinicyn_CatalogTuner> | ||
</modules> | ||
</translate> | ||
</adminhtml> | ||
<default> | ||
<catalog> | ||
<tuning> | ||
<add_catalog_breadcrumbs_to_product>0</add_catalog_breadcrumbs_to_product> | ||
</tuning> | ||
</catalog> | ||
</default> | ||
</config> |
29 changes: 29 additions & 0 deletions
29
app/code/community/AndrejSinicyn/CatalogTuner/etc/system.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0"?> | ||
<config> | ||
<sections> | ||
<catalog module="catalogtuner"> | ||
<groups> | ||
<tuning translate="label"> | ||
<label>Tuning</label> | ||
<frontend_type>text</frontend_type> | ||
<sort_order>990</sort_order> | ||
<show_in_default>1</show_in_default> | ||
<show_in_website>1</show_in_website> | ||
<show_in_store>1</show_in_store> | ||
<fields> | ||
<add_catalog_breadcrumbs_to_product translate="label comment"> | ||
<label>Force adding catalog breadcrumbs to product</label> | ||
<frontend_type>select</frontend_type> | ||
<source_model>adminhtml/system_config_source_yesno</source_model> | ||
<sort_order>0</sort_order> | ||
<show_in_default>1</show_in_default> | ||
<show_in_website>1</show_in_website> | ||
<show_in_store>1</show_in_store> | ||
<comment>Tries to add catalog breadcrumbs to product, if it is called directly without category.</comment> | ||
</add_catalog_breadcrumbs_to_product> | ||
</fields> | ||
</tuning> | ||
</groups> | ||
</catalog> | ||
</sections> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0"?> | ||
<config> | ||
<modules> | ||
<AndrejSinicyn_CatalogTuner> | ||
<active>true</active> | ||
<codePool>community</codePool> | ||
<version>1.0.0</version> | ||
</AndrejSinicyn_CatalogTuner> | ||
</modules> | ||
</config> |