Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/code/local/Training/Catalog/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
/**
* Created by PhpStorm.
* User: ezequiel
* Date: 08/12/15
* Time: 13:30
*/
class Training_Catalog_Helper_Data extends Mage_Core_Helper_Abstract {

}
17 changes: 17 additions & 0 deletions app/code/local/Training/Catalog/Model/Observer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Created by PhpStorm.
* User: ezequiel
* Date: 08/12/15
* Time: 13:39
*/

class Training_Catalog_Model_Observer {
public function catalogProductSaveAfter($observer)
{
$userLogged = Mage::getSingleton('admin/session')->getUser();
$time = Mage::getModel('core/date')->date('Y-m-d H:i:s');
$message = $time." - ".$userLogged->getName();
Mage::log($message);
}
}
20 changes: 20 additions & 0 deletions app/code/local/Training/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Created by PhpStorm.
* User: ezequiel
* Date: 08/12/15
* Time: 16:20
*/
class Training_Catalog_Model_Product
extends Company_Feed_Model_Catalog_Product
{
public function getProductUrl($useSid = null) {
$url = parent::getProductUrl($useSid);
if(Mage::helper('catalog')->isCategory()) {
$current_category = Mage::registry('current_category');
$id = $current_category->getId();
return $url."cat/".$id;
}
else return $url;
}
}
21 changes: 21 additions & 0 deletions app/code/local/Training/Catalog/controllers/ProductController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* Created by PhpStorm.
* User: ezequiel
* Date: 08/12/15
* Time: 15:39
*/
require_once 'Company/Feed/controllers/Catalog/ProductController.php';


class Training_Catalog_ProductController
extends Company_Feed_Catalog_ProductController {
public function feedAction()
{
$id = $this->getRequest()->getParam('id');
$product = Mage::getModel('catalog/product')->load($id);
if($product->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE)
return parent::feedAction();
else exit ("NOT VISIBLE");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Según el requerimiento debería redireccionar a la 404 Page.
Pero en términos generales esta bien

}
}
52 changes: 52 additions & 0 deletions app/code/local/Training/Catalog/etc/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<config>
<modules>
<Training_Catalog>
<version>0.1.0</version>
</Training_Catalog>
</modules>
<global>
<models>
<Training_catalog>
<class>Training_Catalog_Model</class>
</Training_catalog>
<catalog>
<rewrite>
<product>Training_Catalog_Model_Product</product>
</rewrite>
</catalog>
</models>
<helpers>
<Training_catalog>
<class>Training_Catalog_Helper</class>
</Training_catalog>
</helpers>
<blocks>
<Training_catalog>
<class>Training_Catalog_Block</class>
</Training_catalog>
</blocks>
<events>
<catalog_product_save_after>
<observers>
<Training_catalog_observer>
<type>singleton</type>
<class>Training_Catalog_Model_Observer</class>
<method>catalogProductSaveAfter</method>
</Training_catalog_observer>
</observers>
</catalog_product_save_after>
</events>
</global>
<frontend>
<routers>
<catalog>
<args>
<modules>
<Training_Catalog before="Company_Feed_Catalog">Training_Catalog</Training_Catalog>
</modules>
</args>
</catalog>
</routers>
</frontend>
</config>
66 changes: 66 additions & 0 deletions app/etc/local.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0"?>
<!--
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magento.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magento.com for more information.
*
* @category Mage
* @package Mage_Core
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
-->
<config>
<global>
<install>
<date><![CDATA[Tue, 08 Dec 2015 16:03:53 +0000]]></date>
</install>
<crypt>
<key><![CDATA[ce9bc9379ae980c42a5eb6c55ef9288f]]></key>
</crypt>
<disable_local_modules>false</disable_local_modules>
<resources>
<db>
<table_prefix><![CDATA[]]></table_prefix>
</db>
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[yungacapo]]></password>
<dbname><![CDATA[training]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>
</resources>
<session_save><![CDATA[files]]></session_save>
</global>
<admin>
<routers>
<adminhtml>
<args>
<frontName><![CDATA[admin]]></frontName>
</args>
</adminhtml>
</routers>
</admin>
</config>
9 changes: 9 additions & 0 deletions app/etc/modules/Training_Catalog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<config>
<modules>
<Training_Catalog>
<active>true</active>
<codePool>local</codePool>
</Training_Catalog>
</modules>
</config>