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.
-
so you want we write code for you? you must add what you tried so far?– Qaisar SattiCommented 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.– Harshil ParekhCommented Aug 31, 2016 at 6:06
-
did you create the model for that?– Qaisar SattiCommented Aug 31, 2016 at 6:07
-
yes i am created a model .– Harshil ParekhCommented Aug 31, 2016 at 6:10
-
i added the sample code for you– Qaisar SattiCommented Aug 31, 2016 at 6:16
Add a comment
|
1 Answer
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 } ?>
-
-
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 -
1try this
Mage::getModel('upload_image/upload')->getCollection()
Commented Aug 31, 2016 at 6:44