Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 避免编辑核心功能的Magento解决方案_Php_Magento - Fatal编程技术网

Php 避免编辑核心功能的Magento解决方案

Php 避免编辑核心功能的Magento解决方案,php,magento,Php,Magento,Hi在app\code\core\Mage\Downloadable\Block\Adminhtml\Catalog\Product\Edit\Tab\Downloadable\Links.php中有一个函数 当管理面板中的用户在catalog>product中输入可下载的产品时,它会被调用 功能及其应用 public function getConvertPDF(){ $_prodId = $this->getProduct()->getId(); /*Va

Hi在app\code\core\Mage\Downloadable\Block\Adminhtml\Catalog\Product\Edit\Tab\Downloadable\Links.php中有一个函数

当管理面板中的用户在catalog>product中输入可下载的产品时,它会被调用

功能及其应用

 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中的功能

例如在这种情况下

app\code\local\Mage\Downloadable\Block\Adminhtml\Catalog\Product\Edit\Tab\Downloadable\Links.php

更新

该函数应扩展核心。。比如说

extends Mage_Adminhtml_Block_Template

您要查找的术语是Magento overrides。搜索一下,你就会找到你想做的事。谢谢,这对我有帮助