PriceGroup example

return $price;
    }

    /** * @param array $data * * @return PriceGroup */
    public function hydratePriceGroup($data)
    {
        $group = new PriceGroup();

        $first = $data[0];

        $group->setId((int) $first['__priceGroup_id']);
        $group->setName($first['__priceGroup_description']);

        $discounts = [];
        foreach ($data as $row) {
            $discounts[] = $this->hydratePriceDiscount($row);
        }

        
if (!empty($data['__productAttribute_id'])) {
            $this->assignAttributeData($product$data);
        }

        return $product;
    }

    private function assignPriceGroupData(ListProduct $product, array $data): void
    {
        if (!empty($data['__priceGroup_id'])) {
            $product->setPriceGroup(new PriceGroup());
            $product->getPriceGroup()->setId((int) $data['__priceGroup_id']);
            $product->getPriceGroup()->setName($data['__priceGroup_description']);
        }
    }

    /** * Helper function which assigns the shopware article * data to the product. (data of s_articles) */
    private function assignProductData(ListProduct $product, array $data): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.