1

I want to create custom module for "Image Uploader" , and create grid, in this grid , I want to put "Image Title","Image Path", "Image", "Status", "Dropdown (for the selecting image)". once image is uploaded then admin select image from the dropdown for display image on the frontend.

5
  • so you want we write code for you? you must add what you tried so far? Commented Aug 31, 2016 at 5:35
  • no not write whole code. i am created the module , but i want to show images on the frontend page("product detail page"), which image status is enable. Commented Aug 31, 2016 at 6:06
  • did you create the model for that? Commented Aug 31, 2016 at 6:07
  • yes i am created a model . Commented Aug 31, 2016 at 6:10
  • i added the sample code for you Commented Aug 31, 2016 at 6:16

1 Answer 1

1

here is sample code get data

 $collections = Mage::getModel('moudlename/modelname')->getCollection()
              ->addFieldToFilter('status', array('eq' => 1));

  foreach($collections as $collection) { ?>
         <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'pathtoimage/'.$collection->getImage(); ?>" >
   <?php } ?>
27
  • it gives the follwing error Commented Aug 31, 2016 at 6:27
  • Fatal error: Call to a member function getCollection() on a non-object in Commented Aug 31, 2016 at 6:27
  • did you change these are you model ('moudlename/modelname')? Commented Aug 31, 2016 at 6:28
  • 1
    Mage::getModel('image/upload')->getCollection() try this Commented Aug 31, 2016 at 6:37
  • 1
    try this Mage::getModel('upload_image/upload')->getCollection() Commented Aug 31, 2016 at 6:44

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.