Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- BEGIN RELEASE NOTES -->
### [Unreleased]

### [4.3.2] - 2025-07-21
### [4.4.0] - 2025-08-11

#### Added
- Add 'kl_parent_ids' extension attribute in product requests.

#### Fixed
- null argument to str_replace() caused by getPrice() fallback return of null instead of "0".
Expand Down Expand Up @@ -322,8 +325,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- END RELEASE NOTES -->
<!-- BEGIN LINKS -->
[Unreleased]: https://github.com/klaviyo/magento2-klaviyo/compare/4.3.2...HEAD
[4.3.2]: https://github.com/klaviyo/magento2-klaviyo/compare/4.3.1...4.3.2
[Unreleased]: https://github.com/klaviyo/magento2-klaviyo/compare/4.4.0...HEAD
[4.4.0]: https://github.com/klaviyo/magento2-klaviyo/compare/4.3.1...4.4.0
[4.3.1]: https://github.com/klaviyo/magento2-klaviyo/compare/4.3.0...4.3.1
[4.3.0]: https://github.com/klaviyo/magento2-klaviyo/compare/4.2.0...4.3.0
[4.2.0]: https://github.com/klaviyo/magento2-klaviyo/compare/4.1.4...4.2.0
Expand Down
48 changes: 48 additions & 0 deletions Plugin/Api/AddProductRelationships.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace Klaviyo\Reclaim\Plugin\Api;

use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Api\Data\ProductSearchResultsInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;

class AddProductRelationships
{
protected $configurableProductType;

public function __construct(
Configurable $configurableProductType
) {
$this->configurableProductType = $configurableProductType;
}

public function afterGet(
ProductRepositoryInterface $subject,
ProductInterface $entity
) {
$extensionAttributes = $entity->getExtensionAttributes();
$parentIds = $this->configurableProductType->getParentIdsByChild($entity->getId());
$extensionAttributes->setData('kl_parent_ids', $parentIds);
$entity->setExtensionAttributes($extensionAttributes);

return $entity;
}

public function afterGetList(
ProductRepositoryInterface $subject,
ProductSearchResultsInterface $searchResults
) {
$products = [];
foreach ($searchResults->getItems() as $entity) {
$extensionAttributes = $entity->getExtensionAttributes();
$parentIds = $this->configurableProductType->getParentIdsByChild($entity->getId());
$extensionAttributes->setData('kl_parent_ids', $parentIds);
$entity->setExtensionAttributes($extensionAttributes);

$products[] = $entity;
}
$searchResults->setItems($products);
return $searchResults;
}
}
2 changes: 1 addition & 1 deletion composer.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "klaviyo/magento2-extension-dev",
"description": "The local development composer file. This is used for local and continuous integration setup/testing.",
"type": "magento2-module",
"version": "4.3.2",
"version": "4.4.0",
"autoload": {
"psr-4": {
"Klaviyo\\Reclaim\\": ""
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "klaviyo/magento2-extension",
"description": "Klaviyo extension for Magento 2. Allows pushing newsletters to Klaviyo's platform and more.",
"type": "magento2-module",
"version": "4.3.2",
"version": "4.4.0",
"autoload": {
"files": [
"registration.php"
Expand Down
3 changes: 3 additions & 0 deletions etc/extension_attributes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
<extension_attributes for="Magento\Quote\Api\Data\CartInterface">
<attribute code="kl_masked_id" type="string" />
</extension_attributes>
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<attribute code="kl_parent_ids" type="int[]" />
</extension_attributes>
</config>
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Klaviyo_Reclaim" setup_version="4.3.2" schema_version="4.3.2">
<module name="Klaviyo_Reclaim" setup_version="4.4.0" schema_version="4.4.0">
<sequence>
<module name="Magento_Customer"/>
<module name="Magento_Checkout"/>
Expand Down
3 changes: 3 additions & 0 deletions etc/webapi_rest/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
<type name="Magento\Quote\Api\CartRepositoryInterface">
<plugin name="checkoutMaskId" type="Klaviyo\Reclaim\Plugin\Api\CartSearchRepository" />
</type>
<type name="Magento\Catalog\Api\ProductRepositoryInterface">
<plugin name="klProductRelationships" type="Klaviyo\Reclaim\Plugin\Api\AddProductRelationships" />
</type>
</config>