Example #1
0
<?php

$tables_to_clear = array(User::table(), Customer::table(), Product::table(), Cart::table(), Address::table(), UserLog::table(), Account::table(), AccountHistory::table());
$db = Sdb::getDb();
foreach ($tables_to_clear as $table) {
    $db->exec("TRUNCATE TABLE {$table}");
}
if (_get('exit')) {
    echo '<script src="static/hide.js"></script>';
    echo '<div class="conclusion pass">All Clear!</div>';
    exit;
}
Example #2
0
        if ($image = $this->image()) {
            $this->image = null;
            $this->save();
            $image->unused();
        }
    }
    function variation()
    {
        return $this->has_one(__CLASS__, 'variation');
    }
    function group()
    {
        return $this->belongs_to(NS . 'Group', 'group');
    }
    function files()
    {
        return FileListItem::relationTo($this);
    }
    // Ensures 'desc_html' field is filled with formatted 'desc' (product description).
    // If it isn't formats it and saves.
    function withHTML()
    {
        if (!$this->desc_html) {
            $this->desc_html = format('product', $this->desc);
            $this->save();
        }
        return $this;
    }
}
Product::$table = \Config::get('vanemart::general.table_prefix') . Product::$table;