예제 #1
0
    curl_close($handle);
    echo $code . '<br />';
    echo $response;
    return $response;
}
/**
 * "pending" flagged sales is the *new sales
 *
 * usage: 
 * php mygassi-salesexport.php
 * php mygassi-salesexport.php referred_to_karlie
 * php mygassi-salesexport.php payed
 * php mygassi-salesexport.php payed [123 -num of sale]
 */
if (null === ($salesState = $argv[1])) {
    $salesState = "payed";
}
EmailNotification::setSubject("Benachrichtigung über den MyGassi CRON Prozess Salesexport");
if (isset($argv[2])) {
    EmailNotification::add("<span style='color:green'>Der Versand der Bestellung " . $salesState . " (" . $argv[2] . ") ist gestartet.</span>");
    logger("Starting: mygassi-salesexport: " . $salesState . " : " . $argv[2]);
    sendContainer(getSale($argv[2]));
} else {
    EmailNotification::add("<span style='color:green'>Der Versand der Bestellungen (" . $salesState . ") ist gestartet.</span>");
    logger("Starting: mygassi-salesexport: " . $salesState);
    sendContainer(getSales($salesState));
}
EmailNotification::add("<span style='color:green'>Der Versand der Bestellungen ist beendet.</span>");
EmailNotification::send();
logger("Done: mygassi-salesexport");
exit(1);
예제 #2
0
<?php

require_once "mygassi-config.php";
require_once "mygassi-logger.php";
require_once "mygassi-send-email.php";
require_once mageroot;
// a running mage client
Mage::app();
// logs the start
logger("Starting: mygassi-check-parcels");
// fills up notification email (administrative issue);
EmailNotification::setSubject("Benachrichtigung über den MyGassi CRON Prozess Get Parcel ID");
EmailNotification::add("<span style='color:black'>Der CRON Job Check Parcel ID startet.</span>");
// selects sales (the ones that are referred to karlie)
$sales = Mage::getModel("sales/order")->getCollection()->addAttributeToFilter("status", "referred_to_karlie");
// loops through the sales and fetches parcel id of each sale
foreach ($sales as $sale) {
    // loads the sale
    $sale = $sale->load($sale->getId());
    // loads order id of current sale
    $orderID = $sale->getIncrementId();
    // loads customer id of the current sale
    $customerID = $sale->getCustomerId();
    // customer of current sale might be a guest
    if (null === $customerID) {
        $customerID = "guest";
    }
    // loads parcel id of the sale (from karlie)
    $message = exec(GetParcelIDCommand . $customerID . "_" . $orderID);
    // fills up CRON notification email
    $color = "green";
예제 #3
0
<?php

require_once "mygassi-logger.php";
require_once "mygassi-config.php";
require_once "mygassi-send-email.php";
require_once mageroot;
Mage::app();
logger("Starting mygassi-retoure.php");
EmailNotification::setSubject("Benachrichtigung über den MyGassi CRON Prozess Retoure");
EmailNotification::add("<span style='color:black'>Der Retoure CRON Prozess startet.</span>");
$coll = Mage::getModel("sales/order")->getCollection()->addAttributeToFilter("state", "sent");
foreach ($coll as $sale) {
    $target = RetMridPath . $sale->getIncrementId();
    logger($target);
    EmailNotification::add("<span style='color:green'>Bestellung: " . $sale->getIncrementId() . "</span>");
    $ch = curl_init($target);
    curl_setopt($ch, CURLOPT_TIMEOUT, 120);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    $res = file_get_contents(RetMridPath . $sale->getIncrementId());
    unlink(RetMridPath . $sale->getIncrementId());
    switch ($res) {
        case null:
        case "":
        case "null":
        case "[]":
            continue;