Beispiel #1
0
 public function report()
 {
     $errors = count($this->errors['sku']) + count($this->errors['name']);
     $success = count($this->products) - $errors;
     $tab = new Tabs();
     $report = new Report();
     $tab->start();
     $tab->start("buttons");
     $tab->button("info", false, true);
     $success > 0 ? $tab->button("success", $success) : $tab->button("success");
     $errors > 0 ? $tab->button("errors", $errors) : $tab->button("errors");
     $tab->end("buttons");
     $tab->start("entries");
     $tab->entry("info", true);
     $report->start("import data");
     $report->entry("info", "info", "Products to be added: " . count($this->products));
     $report->entry($errors > 0 ? "warning" : "success", $errors > 0 ? "warning" : "success", "Products added: {$success}");
     $report->entry($errors > 0 ? "warning" : "info", $errors > 0 ? "warning" : "info", "Errors: {$errors}");
     $report->entry("info", "info", "Clearing parsed data and import file");
     if (unlink($_SESSION['upload_file'])) {
         unset($_SESSION['upload_file']);
         unset($_SESSION['products']);
         $report->entry("success", "success", "Cleared parsed data");
     }
     if ($errors == 0) {
         $report->entry("success", "success", "Import completed without errors");
     } else {
         $report->entry("warning", "warning", "Import completed with errors please review");
     }
     $report->end();
     $tab->entry("end");
     $tab->entry("success");
     $report->start("Successful product creation");
     foreach ($this->products as $key => $product) {
         if (!in_array($product['sku'], $this->errors['sku']) && !in_array($product['name'], $this->errors['name'])) {
             $report->entry("success", "product: {$key}", "Added: " . $product['name']);
         }
     }
     if ($success == 0) {
         $report->entry("info", "info", "No products we're added");
     }
     $report->end();
     $tab->entry("end");
     $tab->entry("errors");
     if (count($this->errors['sku']) > 0) {
         $report->start("Sku duplicates");
         foreach ($this->products as $key => $product) {
             if (in_array($product['sku'], $this->errors['sku'])) {
                 $report->entry("warning", "product: {$key}", "Failed to add product: " . $product['name'] . "<br />Due to duplicated sku: " . $product['sku'] . "<br/>Existing product: " . $this->duplicates[$product['sku']]);
             }
         }
         $report->end();
     }
     if (count($this->errors['name']) > 0) {
         $report->start("Name duplicates");
         foreach ($this->products as $key => $product) {
             if (in_array($product['name'], $this->errors['name'])) {
                 $report->entry("warning", "product: {$key}", "Failed to add product: " . $product['name'] . "<br />Due to not having a valid sku and provided name already exists<br/>Existing product: " . $product['sku']);
             }
         }
         $report->end();
     }
     if ($errors == 0) {
         $report->start("Import errors");
         $report->entry("info", "info", "No products have errors");
         $report->end();
     }
     $tab->entry("end");
     $tab->end("entries");
     $tab->end();
 }
Beispiel #2
0
 public function check_flux()
 {
     $report = new Report();
     $report->start("flux files");
     $report->entry("info", "Flux Settings", "Off");
     $report->entry("info", "Flux Settings", "Checking for existing files");
     $files['Up'] = "../var/magmi-import/flux-up/Flux - {$this->collection_name}.csv";
     $files['Down'] = "../var/magmi-import/flux-down/Flux - {$this->collection_name}.csv";
     foreach ($files as $key => $file) {
         if (is_file($file)) {
             $report->entry("success", "{$key} File", "File exists, deleting file");
             unlink($file);
         } else {
             $report->entry("default", "{$key} File", "File does not exist, doing nothing");
         }
     }
     $report->end();
 }
Beispiel #3
0
    }
} else {
    $mp = $results;
}
$ai = $mage_db->select("m2epro_amazon_listing_product", null, "listing_product_id,sku");
if ($mp and $ai) {
    if ($_SESSION['display']) {
        $report->start("Comparing Amazon Item Sku's to Products", 3);
    }
    foreach ($ai as $si) {
        $result = $mage_db->select("m2epro_listing_product", $si['listing_product_id'], "product_id", 1);
        $si['product_id'] = $result['product_id'];
        if ($mp[$si['product_id']] !== $si['sku']) {
            if ($_SESSION['display']) {
                $entry = $mp[$si['product_id']] . "||" . $si['sku'];
                $report->entry("warning", $si['product_id'], $entry);
            } else {
                $mage_db->delete("m2epro_amazon_listing_product", "`listing_product_id` = " . $si['listing_product_id']);
                $mage_db->delete("m2epro_listing_product", $si['listing_product_id']);
                $html->redirection("../scripts.php");
            }
        }
        // else if($_SESSION['display']) {
        // 	$entry = $mp[$si['product_id']]."||".$si['sku'];
        // 	$report->entry("info", "skipping", $entry);
        // }
    }
    if ($_SESSION['display']) {
        $report->end();
    }
}
Beispiel #4
0
 public function manage()
 {
     global $db;
     $blacklist = $db->select("blacklist");
     $report = new Report();
     $report->start("words & phrases", 3);
     if ($blacklist) {
         foreach ($blacklist as $phrase) {
             if (strpos($phrase['word'], " ") !== false) {
                 $format = "phrase";
             } else {
                 $format = "word";
             }
             $report->entry("default", $format, $phrase['word'] . "||<a class='btn btn-xs btn-danger' href='blacklist.php?d=" . $phrase['id'] . "' role='button'>delete</a>");
         }
     } else {
         $report->entry("danger", "error", "You seriously need to sit down and think about your life.");
     }
     $report->end();
 }
Beispiel #5
0
///////////////////
require "../../app/Mage.php";
Mage::register('isSecureArea', true);
umask(0);
Mage::app();
$categoryCollection = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*')->addFieldToFilter('level', array('gteq' => 2));
//greater than root category id
$report->start("Deleting Empty Categories");
$deleted = 0;
foreach ($categoryCollection as $category) {
    $cname = strtolower($category->getName());
    if ($cname !== "ebay listings" and $cname !== "amazon listings") {
        if ($category->getProductCount() === 0) {
            $deleted++;
            if (!$disable) {
                $report->entry("success", $category->getName(), "Deleted");
                $category->delete();
            } else {
                $report->entry("info", $category->getName(), $category->getProductCount());
            }
        } else {
            $report->entry("info", $category->getName(), $category->getProductCount());
        }
    }
}
if (!$disable) {
    $report->entry("default", "Categories Deleted", $deleted);
}
$report->end();
// echo 'Empty Categories Deleted!';
////////////////