OpenCart 🇺🇦

Схема

public mixed loadSellerStore ( )

Аргументы

Аргумент Возможный тип Описание
У метода нет аргументов

Описание

Метод пока еще не документирован.

Исходный код

$store = $this->call('setup/getSellerStore/', array(), array(), 'json', true);

if($this->lasterror != true) {
	if($store['store'] == true) {
		$this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "ebay_store_category`;");
		$this->db->query("
					CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "ebay_store_category` (
					  `ebay_store_category_id` int(11) NOT NULL AUTO_INCREMENT,
					  `parent_id` int(11) NOT NULL,
					  `CategoryID` char(100) NOT NULL,
					  `CategoryName` char(100) NOT NULL,
					  PRIMARY KEY (`ebay_store_category_id`)
					) ENGINE=MyISAM  DEFAULT CHARSET=latin1;");

		if(!empty($store['settings']['categories'])) {
			foreach($store['settings']['categories'] as $cat1) {
				$this->db->query("INSERT INTO `" . DB_PREFIX . "ebay_store_category` SET `CategoryID` = '".$this->db->escape($cat1['id'])."', `CategoryName` = '".$this->db->escape($cat1['name'])."'");
				$id1 = $this->db->getLastId();

				if(!empty($cat1['children'])) {
					foreach($cat1['children'] as $cat2) {
						$this->db->query("INSERT INTO `" . DB_PREFIX . "ebay_store_category` SET `CategoryID` = '".$this->db->escape($cat2['id'])."', `CategoryName` = '".$this->db->escape($cat2['name'])."', `parent_id` = '".$this->db->escape($id1)."'");
						$id2 = $this->db->getLastId();

						if(!empty($cat2['children'])) {
							foreach($cat2['children'] as $cat3) {
								$this->db->query("INSERT INTO `" . DB_PREFIX . "ebay_store_category` SET `CategoryID` = '".$this->db->escape($cat3['id'])."', `CategoryName` = '".$this->db->escape($cat3['name'])."', `parent_id` = '".$this->db->escape($id2)."'");
								$id3 = $this->db->getLastId();

								if(!empty($cat3['children'])) {
									foreach($cat3['children'] as $cat4) {
										$this->db->query("INSERT INTO `" . DB_PREFIX . "ebay_store_category` SET `CategoryID` = '".$this->db->escape($cat4['id'])."', `CategoryName` = '".$this->db->escape($cat4['name'])."', `parent_id` = '".$this->db->escape($id3)."'");
										$id4 = $this->db->getLastId();
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

return array('msg' => $this->lastmsg, 'error' => $this->lasterror);