Usunięcie zbędnych plików .DS_Store oraz plików tymczasowych w module empikmarketplace

This commit is contained in:
2025-03-24 23:46:50 +01:00
parent 9b9872b0cf
commit 9074c2fb27
34 changed files with 239 additions and 95 deletions

View File

@@ -1,46 +0,0 @@
<?php
namespace Empik\Marketplace\Repository;
use Db;
use DbQuery;
use Empik\Marketplace\Utils\Utils;
class AttributeRepository
{
/** @var Db */
protected $db;
/** @var int */
protected $langId;
public function __construct()
{
$this->db = Db::getInstance();
$this->langId = Utils::getLangId();
}
public function getAttributes($productId, $productAttributeId)
{
$sql = new DbQuery();
$sql->select('al.name AS value, agl.public_name AS name');
$sql->from('attribute_group', 'ag');
$sql->leftJoin('attribute_group_lang', 'agl', 'agl.id_attribute_group = ag.id_attribute_group AND agl.id_lang = ' . (int)$this->langId);
$sql->leftJoin('product_attribute', 'pa', 'pa.id_product = ' . (int)$productId . ' AND pa.id_product_attribute = ' . (int)$productAttributeId);
$sql->leftJoin('product_attribute_combination', 'pac', 'pac.id_product_attribute = pa.id_product_attribute');
$sql->leftJoin('attribute', 'a', 'a.id_attribute = pac.id_attribute AND ag.id_attribute_group = a.id_attribute_group');
$sql->leftJoin('attribute_lang', 'al', 'al.id_attribute = a.id_attribute AND al.id_lang = ' . (int)$this->langId);
$sql->orderBy('ag.id_attribute_group');
$result = $this->db->executeS($sql);
$resultGrouped = [];
foreach ($result as $item) {
if (!isset($resultGrouped[$item['name']]) || $item['value']) {
$resultGrouped[$item['name']] = $item;
}
}
return (array)$resultGrouped;
}
}