2014-12-27 114 views
1

喜在应用程序\代码\核心功能\法师\下载\块\ Adminhtml \目录\产品\编辑\选项卡\下载\ Links.phpMagento的解决办法,以避免编辑核心功能

,其调用时在管理面板,用户在目录中下载的产品进入>产品

功能及其

public function getConvertPDF(){ 

    $_prodId = $this->getProduct()->getId(); 

    /*Validate if the product exist */ 

    if ($_prodId){ 
    $_proFile =$this->getLinkFile(); 

    $product = Mage::registry('current_product'); 
    if ($product->getTypeId() == 'downloadable') { 
     $table = Mage::getModel('downloadable/link'); 
     $collection = $table->getCollection()->addProductToFilter($product->getId()); 
     foreach ($collection as $downloadable){ 
      $linkFile = $downloadable->getLinkFile(); 
      break; 
     } 
     $_proFile = $linkFile; 
    } 

    $extencion = '.jpg'; 
    $path= 'C:/wamp/www/magento/media/downloadable/files/links'; 
    $pathout= 'C:/wamp/www/magento/media/catalog/product/small/'; 
    $test ='/small/'; 

    exec('convert '.$path.$_proFile.'[0] '.$pathout.$_prodId.$extencion); 

/*-------------------------------------------------**/ 


    $resource = Mage::getSingleton('core/resource'); 
    $adapter = $resource->getConnection('write'); 

    $bind = array(
      'value' => $test.$_prodId.$extencion 
    ); 

    $where = array(
      'entity_id = ?'  => $_prodId, 
      'attribute_id = ?' => 86 
    ); 

    $adapter->update($resource->getTableName('catalog_product_entity_varchar'), $bind, $where); 

    } 

    } 

我看到了一个教程,他们不推荐将编辑的核心...... 所以我的问题了,如果有是做同样的行为,放置这个功能的方法在其他玩法中, 程序应该怎么样?在Magento

+0

您正在寻找的术语是“Magento覆盖”。搜索一下,你会发现你想要做什么。 – danemacmillan 2014-12-27 18:57:13

+0

谢谢,这是帮助我 – 2014-12-30 02:28:34

回答

-1

功能可以通过在本地核心的后的功能是覆盖...

例如,在这些情况下

应用程序\代码\ 当地 \法师\下载\块\ Adminhtml \目录\产品\编辑\选项卡\下载\ Links.php

更新

函数应该扩展核心。例如

extends Mage_Adminhtml_Block_Template