Hi have a function in app\code\core\Mage\Downloadable\Block\Adminhtml\Catalog\Product\Edit\Tab\Downloadable\Links.php
that its called when a user in admin panel enters in a downloadable product in catalog > product
The function its
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);
}
}
I saw a tutorial and they dont recomend to edit the core ... so my question its if there is way to make the same behavior , placing this function in other play , how should be the procedure?