你好在app \ code \ core \ Mage \ Downloadable \ Block \ Adminhtml \ Catalog \ Product \ Edit \ Tab \ Downloadable \ Links.php
中有一个功能当管理员面板中的用户输入目录中的可下载产品时调用它>产品
功能
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);
}
}
我看到了一个教程,他们不建议编辑核心...... 所以我的问题是,如果有办法做出相同的行为,将此功能放在其他游戏中, 应该怎么做?
答案 0 :(得分:-1)
通过在本地创建核心功能,可以覆盖magento中的功能......
例如在这些情况下
app \ code \ 本地 \ Mage \ Downloadable \ Block \ Adminhtml \ Catalog \ Product \ Edit \ Tab \ Downloadable \ Links.php
更新
该函数应扩展核心..例如
extends Mage_Adminhtml_Block_Template