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.

Qaisar Satti
32.6k18 gold badges88 silver badges138 bronze badges
asked Aug 31, 2016 at 5:33
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 } ?>
answered Aug 31, 2016 at 6:16
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.