/Bulk-Products-CSV-Upload-With-Job-Batching

This Laravel application allows you to import product data from an Excel file into a database, validating against unique SKUs and sending email notifications for duplicate SKUs.

Primary LanguageJavaScript

APIMIO CSV Products Importer

This Laravel application allows you to import product data from an Excel file into a database, validating against unique SKUs and sending email notifications for duplicate SKUs.

Getting Started

Prerequisites

  • PHP (7.3 or later)
  • Composer
  • MySQL or another database system
  • SMTP-enabled email account (Gmail recommended)

Installation

  1. Clone the repository:
git clone https://github.com/your-username/product-importer.git
cd product-importer
  1. Install the dependencies:
composer install
  1. Copy the .env.example file to .env and configure it with your environment details:
cp .env.example .env

Update the following settings:

  • DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD for your database.
  • MAIL_MAILER, MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD for your email configuration.
  1. Generate the application key:
php artisan key:generate
  1. Run migrations to create the necessary database tables:
php artisan migrate
  1. Start the development server:
php artisan serve

Usage

  1. Access the application by visiting http://127.0.0.1:8000 in your browser.
  2. On the web page, you can upload an Excel file containing product data. The expected CSV format is as follows:
CSV File Structure:
 Your CSV file should contain the following columns:
- Title
- Description(body)
- SKU(handle)
- Type
- Publish Status

- Sample CSV File: You can download a sample CSV file from this link to better understand the expected format.

Ensure that the CSV file has column names corresponding to the ones listed above.

  1. Before importing, make sure to update the .env file with your custom email and password, and the database name.
  2. Upon import, the application will validate for unique SKUs. If a duplicate SKU is found, an email notification will be sent to the configured email address (customizable in the ProductImport class).

Customization

  • Customize the validation rules, email content, and other import-related logic in the ProductImport class (app/Imports/ProductImport.php).
  • Customize the email content and layout in the DuplicateSkuNotification Mailable class (app/Mail/DuplicateSkuNotification.php).

Troubleshooting

  • If you encounter issues, ensure that you have correctly configured the .env file with the appropriate database and email settings.

Contributing

Contributions are welcome! If you find a bug or have an enhancement in mind, feel free to submit a pull request.

License

This project is licensed under the MIT License.