0

I’ve installed magento edition version 1.9.2.0 and added a custom attribute pdf(text field) and adding pdf names for each product using this attribute and manually adding pdf file in the media/PDF folder.Now i want to delete the unwanted pdf files(not in database) .please suggest any option for this.

1
  • what problem you have to delete the unwanted files ?
    – Rohit
    Commented May 31, 2016 at 12:04

1 Answer 1

0

We assume that your attribute (PDF) default value is 0 or 'null'.Now you have to get those products which have values in the database. You need to get them from product collection on the basis of attribute filter after you can delete files other than the resultset values.

 $collection = Mage::getModel('catalog/product')->getCollection();

//filter product by attribute value 
$collection->addAttributeToFilter(
  array(
   array('attribute'=> 'pdf','neq' => '0'),
   array('attribute'=> 'pdf','neq' => '')
);
2
  • thank you for your answer.but i need this works like Imaclean module.ie, in the backend user can list unwanted files names and can delete selected items.any module available for this?
    – Asha
    Commented Jun 1, 2016 at 4:00
  • The plugin image clean ( hopefully you have already looked at) suite to your requirement but you have to customize this module according to your requirements.
    – user40382
    Commented Jun 1, 2016 at 8:13

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.