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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:10:29+00:00 2026-06-15T19:10:29+00:00

There i am creating a product dynamically from a Helper function. this creates fine.

  • 0

There i am creating a product dynamically from a Helper function. this creates fine. and set image work fine for default store view. but for multistore view, image not selected as ‘thumbnail’, ‘small_image’ or ‘image’.

       $product = new Mage_Catalog_Model_Product();

        // Build the product
        //$product->setSku('pkg-sku-1');
        $product->setAttributeSetId(4); //default attribute-set
        $product->setTypeId('simple');
        $product->setName($pkg_data['pkg_name']);
        $product->setCategoryIds(array(7)); # some cat id's, my is 7

        $product->setWebsiteIDs(array(1)); # Website id, my is 1 (default frontend)
        $product->setDescription('EventPackageForOrder');
        $product->setShortDescription($pkg_id);
        $product->setPrice($pkg_data['pkg_price']); # Set some price


        //Default Magento attribute
        $product->setWeight(4.0000);
        $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
        $product->setStatus(1);
        $product->setTaxClassId(2); # Taxable goods
        $product->setStockData(array(
            'is_in_stock' => 1,
            'qty' => 5
        ));

        $im_url_path = Mage::getBaseUrl('media').'eventdiscpkgs/event_logo.jpeg'; 
        $im_absolute_path = Mage::getBaseDir('media') . DS . 'eventdiscpkgs/event_logo.jpeg';

        $product->setMediaGallery (array('images'=>array (), 'values'=>array ()));
        $product->addImageToMediaGallery($im_absolute_path, array ('thumbnail'), false, false);
        $product->addImageToMediaGallery($im_absolute_path, array ('small_image'), false, false);
        $product->addImageToMediaGallery($im_absolute_path, array ('image'), false, false);



        $product->setHasOptions(true);








        $product->setCreatedAt(strtotime('now'));
        try {

            $product->save();
        }
        catch (Exception $ex) {

            $ex->getMessage();
        }

ANY Idea where i can change.

  • 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-15T19:10:30+00:00Added an answer on June 15, 2026 at 7:10 pm

    Try to assign image for each store id:

    foreach($product->getStoreIds() as $storeId) {
        $product->setStoreId($storeId)
            ->setImage($im_absolute_path)
            ->setSmallImage($im_absolute_path)
            ->setThumbnail($im_absolute_path);
        $product->save()
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my code I'm creating a product list dynamically using PHP (see image) and
Is there any possibility of creating a view like the following image? I do
In select.phtml under /template/bundle/catalog/product/view/options/type/bundle/option/select.phtml it has the function for creating options for the select
When creating a configurable product there are options as to what is to be
I am creating an web app from scratch and was wondering if there is
In Magento, when I'm creating a product from Catalog -> Manage Products -> Add
hi there Iam creating a Paypal IPN and i have a pay now button
Is there any way creating a photo gallery using Listview control ? Im playing
Is there a trick for creating a faster integer modulus than the standard %
When creating a standard MVC 3 project there is an EntityFramework.dll and .xml file

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.