1

Im new in Magento, I need to delete a file and its containing folder, which has a name generated by the following code:

$order = Mage::getModel('sales/order')->load($id_order);
$increment = $order->getIncrementId();

if (!file_exists(Mage::getBaseDir('base').'/Ocproveedores/'.$increment)) {
    mkdir(Mage::getBaseDir('base').'/Ocproveedores/'.$increment, 0777, true); 
}

$tcpdf->Output(Mage::getBaseDir('base').'/Ocproveedores/'.$increment.'/OC-'.$nombreProveedor.'-'.$increment.'-'.$j.'.pdf', 'F');

How can I delete the folder after ending an order ?

Thanks a lot.

1 Answer 1

2

In PHP you can use rmdir() to delete a folder according to your exemple, I think that there is no Magento function for that !

Now if you want to do that in some condition after ending order, you can use an observer with this event sales_order_place_after. you can take an exemple from this to look how to create an observer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.