Jump to content

Product Image Import


willowtree

Recommended Posts

PS 1.7.8.3

I am getting error

Undefined property: Product::$image_alt controllers/admin/AdminImportController.php on line 2252

$alt = $product->image_alt[$key];

$product_has_images = (bool) Image::getImages($this->context->language->id, (int) $product->id);
                foreach ($product->image as $key => $url) {
                    $url = trim($url);
                    $error = false;
                    if (!empty($url)) {
                        $url = str_replace(' ', '%20', $url);

                        $image = new Image();
                        $image->id_product = (int) $product->id;
                        $image->position = Image::getHighestPosition($product->id) + 1;
                        $image->cover = (!$key && !$product_has_images) ? true : false;
                        $alt = $product->image_alt[$key];
                        if (strlen($alt) > 0) {
                            $image->legend = self::createMultiLangField($alt);
                        }
                        // file_exists doesn't work with HTTP protocol
                        if (($field_error = $image->validateFields(UNFRIENDLY_ERROR, true)) === true &&
                            ($lang_field_error = $image->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true && $image->add()) {
                            // associate image to selected shops
                            $image->associateTo($shops);
                            if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !$regenerate)) {
                                $image->delete();
                                $this->warnings[] = $this->trans('Error copying image: %url%', ['%url%' => $url], 'Admin.Advparameters.Notification');
                            }
                        } else {
                            $error = true;


 

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

some similar stuff... but on line 2241, server's error log say something with Undefined property: Product::$image_alt, but this image_alt can't be a requeired field, adding that field to the import doesnt change anything. So, in my case, something not right with AdminImportController::copyImg... after that, i changed Images links from https(http) to absolute server's path /home/.../*.jpg and it worked... i think its something wrong with php|apache|fpm settings (folder permissions maybe too, not my case)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...