OpenCart 🇺🇦

Схема

public mixed verify ( )

Аргументы

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

Описание

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

Исходный код

$this->load->model('openbay/ebay');
$this->load->model('openbay/ebay_template');
$this->load->model('catalog/product');

if ($this->request->server['REQUEST_METHOD'] == 'POST') {
	if ($this->checkConfig() == true) {
		$this->model_openbay_ebay->logCategoryUsed($this->request->post['finalCat']);

		$item_id = $this->openbay->ebay->getEbayItemId($this->request->post['product_id']);

		if ($item_id == false) { // ensure that the sku is not already listed
			$data = $this->request->post;

			if($data['template'] != 'None') {
				$template = $this->model_openbay_ebay_template->get($data['template']);
				$data['template_html'] = (isset($template['html']) ? base64_encode($template['html']) : '');
			}else{
				$data['template_html'] = '';
			}

			if (!empty($data['img_tpl'])) {
				$tmpGalArray = array();
				$tmpThumbArray = array();
				$this->load->model('tool/image');

				foreach ($data['img_tpl'] as $k => $v) {
					$tmpGalArray[$k] = $this->model_tool_image->resize($v, $data['gallery_width'], $data['gallery_height']);
					$tmpThumbArray[$k] = $this->model_tool_image->resize($v, $data['thumb_width'], $data['thumb_height']);
				}

				$data['img_tpl'] = $tmpGalArray;
				$data['img_tpl_thumb'] = $tmpThumbArray;
			}

			$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, p.sort_order FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$data['product_id'] . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'");

			$data['product_info'] = $query->row;

			if(!empty($data['product_info']['sku'])){
				$data['sku'] = $data['product_info']['sku'];
			}

			$json = $this->model_openbay_ebay->ebayVerifyAddItem($data, $this->request->get['options']);

			$this->response->setOutput(json_encode($json));
		} else {
			$this->response->setOutput(json_encode(array('error' => true, 'msg' => 'This item is already listed in your eBay account', 'item' => $item_id)));
		}
	}
} else {
	$this->redirect($this->url->link('extension/openbay/itemList&token=' . $this->session->data['token']));
}