# MTEngine — Frequently Asked Questions

---

## Installation

**Q: Which PHP version is required?**
A: PHP 8.1 minimum. PHP 8.2+ is recommended for best performance.

**Q: Does it work on shared hosting?**
A: Yes. MTEngine is designed for shared cPanel/Plesk hosting. It does not require SSH, Composer, or Node.js.

**Q: The installer shows a blank page.**
A: Open `.env` and set `APP_DEBUG=true`, then refresh. The error message will appear. Common causes: wrong database credentials, missing PHP extensions (PDO, cURL, mbstring).

**Q: Can I install it in a subdirectory (e.g. example.com/shop)?**
A: Yes. Set `APP_URL=https://example.com/shop` in `.env` and update `RewriteBase /shop/` in `.htaccess`.

**Q: The installer keeps showing after I finish installation.**
A: Check that `storage/installed.lock` was created. If not, ensure the `storage/` directory is writable by the web server (chmod 755).

---

## Admin Panel

**Q: I forgot my admin password.**
A: Use the "Forgot Password" link on the admin login page at `/admin/`. An email reset link will be sent if your SMTP is configured, otherwise update the password hash directly in the `admins` table.

**Q: How do I add a new admin user?**
A: Go to **Admin → Team** and click "Add Member". Set their role and permissions.

**Q: The admin panel is slow with many orders.**
A: As of v1.1.0, the orders list is paginated (50 per page). Make sure you are on the latest version. Also ensure your MySQL server has proper indexes (the upgrade SQL adds them automatically).

---

## Products

**Q: Can I use a regular text editor instead of EditorJS for product descriptions?**
A: Yes. If the description is not valid EditorJS JSON, the system falls back to rendering it as raw HTML (sanitized for XSS safety as of v1.1.0).

**Q: How do I set up product variants (sizes, colors)?**
A: In the product editor, scroll to the Variants section. Add size and color options. Stock can be tracked per variant combination.

**Q: How do I create a landing page for a product?**
A: Go to **Admin → AI Landing Pages → Create**. Select a product, give the page a name, and use the AI builder to generate sections. Publish it and share `/lp/your-slug`.

---

## Orders

**Q: Can customers pay online?**
A: MTEngine is built for Cash on Delivery (COD) orders, which is the dominant payment method in the Algerian market. Online payment gateway support can be added via plugins.

**Q: How do I export orders to Excel/CSV?**
A: Go to **Admin → Orders** and click the Export CSV button. For automatic syncing, configure Google Sheets integration under **Admin → Settings → Integrations**.

---

## Shipping

**Q: How do I configure Yalidine?**
A: Go to **Admin → Settings → Shipping → Yalidine**. Enter your API ID and token from your Yalidine dashboard. Enable the integration and set your shipping prices per wilaya.

**Q: Shipping prices are not loading in the checkout.**
A: Verify: (1) the shipping provider integration is active, (2) API credentials are correct, (3) your hosting allows outbound cURL requests to the provider's API.

**Q: Can customers choose their shipping company?**
A: Yes. Under **Admin → Settings → Shipping**, set "Provider Selection Mode" to "Customer Choice" and enable the providers you want to offer.

---

## SEO

**Q: How do I edit the sitemap?**
A: The sitemap at `/sitemap.xml` is generated dynamically by `public/sitemap.php`. It includes all published products, categories, and pages automatically. No manual editing needed.

**Q: How do I set a noindex on a specific page?**
A: For CMS pages, edit the page in **Admin → Pages** and set the robots meta field. For product pages, set it in the product SEO settings.

**Q: My 404 pages were showing as 200 OK in Google Search Console.**
A: This was a known bug (ErrorDocument 404 redirecting to /) fixed in v1.1.0. Upgrade and re-submit your sitemap to Google.

---

## Security

**Q: Is MTEngine secure for a production store?**
A: MTEngine includes multiple security layers: CSRF protection, PDO prepared statements, upload directory protection, HTML sanitization, and security headers. Keep it updated and follow general server hardening practices.

**Q: Can I use MTEngine with an SSL certificate?**
A: Yes, and it is strongly recommended. Set `APP_URL=https://yourdomain.com` in `.env` and ensure your hosting has SSL enabled.

---

## Troubleshooting

**Q: "CSRF Token Mismatch" error when submitting forms.**
A: Usually caused by session issues. Check that `session.save_path` is writable on your server. Also check that your domain does not have mixed HTTP/HTTPS content.

**Q: Images are uploading but not displaying.**
A: Check that `uploads/` directory has the correct permissions (755) and that the `APP_URL` in `.env` matches your actual domain.

**Q: The AI description generator is not working.**
A: Go to **Admin → Settings → AI** and verify your Google Gemini API key is entered and valid. Ensure your hosting can make outbound HTTPS requests to `generativelanguage.googleapis.com`.

---

## Support

For issues not covered here, contact support via your purchase platform's support page.
