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 Satti– Qaisar Satti2016-08-31 05:35:39 +00:00Commented 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 Parekh– Harshil Parekh2016-08-31 06:06:20 +00:00Commented Aug 31, 2016 at 6:06
-
did you create the model for that?Qaisar Satti– Qaisar Satti2016-08-31 06:07:44 +00:00Commented Aug 31, 2016 at 6:07
-
yes i am created a model .Harshil Parekh– Harshil Parekh2016-08-31 06:10:07 +00:00Commented Aug 31, 2016 at 6:10
-
i added the sample code for youQaisar Satti– Qaisar Satti2016-08-31 06:16:55 +00:00Commented 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 } ?>
-
it gives the follwing errorHarshil Parekh– Harshil Parekh2016-08-31 06:27:46 +00:00Commented Aug 31, 2016 at 6:27
-
Fatal error: Call to a member function getCollection() on a non-object inHarshil Parekh– Harshil Parekh2016-08-31 06:27:54 +00:00Commented Aug 31, 2016 at 6:27
-
did you change these are you model
('moudlename/modelname')?Qaisar Satti– Qaisar Satti2016-08-31 06:28:33 +00:00Commented Aug 31, 2016 at 6:28 -
1
Mage::getModel('image/upload')->getCollection()try thisQaisar Satti– Qaisar Satti2016-08-31 06:37:35 +00:00Commented Aug 31, 2016 at 6:37 -
1try this
Mage::getModel('upload_image/upload')->getCollection()Qaisar Satti– Qaisar Satti2016-08-31 06:44:07 +00:00Commented Aug 31, 2016 at 6:44