Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

Conditional Statement to check media gallery for Ebay custom description

July 24, 2015 - 5:39 pm
Member Since: June 14, 2014
Forum Posts: 1
sp_UserOfflineSmall Offline

We have a custom coded description setup for our ebay template. If a product only has one image in our magento store, we have the “exclude” option checked on for the image so the image does not appear in the gallery view. If the product has multiple images, the exclude option is turned off. We have a mix of products with only one image and some with multiple. When we are sending over the product image to our ebay listings in our description, we are looking for a conditional statement that will check if media gallery tag will return an image, if it doesn’t then display the base image tag. If we send over only the media gallery tag, no image will appear for products that only have one image. I saw in a couple of previous threads a javascript code that checks if a value is available for attributes similar to the below but was wondering if this can be checked for the media gallery?

<div id="attributes"></div>
<script type="text/javascript">
var _inner = "";
if( #media_gallery[700,500,,2,row,0,"",]# = "" ) { _inner += "<img src="#image#" alt="" />" };
if( #media_gallery[700,500,,2,row,0,"",]# != NULL ) { _inner += "#media_gallery[700,500,,2,row,0,"",]#" };
document.getElementById("attributes").style.display = "block";
document.getElementById("attributes").innerHTML = _inner;
Dave Furness

July 28, 2015 - 7:35 pm
Member Since: July 19, 2013
Forum Posts: 4606
sp_UserOfflineSmall Offline

Hey Jessie,

Hmmm this is one for Matt I will ask him to take a look at this for you.


Every expert was once a beginner

Matthew Ogborne

August 4, 2015 - 7:32 am
Member Since: July 18, 2013
Forum Posts: 4565
sp_UserOfflineSmall Offline

Hi Jessie,

That won’t work because the M2EPro keywords #media_gallery[700,500,,2,row,0,””,]# will spit out a load of HTML and break the javascript.

A check like that can only be done by M2EPro and as far as I know they don’t support pre-listing conditional logic.


"Selling an item online is easy, but making living from a business that sells online, well that’s something different entirely!"

Ultimo Magento Theme


Why Should You Join UnderstandingE?

  • Access to over 500 step-by-step video tutorials
  • +20 video courses available
  • Magento, M2E Pro, Magmi, eBay, Amazon & Design all covered
  • Everything is in 100% Plain English
  • Learn how to build your own multi-channel software for eBay & Amazon
  • Access to the community forums, meet fellow business owners like yourself

Join Now with 2 Clicks


Join now for less that £1 per day you can gain access to over 400 step-by-step video tutorials & learn how to build your very own multi-channel software.


Forum Timezone: Europe/London

Most Users Ever Online: 1012

Currently Online:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Jim @ Moogento: 688

Steve Froggatt: 514

Badeth - UE: 513

Jimbob: 453

Paul Cartwright: 414

Forum Stats:

Groups: 6

Forums: 37

Topics: 5223

Posts: 27502

Administrators: Matthew Ogborne: 4565, Dave Furness: 4606