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 6926327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:54:13+00:00 2026-05-27T10:54:13+00:00

I have to create a simple Magento 1.6.x import agent that suppose to create/update

  • 0

I have to create a simple Magento 1.6.x import agent that suppose to create/update products and their images. Could someone advise me how to add product image without having to use the magento API?

The api performance turned out to be very poor and I am starting to be a little frustrated.. 🙁

I have found some other questions regarding this problem, but none of them concerns with adding images to the product.

This is what I came with:

$product->setIsMassupdate(true)
    ->setExcludeUrlRewrite(true)
    ->setManufacturer($this->addManufacturers(utf8_encode($record[4])))
    ->setSku($record[3])
    ->setAttributeSetId($this->attribute_set)# 9 is for default
    ->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE)
    ->setName(utf8_encode($record[5]))
    ->setCategoryIds($this->getCategories(array($record[0], $record[1], $record[2]))) # some cat id's,
    ->setWebsiteIDs(array(1)) # Website id, 1 is default
    ->setDescription(utf8_encode($record[6]))
    ->setShortDescription($this->shortText(utf8_encode($record[6]), 150))
    ->setPrice($price) # Set some price
    ->setSpecialPrice($special_price)
    ->setWeight($record[12])
    ->setStatus( Mage_Catalog_Model_Product_Status::STATUS_ENABLED )
    ->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
    ->setTaxClassId(2)     // default tax class
    ->setPixmaniaimg($record[10])
    ->setStockData(array('is_in_stock' => $inStock, 'qty' => $qty))
    ->setCreatedAt(strtotime('now'));

Can someone help me with adding images directly without the API?

Thanks

Lukas

  • 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-05-27T10:54:14+00:00Added an answer on May 27, 2026 at 10:54 am

    I did this in Magento 1.6.1. Just put your image URL paths in the first array and you are good to go.

    Also look at Mage_Catalog_Model_Product to become familiar with addImageToMediaGallery() and other methods you’ll undoubtedly need to be aware of in the future.

    // Add three image sizes to media gallery
    $mediaArray = array(
        'thumbnail'   => $putPathHere,
        'small_image' => $putPathHere,
        'image'       => $putPathHere,
    );
    
    // Remove unset images, add image to gallery if exists
    $importDir = Mage::getBaseDir('media') . DS . 'import/';
    
    foreach($mediaArray as $imageType => $fileName) {
        $filePath = $importDir.$fileName;
        if ( file_exists($filePath) ) {
            try {
                $product->addImageToMediaGallery($filePath, $imageType, false);
            } catch (Exception $e) {
                echo $e->getMessage();
            }
        } else {
            echo "Product does not have an image or the path is incorrect. Path was: {$filePath}<br/>";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some simple catalog products in Magento, so I have their SKUs &
I have a requirement to create a simple windows forms application that allows an
In a vanilla install of Magento 1.5.1.0 I have created simple products COLOR-RED, COLOR-BLUE
I want to create a array of all sku's of simple products in magento.
I have create a simple grid that retrieves data from a server through php.
I have written a simple Magento plugin that simply lists all sub categories that
I have to create a simple app, that will suit as an example of
Suppose you have to create a simple 2D animation, like the drawing of a
I have no problem importing simple products using Magento Core API (SOAP). How can
I have a simple create action that save a product to DB. after saving

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.