Magento : Problem in Importing the csv file - php

I have a csv file with 2 records. but when i try to upload this file through the magento upload module it's uploading more than 196 records. I crossed check with everything in my file only 2 records are there. What's the problem? It's related to cache or index something??
For your reference i attached the screenshot of the page also.

You probably have records stuck in dataflow_batch_import that are reimporting.
It's a common problem to have stuff stuck in dataflow_batch_(import|export) and Nexcess has a nice cleanout tool here. Dataflow Batch Table cleanout
You can also monitor various log tables for bloat and also look at dataflow table contents with this script to see if you have stuck items before doing another import. Log Table Monitor
Dataflow Import also keeps each import file you've uploaded (var/import will get littered with these unless you manually delete them). Make sure you are choosing the latest file you've uploaded when you go to run the profile. The numbers at the front of the file names in the dropdown list are date/time stamps.

Related

Concrete5: An image could not be created from the given input

Using Concrete5 8.1, I am getting the error An image could not be created from the given input on every page.
I created a custom theme, custom Thumbnail sizes, and custom Page Types, most of the site content has been entered and everything was working well. In reviewing the site before it goes live, I noticed most of the images had been uploaded as fairly large images (2000-4000 pixels wide, nothing insanely huge, but large enough that I wanted to do something about it).
Based on the Concrete5 documentation, I added the following code:
public function getThemeResponsiveImageMap() {
return array(
'timeline_gallery' => '0'
);
}
The timeline_gallery thumbnail has existed since the start of this project, so all images should have already had this thumbnail. But when I refreshed the page, I see the error: An image could not be created from the given input.
Google finds many entries for this error: potentially related to GD not being able to process SVG, PNG, or very large images, and the solution is to address the problem images within the File Manager. However, I cannot get to the File Manager - I cannot get to any page on the site, including any of the dashboard pages (all display the same error).
I then remove the 5 lines of code from above (the only code changes that have taken place over the past 24 hours) and save the page_theme.php, but I still see the same error on every page.
It would be great to be able to fix the image sizes, but at this point, I'd just like to clear the error and make the site work again. I have looked at the Apache log for any specifics on the error (no help, since the error doesn't show up), I have restarted Apache, and then rebooted the machine (all to no avail). With the code being the same as when the site was working earlier today (and all content editors have left, so no content changes have taken place), I'm guessing there might be a queue, either in the file system or database, of images to be resized and one of them is causing an issue... but it's just a guess.
You can clear the error by modifying the FileImageThumbnailPaths table.
Find the table entry where isBuilt is 0.
SELECT * FROM FileImageThumbnailPaths WHERE isBuilt = 0;
In the results, change the entry isBuilt column to 1.
If you have multiple entries to change, you can change them all at once.
UPDATE FileImageThumbnailPaths SET isBuilt = 1 WHERE isBuilt = 0;
Using phpMyAdmin:
select your concrete5 database
click the SQL tab in the top menu bar in the right pane
in the textarea, you can enter the SQL query
Before making any changes to the database, please make a full backup of your database and site files.

Could my file structure be causing the issues with my photo upload system?

I'm trying to create a photo upload system following Adam Khourys online tutorials.
http://www.developphp.com/view.php?tid=1395 - Upload multiple files video
http://www.developphp.com/view.php?tid=1304 - User profile upload
Most of the code is like for like, but with my own variable names used instead. One major difference is instead of creating 3 different file upload fields as in the multiple upload video I created my form to allow multiple selections from just one upload field.
Below is a brief overview of the files, their location and what the page does.
create_post.php located in root directory - the page that allows for image upload
image_uploader.php located in root > includes directory - the page that contains the upload form, made as a seperate file to be included into any page that may require photo uploads.
photo_system.php located in root > parsers directory - the page that handles image upload.
When I go to the create a post page, click the link to upload image(s) all works well, I can see the form, I can even select the files I would like to try and upload but when I click the upload button nothing seems to happen, when photo_system.php should load.
I've added a line of code to photo_system.php right at the top that should bring up an alert box once the page has loaded, in an attempt to debug my issues, but I never see this unless I go directly to image_uploader.php
This has lead me to believe that maybe my relative links to files were the issue so I've tried appending $_SERVER['DOCUMENT_ROOT'] to the start of the links to ensure it can alway locate them from the root directory, currently I have it set up with a hard coded $root variable and still I can't seem to get the system to work.
Is it likey that the file structure and the way the pages interact with each other is my problem? Could anyone take a look at my code for these three files and see if they can spot anything? I've been stumped by this for a week or so now so I think its time to ask for some outside help.
I have my 3 files saved in a txt format so the code can be viewed
http://www.vwrx-project.co.uk/temp_source_code/create_post.txt
http://www.vwrx-project.co.uk/temp_source_code/image_uploader.txt
http://www.vwrx-project.co.uk/temp_source_code/photo_system.txt
It turns out that in the end I was trying to nest two tables one inside the other so this was part of my issue.
The way that I had it set up I was including the photo upload system, image_uploader.php, as a table with an action requesting the photo_system.php file which worked when I went to the image_uploader.php page directly.
I also had in my main page where the images were being uploaded a form that had been set to onsubmit = false and this was canceling out the form action of the included file.
I only found this out when I decided to try and code it straight into one file else I'd still be stuck now.

cs-cart 4.22 - product import

I'm attempting to upload products using a CSV, but a few things are not working as properly.
The product images are not being uploaded at all, The csv field for 'Image detail' has only the name of the file, without anything else, and all the images are uploaded to var/exim/backup/images, Am I missing something?
My stock is managed using product combination, Each combination is a mixture of size and color, However the "combination" field, that's required by CS-cart, is no where to be found manually, only after adding a combination by hand and then checking the database, is the combination field avaiable, that means I cannot use the csv method unless I have a complete table of long product code to actual sizes and colors. Just for reference, this is my combination field in the database for one given combination : 383_1473_459_1701, this is for mediu, green. - How can I upload combinations using CSV without knowing the combination field?
thanks in advance!
I should inform you that starting from CS-Cart or Multi-Vendor version 4.1.1 images can be imported only from the /path/to/cart/var/files/ directory. So you should move all your images to the var/files/1 directory (or its any subdirectory) and correct the path in the Images directory field on the Administration > Import data > Products > Images page in your store admin panel.
For example, if you move your files to the var/files/1/images directory, you should specify images in the Images directory field. Please check it.
I know its quite confusing but I've managed to find out by looking into their forums and seeing that you must put your image files to: /public_html/var/files/1/exim/backup/images/
I can only answer 1: You need to manually upload the images from the old directory to the new directory. (when you are importing the products, there is an image url, that is the folder you must put your images, using ftp, etc.)

Implementation of fully functional media uploading in web application

Suppose we have the web application which handle create, read, update and delete articles and each article should have gallery of images. I have to make one to one relation between Article and Gallery and one to many relation between Gallery and Media.
HTML5 gives a lot of features like multiupload, so I want to use this excellent http://blueimp.github.io/jQuery-File-Upload/ plugin for that. The problem is how to handle the file upload "in memory" like other form's data?
For example when we show the page for create new article we should be able to fill in article's data fields and select images to upload, next when we click the save button the images should start upload and after that the form should submit. When validation fails the images should be still displayed on the frontend, but on the server-side nothink should be saved.
One of the solutions is create somethink like "create entity session temporary id" before displaying the entire form and that id can be used to create temporary directory for save uploads, so after success saved form these images can be moved to appropriate directory, but how to make the "create entity session temporary id"?
The other solution I think is the "with the edit id" approach, because we can handle the uploads with previously saved gallery id, but sometimes I can't save new blank article with gallery, cause some of the fields should't be empty in db.
For the Rails I saw https://github.com/thoughtbot/paperclip gem which in the Readme says:
Paperclip is intended as an easy file attachment library for Active Record. The intent behind it was to keep setup as easy as possible and to treat files as much like other attributes as possible. This means they aren't saved to their final locations on disk, nor are they deleted if set to nil, until ActiveRecord::Base#save is called.
My question is how it works?
The problem with enabling file uploads on the create mask is that you eventually end up with orphaned files. This is because a user is able to trigger the upload without saving the actual entity. While creating a very own UploadBundle I thought about this problem for a while and came to the conclusion that there is no truly proper solution.
I ended up implementing it like this:
Given the fact that our problem arise from orphaned files, I created an Orphanage which is in charge of managing these files. Uploaded files will first be stored in a separate directory, along with the session_id. This helps distinguishing files across different users. After submitting the form to create the actual entity, you can retrieve the files from the orphanage by using only your session id. If the form was valid you can move the files from the temporary orphanage directory to the final destination of your files.
This method has some pitfalls:
The orphanage directory itself should be cleaned on a regular basis using a cron job or the like.
If a user will upload files and choose not to submit the form, but instead start over with a new form, the newly uploaded files are going to be moved in the same directory. Therefore you will get both the files uploaded the first time and the second time after getting the uploaded files.
This is not the ultimate solution to this problem but more of a workaround. It is in my opinion however cleaner than using temporary entities or session based storage systems.
The mentioned bundle is available on Github and supports both Orphanage and the jQuery File Uploader plugin.
1up-lab/OneupUploaderBundle
I haven't work with the case personaly, but my co-worker had similar conundrum. She used
punkave/symfony2-file-uploader-bundle
It's a bundle that wrapps jQuery File Upload plugin. It is in the early stages and a lot of things are missing, such as event, but we gave it a shot.
That's what we do: in newAction() we create entity, generate unique dir ID, and store the ID in entity (via regular setDirId()). Than we create the form, which contains hidden field dirId.
We are uploading the files to temp dir on server via ajax, not during the submit. Ajax request requires the ID. It stores files in temp_dir/prefix_ID
Than it's quite simple. Form is sent. If form is valid - move files from temp to dest dir. If not - we have the ID, and are able to show the images.
However, we do not save information about individual files in a separate table in the database. Every time we read the contents of the folder that corresponds to our dirId.
I know it's not the solution You are asking for. It's rather a workaround.

PyroCMS - Pyrostreams multiple file upload on one entry

I've got the PyroStreams module for PyroCMS and made a stream called portfolio. Everything is working as expected, however it only allows to upload just one image for my file field. That is obvious, but I'd like to know if there's a way to upload multiple images for one stream entry without adding x number of extra file fields. Or do I need to code an extra field type myself to support this? Maybe someone's got it already?
Thanks
According to me you have to create a separate database table that will hold all the images those are related to particular portfolio and the portfolio id by id by which you can fetch the images for particular record and then use any multiple image upload library like http://www.plupload.com/example_queuewidget.php to upload multiple images in the portfolio image table. Hopefully this will help you in achieving what you want.
There's a multi-upload files field type available on the pyrostore.

Categories