Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8263483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:07:10+00:00 2026-06-08T04:07:10+00:00

On our Magento 1.5.0.1 I wrote a PHP script to update all of our

  • 0

On our Magento 1.5.0.1 I wrote a PHP script to update all of our product meta titles to be based on the name and SKU of each product. The script is run by calling PHP via SSH.

After running the script I noticed in our M2E Pro (the eBay syncing module) that every single product appears to have become disabled.

Magento Screenshot

Looking at the actual products they aren’t disabled, so it appears my script is somehow faking the event.

Out of our 3,000+ products, though, one of them was disabled and subsequently M2E Pro removed the listing from eBay.

Here is my script:

<?php
set_time_limit(0);
define('MAGENTO', "/home/discount/public_html");
require_once MAGENTO . '/app/Mage.php';
error_reporting(E_ALL);
ini_set('display_errors', '1');
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$storeId = Mage::app()->getStore('default')->getId();

$products = Mage::getModel('catalog/product')
    ->getCollection()
    ->addAttributeToSelect('sku')
    ->addAttributeToSelect('name')
    ->addAttributeToSelect('meta_title');

$total = count($products);
$count = 1;

foreach ($products as $product)
{
    $mt = sprintf("%s [%s]", $product->getName(), $product->getSku());
    $sku = $product->getSku();
    if ($product->getMetaTitle() != $mt)
    {
        $percent = $count / $total;
        echo $sku." ".$percent."\n";
        $product->setMetaTitle($mt);
        $product->save();
    }
}
?>

I’d like to know what I need to do to my script to make it correctly update the meta title without causing odd events?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:07:11+00:00Added an answer on June 8, 2026 at 4:07 am

    Stab in the dark here, but it’s a good chance the M2E extension has an event listener setup for model/product saves, and in that event listener does things depending on product state.

    By itself this isn’t a problem, but when you load an EAV model via its collection it loads the bare minimum of attributes. Since you haven’t explicitly loaded product status via addAttributeToSelect this may be confusing the M2E extension. Trying adding the status attribute. If that doesn’t work try addAttributeToSelect('*') — M2E may be checking other attributes as well to decide when to pull things.

    Finally, when you load an EAV model via a collection their afterLoad isn’t called. It’s possible the M2E extension (naively) assumes something that happens in afterLoad will have happened, so you may want to call it explicitly for each product.

    $product->afterLoad();
    

    Short of that, you’ll need to reverse engineer M2E to the point in the code where it’s doing it’s above logging and determine why it thinks it needs to disable a product. Since this is a commercial extension, I’d reach out to the developers. If you pay for something you deserve some level of support.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Magento 1.4 Default Product Details image size is 265x265. All of our product images
I am trying to output all the products from our Magento shop - the
We've built up thousands of product urls while using Magento as our cart application
Our magento 1.6.2 cant not reindex product flat data. It also sometimes shows 'There
Situation: We have several small icons on our Magento Product page. After clicking one,
I want to change all of the SKU's I've setup on a Magento installation
Can Magento view/manage our customers by their business name in addition to their contact
I need to update my Magento product details (over 25000 of them) so they
Our Magento store uses the Website Payments Pro payment gateway through PayPal. For the
I've been trying now for a few hours to move our Magento installation from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.