public static function geo_list($place) { $sql = "\n\t\t\tSELECT g.id,g.full_name,g.name,g.postcode,z.zone_id,z.country_id \n\t\t\tFROM " . DB_PREFIX . "geo g \n\t\t\tLEFT JOIN " . DB_PREFIX . "zone z ON g.zone_id = z.zone_id \n\t\t\tWHERE g.name LIKE '" . oc::db()->escape(trim($place)) . "%' \n\t\t\tAND g.postcode <> '' \n\t\t\tORDER BY population DESC \n\t\t\tLIMIT 100\n\t\t"; return oc::exec($sql); }
$value = trim($found[2]); $aID = false; $exists = $aModel->getAttributes(array('filter_name' => $name)); if (!$exists) { echo "Add attribute: {$name} = {$value} <br>"; $sortOrder = oc::exec2var("SELECT MAX(sort_order) FROM oc_attribute WHERE attribute_group_id={$groupID}"); $sortOrder = $sortOrder ? $sortOrder + 10 : 10; $aModel->addAttribute(array('attribute_group_id' => $groupID, 'sort_order' => $sortOrder, 'attribute_description' => array(1 => array('name' => $name)))); $added = $aModel->getAttributes(array('filter_name' => $name)); $aID = (int) $added[0]['attribute_id']; } else { $aID = (int) $exists[0]['attribute_id']; } $pid = (int) $_REQUEST['product_id']; oc::exec("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int) $pid . "' AND attribute_id = '" . (int) $aID . "'"); oc::exec("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int) $pid . "', attribute_id = '" . (int) $aID . "', language_id = 1 , text = '" . oc::db()->escape($value) . "'"); } } } ?> <html> <head> <meta charset="UTF-8" /> </head> <body> <h1>ДОБАВИТЬ КАТЕГОРИИ</h1> <form method='post'> <p>