- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
Eze1 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            summafrantoms
  wants to merge
  3
  commits into
  SummaSolutions:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
ezequieldevalais:master
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Eze1 #2
Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or 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 @@ | ||
| #Magento | ||
| /app/etc/local.xml | ||
| /downloader/ | ||
| /var/ | ||
| /media/ | ||
| maintenance.flag | ||
| togglehints.php | ||
| .sass-cache | ||
| .idea/ | ||
| test.php | 
  
    
      This file contains hidden or 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 @@ | ||
| <?php | ||
| /** | ||
| * Created by PhpStorm. | ||
| * User: ezequiel | ||
| * Date: 05/12/15 | ||
| * Time: 00:55 | ||
| */ | ||
| class Training_Catalog_Helper_Data extends Mage_Core_Helper_Abstract { | ||
|  | ||
| } | 
  
    
      This file contains hidden or 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,20 @@ | ||
| <?php | ||
|  | ||
| class Training_Catalog_Model_Core_Url | ||
| extends Mage_Core_Model_Url | ||
| { | ||
|  | ||
| public function getUrl($routePath = null, $routeParams = null) | ||
| { | ||
| $categoryPath = Mage::getStoreConfig('training/product/path'); | ||
| if(Mage::helper('catalog')->isCategory() && $routePath == $categoryPath){ | ||
| $categoryParam = Mage::getStoreConfig('training/product/category_param'); | ||
| $category = Mage::registry('current_category'); | ||
| $categoryId = $category->getId(); | ||
| if($categoryId && !empty($categoryParam)){ | ||
| $routeParams[$categoryParam] = $categoryId; | ||
| } | ||
| } | ||
| return parent::getUrl($routePath, $routeParams); | ||
| } | ||
| } | ||
  
    
      This file contains hidden or 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 | ||
|  | ||
| class Training_Catalog_Model_Observer | ||
| { | ||
| public function catalogProductSaveAfter(Varien_Event_Observer $observer) | ||
| { | ||
| $session = Mage::getSingleton('admin/session'); | ||
| if(!$session->isLoggedIn()){ | ||
| return; | ||
| } | ||
| $user = $session->getUser(); | ||
| $name = $user->getFirstname() . ' ' . $user->getLastname(); | ||
| $product = $observer->getProduct(); | ||
| $id = $product->getId(); | ||
| $datetime = new DateTime(); | ||
| $formatedTime = $datetime->format('d/m/Y H:i:s'); | ||
| $log = sprintf('productId: "%s", user: "%s", time: "%s"', $id, $name, $formatedTime); | ||
| Mage::log( $log, LOG_INFO, 'product.log', true); | ||
| } | ||
|  | ||
| public function controllerActionPredispatchCatalogProductFeed(Varien_Event_Observer $observer) | ||
| { | ||
| $controllerAction = $observer->getControllerAction(); | ||
| $productId = $controllerAction->getRequest()->getParam('id'); | ||
| $product = Mage::getModel('catalog/product')->load($productId); | ||
| $visibility = $product->getVisibility(); | ||
| $visibilityStates = Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds(); | ||
| if(!in_array( $visibility, $visibilityStates)){ | ||
| $controllerAction->norouteAction(); | ||
| } | ||
| } | ||
| } | 
  
    
      This file contains hidden or 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,64 @@ | ||
| <?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> | ||
| <core> | ||
| <rewrite> | ||
| <url>Training_Catalog_Model_Core_Url</url> | ||
| </rewrite> | ||
| </core> | ||
| </models> | ||
| <blocks> | ||
| <training_catalog> | ||
| <class>Training_Catalog_Block</class> | ||
| </training_catalog> | ||
| </blocks> | ||
| <helpers> | ||
| <training_catalog> | ||
| <class>Training_Catalog_Helper</class> | ||
| </training_catalog> | ||
| </helpers> | ||
| <resources> | ||
| <training_catalog_setup> | ||
| <setup> | ||
| <module>Training_Catalog</module> | ||
| </setup> | ||
| </training_catalog_setup> | ||
| </resources> | ||
| <events> | ||
| <catalog_product_save_after> | ||
| <observers> | ||
| <training_catalog_catalog_product_save_after> | ||
| <type>singleton</type> | ||
| <class>training_catalog/observer</class> | ||
| <method>catalogProductSaveAfter</method> | ||
| </training_catalog_catalog_product_save_after> | ||
| </observers> | ||
| </catalog_product_save_after> | ||
| <controller_action_predispatch_catalog_product_feed> | ||
| <observers> | ||
| <training_controller_action_predispatch_catalog_product_feed> | ||
| <class>training_catalog/observer</class> | ||
| <method>controllerActionPredispatchCatalogProductFeed</method> | ||
| </training_controller_action_predispatch_catalog_product_feed> | ||
| </observers> | ||
| </controller_action_predispatch_catalog_product_feed> | ||
| </events> | ||
| </global> | ||
| <default> | ||
| <training> | ||
| <product> | ||
| <path>catalog/product/view</path> | ||
| <category_param>cat</category_param> | ||
| </product> | ||
| </training> | ||
| </default> | ||
| </config> | 
        
          
          
            10 changes: 10 additions & 0 deletions
          
          10 
        
  app/code/local/Training/Catalog/sql/training_catalog_setup/install-0.1.0.php
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or 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 @@ | ||
| <?php | ||
|  | ||
| /* @var $installer Mage_Core_Model_Resource_Setup */ | ||
| $installer = $this; | ||
| $installer->startSetup(); | ||
|  | ||
| $config = new Mage_Core_Model_Config(); | ||
| $config->saveConfig('dev/log/active', 1); | ||
|  | ||
| $installer->endSetup(); | 
  
    
      This file contains hidden or 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,9 @@ | ||
| <?xml version="1.0"?> | ||
| <config> | ||
| <modules> | ||
| <Training_Catalog> | ||
| <active>true</active> | ||
| <codePool>local</codePool> | ||
| </Training_Catalog> | ||
| </modules> | ||
| </config> | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tene en cuenta que todos los productos de las categorias obtienen su URL con el método getProductUrl()
Si bien esto esta resolviendo el requerimiento todas las url del sitio pasan x esta validación y no es muy performante.