コード例 #1
0
ファイル: MageDB.class.php プロジェクト: HQPDevCrew/BPU
 public function connect()
 {
     if (!isset(self::$connection)) {
         self::$connection = new mysqli($this->mage_host, $this->mage_user, $this->mage_pass, $this->mage_name);
     }
     if (self::$connection === false) {
         return false;
     }
     return self::$connection;
 }
コード例 #2
0
ファイル: brand.php プロジェクト: HQPDevCrew/BPU
header("Expires: 0");
// Proxies.
require_once '../config.php';
function __autoload($class_name)
{
    include "../" . APP_CLASSES . "{$class_name}.class.php";
}
$html = new Frontend();
$report = new Report();
$alerts = new Alerts();
$scripts = new Scripts();
///////////////////
// Start Script	 //
///////////////////
$_SESSION['debug'] = true;
$mage_db = new MageDB();
$db = new Database();
$settings = $db->select('settings', 1, '*', 1);
$codes = ['brand', 'manufacturer'];
foreach ($codes as $code) {
    $attribute = $mage_db->select('eav_attribute', "`attribute_code`='{$code}'", '*', 1);
    if ($attribute) {
        $products = $mage_db->select('catalog_product_entity');
        if ($products) {
            foreach ($products as $product) {
                $varchar = $mage_db->select('catalog_product_entity_varchar', '`attribute_id`=' . $attribute['attribute_id'] . ' AND `entity_id`=' . $product['entity_id'], '*', 1);
                if ($varchar) {
                    $mage_db->update('catalog_product_entity_varchar', 'value', $settings['brand'], '`attribute_id`=' . $attribute['attribute_id'] . ' AND `entity_id`=' . $product['entity_id']);
                } else {
                    $mage_db->insert('catalog_product_entity_varchar', 'entity_type_id,attribute_id,entity_id,value', '4||' . $attribute['attribute_id'] . '||' . $product['entity_id'] . '||' . $settings['brand']);
                }
コード例 #3
0
ファイル: gtin.php プロジェクト: HQPDevCrew/BPU
header("Expires: 0");
// Proxies.
require_once '../config.php';
function __autoload($class_name)
{
    include "../" . APP_CLASSES . "{$class_name}.class.php";
}
$html = new Frontend();
$report = new Report();
$alerts = new Alerts();
$scripts = new Scripts();
///////////////////
// Start Script	 //
///////////////////
$_SESSION['debug'] = true;
$mage_db = new MageDB();
$attribute = $mage_db->select('eav_attribute', "`attribute_code`='gtin'", '*', 1);
if ($attribute) {
    $mage_db->update('eav_attribute', 'attribute_code,frontend_label,is_required,default_value', 'ean||EAN||1||EXCEP', "`attribute_id`=" . $attribute['attribute_id']);
} else {
    $attribute = $mage_db->select('eav_attribute', "`attribute_code`='ean'", '*', 1);
}
if ($attribute) {
    $mage_db->update('eav_attribute_label', 'value', 'EAN', "`attribute_id`=" . $attribute['attribute_id']);
    $products = $mage_db->select('catalog_product_entity');
    if ($products) {
        foreach ($products as $product) {
            $varchar = $mage_db->select('catalog_product_entity_varchar', '`attribute_id`=' . $attribute['attribute_id'] . ' AND `entity_id`=' . $product['entity_id'], '*', 1);
            if ($varchar) {
                $mage_db->update('catalog_product_entity_varchar', 'value', 'EXCEP', '`attribute_id`=' . $attribute['attribute_id'] . ' AND `entity_id`=' . $product['entity_id']);
            } else {
コード例 #4
0
ファイル: m2e.php プロジェクト: HQPDevCrew/BPU
$scripts = new Scripts();
if (isset($_GET['display'])) {
    if ($_GET['display'] == "true") {
        $display = true;
    } else {
        $display = false;
    }
}
$_SESSION['display'] = isset($display) ? $display : true;
if ($_SESSION['display']) {
    echo '<div class="container-fluid"><div class="row"><div class="col-xs-12 text-center"><h3>Running Amazon Listing Fix</h3></div></div><div class="row"><hr /><div class="col-xs-6 col-xs-offset-3">';
}
///////////////////
// Start Script	 //
///////////////////
$mage_db = new MageDB();
$results = $mage_db->select("catalog_product_entity", null, "entity_id,sku");
if ($results) {
    foreach ($results as $result) {
        $mp[$result['entity_id']] = $result['sku'];
    }
} 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);