هل تريد النشر التلقائي بعد كل scraping أم يدوياً ع

← العودة
Blog Post

عنوان المحادثة: هل تريد النشر التلقائي بعد كل scraping أم يدوياً عبر Dashboard؟

التاريخ: 29.04.2026

التصنيف: 💻 البرمجة وتطوير البرمجيات

إجمالي الرسائل: 3 | ياسر: 3 | M: 0

Yasser
هل تريد النشر التلقائي بعد كل scraping أم يدوياً عبر Dashboard؟
Yasser
هل تريد نقل المنتجات الموجودة حالياً في PostgreSQL للمتجر الجديد أم فقط المنتجات الجديدة مستقبلاً؟
Yasser
Image handling (Phase 2 or 3):Option A: Store external URLs in photos field (Active eCommerce supports external images in some contexts, but safer to download).Option B: Download images to public/uploads/products/ and store local paths. Preferred for production reliability.Phase 3: Celery TasksAdd new tasks in tasks/publisher_tasks.py:@celery.task(name='tasks.publish_to_active_ecommerce')def publish_to_active_ecommerce(self): ...@celery.task(name='tasks.publish_site_to_active_ecommerce')def publish_site_to_active_ecommerce(self, site_name: str): ...These mirror the existing WooCommerce tasks but call the new publisher.Phase 4: Dashboard IntegrationAdd to the FastAPI dashboard:New buttons "Publish to Active eCommerce" next to existing WooCommerce buttons.Status indicators for Active eCommerce publishing.API endpoints:POST /api/publish/active_ecommerce/allPOST /api/publish/active_ecommerce/{site_name}Phase 5: Environment & ConfigAdd to .env:# Active eCommerce MySQLACTIVE_ECOMMERCE_DB_HOST=localhostACTIVE_ECOMMERCE_DB_PORT=3306ACTIVE_ECOMMERCE_DB_NAME=almadah_shopACTIVE_ECOMMERCE_DB_USER=rootACTIVE_ECOMMERCE_DB_PASSWORD=ACTIVE_ECOMMERCE_UPLOAD_PATH=/var/www/almadah/public/uploads/productsData Mapping DetailsCategories MappingActive eCommerce uses:categories table: id, parent_id, level, name, slugcategory_translations: category_id, name, langScraper has 3 levels (main, sub, sub_sub) in both EN and AR.Algorithm:Find or create main category (level=0, parent_id=0).Find or create sub category (level=1, parent_id=main.id).Find or create sub_sub category (level=2, parent_id=sub.id).Link product to sub_sub category id in product_categories.Insert translations for each level.Brands Mappingbrands table: id, name, slugbrand_translations: brand_id, name, langReuse existing brands_mapping.json logic from WooCommerce publisher.Slug GenerationPython equivalent of Laravel's Str::slug + suffix logic:def generate_slug(name, session): slug = slugify(name) count = session.query(Product).filter(Product.slug.like(f'{slug}%')).count() if count > 0: slug = f"{slug}-{count + 1}" return slugFiles to Create/ModifyNew Filespublishers/active_ecommerce_publisher.py — main publisher classdashboard/db/models_active_ecommerce.py — SQLAlchemy models for MySQL tables (optional, can use raw SQL)seed_sellers.py — one-time script to create 7 sellersModified Filestasks/publisher_tasks.py — add Active eCommerce Celery tasksdashboard/main.py — add new API endpoints and UI buttonsdashboard/templates/ — add Active eCommerce publish buttons.env.example — add Active eCommerce DB configRisk MitigationDuplicate SKUs: Check products.sku before insert. Use composite_sku as unique key.Missing Categories: If AI categorization is NULL, skip product or assign to a default "Uncategorized" category.Image Failures: Log failed downloads but continue. Product is created without images.DB Charset: Active eCommerce uses utf8_unicode_ci. Ensure SQLAlchemy connection uses UTF-8.Foreign Key Order: Insert users → sellers → shops first, then products, then translations/stocks.Testing StrategyRun seed_sellers.py against local/dev MySQL.Run active_ecommerce_publisher.py manually on 1-2 products.Verify product appears in seller panel and frontend.Run full Celery task on one spider (e.g., aptools).Verify dashboard shows correct status.RollbackKeep WooCommerce publisher untouched.PublishingStatus tracks which products were published where.Deleting from Active eCommerce is a manual SQL operation if needed.
المحادثة الكاملة - 29.04.2026
ياسر
هل تريد النشر التلقائي بعد كل scraping أم يدوياً عبر Dashboard؟
29.04.2026 09:43
ياسر
هل تريد نقل المنتجات الموجودة حالياً في PostgreSQL للمتجر الجديد أم فقط المنتجات الجديدة مستقبلاً؟
29.04.2026 09:44
ياسر
Image handling (Phase 2 or 3):Option A: Store external URLs in photos field (Active eCommerce supports external images in some contexts, but safer to download).Option B: Download images to public/uploads/products/ and store local paths. Preferred for production reliability.Phase 3: Celery TasksAdd new tasks in tasks/publisher_tasks.py:@celery.task(name='tasks.publish_to_active_ecommerce')def publish_to_active_ecommerce(self): ...@celery.task(name='tasks.publish_site_to_active_ecommerce')def publish_site_to_active_ecommerce(self, site_name: str): ...These mirror the existing WooCommerce tasks but call the new publisher.Phase 4: Dashboard IntegrationAdd to the FastAPI dashboard:New buttons "Publish to Active eCommerce" next to existing WooCommerce buttons.Status indicators for Active eCommerce publishing.API endpoints:POST /api/publish/active_ecommerce/allPOST /api/publish/active_ecommerce/{site_name}Phase 5: Environment & ConfigAdd to .env:# Active eCommerce MySQLACTIVE_ECOMMERCE_DB_HOST=localhostACTIVE_ECOMMERCE_DB_PORT=3306ACTIVE_ECOMMERCE_DB_NAME=almadah_shopACTIVE_ECOMMERCE_DB_USER=rootACTIVE_ECOMMERCE_DB_PASSWORD=ACTIVE_ECOMMERCE_UPLOAD_PATH=/var/www/almadah/public/uploads/productsData Mapping DetailsCategories MappingActive eCommerce uses:categories table: id, parent_id, level, name, slugcategory_translations: category_id, name, langScraper has 3 levels (main, sub, sub_sub) in both EN and AR.Algorithm:Find or create main category (level=0, parent_id=0).Find or create sub category (level=1, parent_id=main.id).Find or create sub_sub category (level=2, parent_id=sub.id).Link product to sub_sub category id in product_categories.Insert translations for each level.Brands Mappingbrands table: id, name, slugbrand_translations: brand_id, name, langReuse existing brands_mapping.json logic from WooCommerce publisher.Slug GenerationPython equivalent of Laravel's Str::slug + suffix logic:def generate_slug(name, session): slug = slugify(name) count = session.query(Product).filter(Product.slug.like(f'{slug}%')).count() if count > 0: slug = f"{slug}-{count + 1}" return slugFiles to Create/ModifyNew Filespublishers/active_ecommerce_publisher.py — main publisher classdashboard/db/models_active_ecommerce.py — SQLAlchemy models for MySQL tables (optional, can use raw SQL)seed_sellers.py — one-time script to create 7 sellersModified Filestasks/publisher_tasks.py — add Active eCommerce Celery tasksdashboard/main.py — add new API endpoints and UI buttonsdashboard/templates/ — add Active eCommerce publish buttons.env.example — add Active eCommerce DB configRisk MitigationDuplicate SKUs: Check products.sku before insert. Use composite_sku as unique key.Missing Categories: If AI categorization is NULL, skip product or assign to a default "Uncategorized" category.Image Failures: Log failed downloads but continue. Product is created without images.DB Charset: Active eCommerce uses utf8_unicode_ci. Ensure SQLAlchemy connection uses UTF-8.Foreign Key Order: Insert users → sellers → shops first, then products, then translations/stocks.Testing StrategyRun seed_sellers.py against local/dev MySQL.Run active_ecommerce_publisher.py manually on 1-2 products.Verify product appears in seller panel and frontend.Run full Celery task on one spider (e.g., aptools).Verify dashboard shows correct status.RollbackKeep WooCommerce publisher untouched.PublishingStatus tracks which products were published where.Deleting from Active eCommerce is a manual SQL operation if needed.
29.04.2026 09:47
← العودة إلى الرئيسية