Jump to content

zigojacko

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by zigojacko

  1. Thanks for your replies. I figured it out now... $gallery_images = Mage::getModel('catalog/product')->load($product->getId())->getMediaGalleryImages(); $items = array(); foreach($gallery_images as $g_image) { $items[] = $g_image['url']; } Then I could fetch them outside of the loop with:- implode(', ', $items); Thanks for your replies anyway...
  2. I don't think I explained well (or correctly). I think $product->getMediaGallery() is an object. The output of var_dump ($product->getMediaGalleryImages()); is below:- object(Varien_Data_Collection)#402 (13) { ["_items":protected]=> array(5) { [226]=> object(Varien_Object)#401 (7) { ["_data":protected]=> array(12) { ["value_id"]=> string(3) "226" ["file"]=> string(35) "/k/i/kimono-sleeve-top-black_1_.jpg" ["product_id"]=> string(2) "51" ["label"]=> string(55) "silk print bamboo kimono sleeve zip top " ["position"]=> string(1) "1" ["disabled"]=> string(1) "0" ["label_default"]=> string(55) "silk print bamboo kimono sleeve zip top " ["position_default"]=> string(1) "1" ["disabled_default"]=> string(1) "0" ["url"]=> string(89) "https://www.example.com/media/catalog/product/k/i/kimono-sleeve-top-black_1_.jpg" ["id"]=> string(3) "226" ["path"]=> string(102) "/var/www/vhosts/example.com/httpdocs/media/catalog/product/k/i/kimono-sleeve-top-black_1_.jpg" } ["_hasDataChanges":protected]=> bool(false) ["_origData":protected]=> NULL ["_idFieldName":protected]=> NULL ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } } [227]=> object(Varien_Object)#374 (7) { ["_data":protected]=> array(12) { ["value_id"]=> string(3) "227" ["file"]=> string(35) "/k/i/kimono-sleeve-top-black_2_.jpg" ["product_id"]=> string(2) "51" ["label"]=> string(60) "silk print bamboo kimono sleeve zip top front" ["position"]=> string(1) "2" ["disabled"]=> string(1) "0" ["label_default"]=> string(60) "silk print bamboo kimono sleeve zip top front" ["position_default"]=> string(1) "2" ["disabled_default"]=> string(1) "0" ["url"]=> string(89) "https://www.example.com/media/catalog/product/k/i/kimono-sleeve-top-black_2_.jpg" ["id"]=> string(3) "227" ["path"]=> string(102) "/var/www/vhosts/example.com/httpdocs/media/catalog/product/k/i/kimono-sleeve-top-black_2_.jpg" } ["_hasDataChanges":protected]=> bool(false) ["_origData":protected]=> NULL ["_idFieldName":protected]=> NULL ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } } [225]=> object(Varien_Object)#375 (7) { ["_data":protected]=> array(12) { ["value_id"]=> string(3) "225" ["file"]=> string(35) "/k/i/kimono-sleeve-top-black_3_.jpg" ["product_id"]=> string(2) "51" ["label"]=> string(62) "silk print bamboo kimono sleeve zip top quarter" ["position"]=> string(1) "3" ["disabled"]=> string(1) "0" ["label_default"]=> string(62) "silk print bamboo kimono sleeve zip top quarter" ["position_default"]=> string(1) "3" ["disabled_default"]=> string(1) "0" ["url"]=> string(89) "https://www.example.com/media/catalog/product/k/i/kimono-sleeve-top-black_3_.jpg" ["id"]=> string(3) "225" ["path"]=> string(102) "/var/www/vhosts/example.com/httpdocs/media/catalog/product/k/i/kimono-sleeve-top-black_3_.jpg" } ["_hasDataChanges":protected]=> bool(false) ["_origData":protected]=> NULL ["_idFieldName":protected]=> NULL ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } } [228]=> object(Varien_Object)#319 (7) { ["_data":protected]=> array(12) { ["value_id"]=> string(3) "228" ["file"]=> string(35) "/k/i/kimono-sleeve-top-black_4_.jpg" ["product_id"]=> string(2) "51" ["label"]=> string(59) "silk print bamboo kimono sleeve zip top back" ["position"]=> string(1) "4" ["disabled"]=> string(1) "0" ["label_default"]=> string(59) "silk print bamboo kimono sleeve zip top back" ["position_default"]=> string(1) "4" ["disabled_default"]=> string(1) "0" ["url"]=> string(89) "https://www.example.com/media/catalog/product/k/i/kimono-sleeve-top-black_4_.jpg" ["id"]=> string(3) "228" ["path"]=> string(102) "/var/www/vhosts/example.com/httpdocs/media/catalog/product/k/i/kimono-sleeve-top-black_4_.jpg" } ["_hasDataChanges":protected]=> bool(false) ["_origData":protected]=> NULL ["_idFieldName":protected]=> NULL ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } } [229]=> object(Varien_Object)#327 (7) { ["_data":protected]=> array(12) { ["value_id"]=> string(3) "229" ["file"]=> string(35) "/k/i/kimono-sleeve-top-black_5_.jpg" ["product_id"]=> string(2) "51" ["label"]=> string(61) "silk print bamboo kimono sleeve zip top detail" ["position"]=> string(1) "5" ["disabled"]=> string(1) "0" ["label_default"]=> string(61) "silk print bamboo kimono sleeve zip top detail" ["position_default"]=> string(1) "5" ["disabled_default"]=> string(1) "0" ["url"]=> string(89) "https://www.example.com/media/catalog/product/k/i/kimono-sleeve-top-black_5_.jpg" ["id"]=> string(3) "229" ["path"]=> string(102) "/var/www/vhosts/example.com/httpdocs/media/catalog/product/k/i/kimono-sleeve-top-black_5_.jpg" } ["_hasDataChanges":protected]=> bool(false) ["_origData":protected]=> NULL ["_idFieldName":protected]=> NULL ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } } } ["_itemObjectClass":protected]=> string(13) "Varien_Object" ["_orders":protected]=> array(0) { } ["_filters":protected]=> array(0) { } ["_isFiltersRendered":protected]=> bool(false) ["_curPage":protected]=> int(1) ["_pageSize":protected]=> bool(false) ["_totalRecords":protected]=> NULL ["_isCollectionLoaded":protected]=> NULL ["_cacheKey":protected]=> NULL ["_cacheTags":protected]=> array(0) { } ["_cacheLifetime":protected]=> int(86400) ["_flags":protected]=> array(0) { } } I have replaced references to the domain with example.com. I need to print a list of the ["url"] that can be seen in this var_dump and I don't know the correct syntax to do this. Hope that explains a bit better.
  3. Of course. It's the first place I look. I couldn't resolve it after trying things from the manual... Syntactically, I don't think this is right:- $array = array($product->getMediaGallery()); So, the following returns NULL:- var_dump ($array["url"]); In case you've missed the obvious, I'm not really sure what I am doing with this hence why I have come here for help.
  4. I need to list an array (comma separated) and the data I need is available in the var_dump. I just don't know how to write the syntax to display the array list. From within: var_dump ($product->getMediaGalleryImages()); I can see multiple instances of: ["url"]=> string(89) "https://www.example.com/media/catalog/product/x/x/x-image.jpg" What do I need to write in order to list all the ["url"] Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.