| Server IP : 74.208.250.37 / Your IP : 216.73.216.114 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : miferval ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/brainwavemx/app/Model/ |
Upload File : |
<?php
declare(strict_types=1);
namespace App\Model;
use Mosaico\Model\BaseModel;
class MigrateMagentoVendorModel extends BaseModel
{
public function getVendors(): bool|object
{
$query = $this->connectMagento()->query("
SELECT
option_id as vendor_id,
value as marca
FROM eav_attribute_option_value
WHERE option_id in
(
SELECT DISTINCT(value)
FROM catalog_product_entity_int
WHERE attribute_id = 557
)
");
return $query;
}
public function getVendorsOld(): bool|object
{
$query = $this->connect()->query("
SELECT
A.option_id,
A.value
FROM eav_attribute_option_value A
JOIN
(
SELECT
A.entity_id,
B.value as name,
C.value as status
FROM catalog_category_entity A
JOIN catalog_category_entity_varchar B
ON A.entity_id = B.row_id
AND B.attribute_id = 133
AND B.store_id = 0
JOIN catalog_category_entity_int C
ON A.entity_id = C.row_id
AND C.attribute_id = 136
AND C.store_id = 0
WHERE parent_id = 792
) as B
ON B.name = A.value
WHERE option_id IN
(
SELECT option_id FROM eav_attribute_option
WHERE attribute_id = 557
)
");
return $query;
}
public function getVendorCategories(): bool|object
{
$query = $this->connectMagento()->query("
SELECT
A.entity_id,
B.value as name,
C.value as status,
D.option_id as vendor_id
FROM catalog_category_entity A
JOIN catalog_category_entity_varchar B
ON A.entity_id = B.row_id
AND B.attribute_id = 133
AND B.store_id = 0
JOIN catalog_category_entity_int C
ON A.entity_id = C.row_id
AND C.attribute_id = 136
AND C.store_id = 0
LEFT JOIN eav_attribute_option_value D
ON B.value = D.value
WHERE parent_id = 792
");
return $query;
}
public function insertMarca(int $vendor_id, string $nombre_marca): void
{
$query = $this->connect()->query("
INSERT IGNORE INTO catalogo_marcas SET
id_magento = " . $vendor_id . ",
nombre_marca = '" . $nombre_marca . "'
ON DUPLICATE KEY UPDATE
id_magento = " . $vendor_id . "
");
}
}