Advanced Search

— Forum Scope —




— Match —





— Forum Options —





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

mail_open
Make a cron job for this
Dom Rand
Member
May 29, 2015 - 11:04 am
Member Since: April 2, 2014
Forum Posts: 219
sp_UserOfflineSmall Offline

Morning

We have multiple images per product but they are the same image just the correct sizes. We dont want them to display under the product image as additional images.

So when we upload products I have to run this is the dbase.

UPDATE catalog_product_entity_media_gallery_value SET disabled = 0;
UPDATE catalog_product_entity_media_gallery_value AS mgv,
(SELECT entity_id, COUNT(*) as image_count, MAX(value_id) AS value_id
FROM catalog_product_entity_media_gallery AS mg
GROUP BY entity_id
HAVING image_count = 2) AS mg
SET mgv.disabled = 1
WHERE mgv.value_id = mg.value_id

This basically excludes all product images that have a count of 2 or more.

So ideally I would like this as a cron job but have no idea how to do it.

Any suggestions?

"Dont believe everything you read on the internet just because there is a picture with a quote next to it" Abraham Lincoln

Avatar
Matthew Ogborne

Founder
July 21, 2015 - 12:24 pm
Member Since: July 18, 2013
Forum Posts: 4565
sp_UserOfflineSmall Offline

Howdy Dom,
Yes, adapt the script from this tutorial https://understandinge.com/lesson/imp-013/

And you would want something like this:

$w = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’);

and this with your query in

$result = $w->query(‘your query here’);
if (!$result) {
echo "arh, I failed! Run for the hills!";
} else {
echo "Happy Days";
}

Matt

Note: Edited to remove BR tags

"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:
23 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: 5221

Posts: 27486

Administrators: Matthew Ogborne: 4565, Dave Furness: 4606