Cron ve Arka Plan İşleri

FriSay, döviz fiyatı yenileme, terk edilmiş sepet hatırlatmaları, modül cron'ları ve pazaryeri senkronu için HTTP tabanlı zamanlanmış işler sunar. Jeton, yönetim ayarlarındaki SHOP_TOKEN değeridir (Settings::get('SHOP_TOKEN')).

Kimlik doğrulama

  • Query: ?token=YOUR_SHOP_TOKEN
  • Başlık: X-Cron-Token: YOUR_SHOP_TOKEN
Güvenlik: SHOP_TOKEN değerini şablonlarda, istemci JS'inde veya genel depolarda asla açığa çıkarmayın. Yalnızca sunucu crontab / gizli yapılandırmada tutun.

Çekirdek cron — döviz

GET veya POST /api/cron.php?action=currency&token=... — döviz kurlarına göre ürün fiyatlarını yeniler.

curl -s "https://yoursite.com/api/cron.php?action=currency&token=YOUR_SHOP_TOKEN"

curl -s -X POST \
  -H "X-Cron-Token: YOUR_SHOP_TOKEN" \
  "https://yoursite.com/api/cron.php?action=currency"
Öneri: Sunucu crontab'ında döviz işini her 15–60 dakikada bir çalıştırın.

Terk edilmiş sepet

action=abandoned-cart — yalnızca abandoned-cart modülü kuruluysa anlamlıdır.

curl -s "https://yoursite.com/api/cron.php?action=abandoned-cart&token=YOUR_SHOP_TOKEN"

Modül cron'ları

Modülde $apiActions içinde 'cron' => 'api/cron.php' kaydı varsa:

curl -s "https://yoursite.com/api/module.php?m=MODULE_NAME&action=cron&token=YOUR_SHOP_TOKEN"

Modül mimarisi için Yeni Modül Oluştur sayfasına bakın.

Pazaryeri cron

Sipariş veya soru senkronu için: /api/marketplace.php?action=cron&type=orders|questions&platform=trendyol|hepsiburada|n11&token=...

curl -s "https://yoursite.com/api/marketplace.php?action=cron&type=orders&platform=trendyol&token=YOUR_SHOP_TOKEN"

curl -s "https://yoursite.com/api/marketplace.php?action=cron&type=questions&platform=hepsiburada&token=YOUR_SHOP_TOKEN"

Crontab örneği

# Her 30 dakikada döviz
*/30 * * * * curl -s "https://yoursite.com/api/cron.php?action=currency&token=YOUR_SHOP_TOKEN" >/dev/null 2>&1

# Her saat terk edilmiş sepet (modül kuruluysa)
0 * * * * curl -s "https://yoursite.com/api/cron.php?action=abandoned-cart&token=YOUR_SHOP_TOKEN" >/dev/null 2>&1

İlgili sayfalar

cURL
# Currency / FX product price refresh
curl -s "https://example.com/api/cron.php?action=currency&token=YOUR_SHOP_TOKEN"

# Same via header
curl -s -H "X-Cron-Token: YOUR_SHOP_TOKEN" \
  "https://example.com/api/cron.php?action=currency"

# Abandoned-cart reminders (module must be installed)
curl -s "https://example.com/api/cron.php?action=abandoned-cart&token=YOUR_SHOP_TOKEN"

# Module cron (example: reviews invite job)
curl -s "https://example.com/api/module.php?m=reviews&action=cron&token=YOUR_SHOP_TOKEN"

# Marketplace order sync (Trendyol)
curl -s "https://example.com/api/marketplace.php?action=cron&type=orders&platform=trendyol&token=YOUR_SHOP_TOKEN"

# Marketplace Q&A sync (Hepsiburada), no stock push to marketplace
curl -s "https://example.com/api/marketplace.php?action=cron&type=questions&platform=hepsiburada&send=0&token=YOUR_SHOP_TOKEN"