|
@@ 840-846 (lines=7) @@
|
| 837 |
|
foreach ($categories as $categoryKey => $category) { |
| 838 |
|
$selectedCategory = $this->manager->getConnection()->executeQuery('SELECT `id` FROM s_plugin_connect_categories WHERE category_key = ? AND shop_id = ?', |
| 839 |
|
[$categoryKey, $shopId]); |
| 840 |
|
if (!($res = $selectedCategory->fetch())) { |
| 841 |
|
$this->manager->getConnection()->executeQuery('INSERT INTO s_plugin_connect_categories (category_key, label, shop_id) VALUES (?, ?, ?)', |
| 842 |
|
[$categoryKey, $category, $shopId]); |
| 843 |
|
$categoryId = (int) $this->manager->getConnection()->lastInsertId(); |
| 844 |
|
} else { |
| 845 |
|
$categoryId = (int) $res['id']; |
| 846 |
|
} |
| 847 |
|
$selectedProductToCategory = $this->manager->getConnection()->executeQuery('SELECT COUNT(*) FROM s_plugin_connect_product_to_categories WHERE connect_category_id = ? AND articleID = ?', |
| 848 |
|
[$categoryId, (int) $row['article_id']] |
| 849 |
|
)->fetchColumn(); |
|
@@ 939-946 (lines=8) @@
|
| 936 |
|
{ |
| 937 |
|
$selectedCategory = $this->manager->getConnection()->executeQuery('SELECT `id` FROM s_plugin_connect_categories WHERE category_key = ? AND shop_id IS NULL', |
| 938 |
|
[$categoryKey]); |
| 939 |
|
if (!($res = $selectedCategory->fetch())) { |
| 940 |
|
$this->manager->getConnection()->executeQuery('INSERT INTO s_plugin_connect_categories (category_key, label, shop_id) VALUES (?, ?, ?)', |
| 941 |
|
[$categoryKey, $category, $shopId]); |
| 942 |
|
$createdCategoryId = (int) $this->manager->getConnection()->lastInsertId(); |
| 943 |
|
$this->assignLocalCategories($createdCategoryId, $categoryKey); |
| 944 |
|
|
| 945 |
|
return $createdCategoryId; |
| 946 |
|
} |
| 947 |
|
|
| 948 |
|
$this->manager->getConnection()->executeQuery('UPDATE s_plugin_connect_categories SET shop_id = ? WHERE id = ?', |
| 949 |
|
[$shopId, $res['id']]); |