Skip to content

Commit

Permalink
Return back child products into feed. Fix issue with feed urls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bashev committed Apr 9, 2023
1 parent 04fc5c6 commit c036c7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 1 addition & 3 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,7 @@ public function getFeedUrl(): ?string
{
if ($store = $this->getCurrentStore()) {
/* @phpstan-ignore-next-line */
$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_MEDIA);
$baseUrl = str_replace(UrlInterface::URL_TYPE_MEDIA . '/', '', $baseUrl);

$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB);
return $baseUrl . self::FEED_DIR . $this->getFeedFilename();
}

Expand Down
13 changes: 6 additions & 7 deletions Service/GenerateFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ protected function generateFeed(): void

if ($attributeValue = $this->getAttributeValue($product, 'size')) {
$item->addChild('SIZE', $attributeValue);
}

if ($attributeValue = $this->getAttributeValue($product, 'size_system')) {
$item->addChild('SIZE_SYSTEM', $attributeValue);
} else {
$item->addChild('SIZE_SYSTEM', 'INT');
if ($attributeValue = $this->getAttributeValue($product, 'size_system')) {
$item->addChild('SIZE_SYSTEM', $attributeValue);
} else {
$item->addChild('SIZE_SYSTEM', 'INT');
}
}

if ($attributeValue = $this->getAttributeValue($product, 'ean')) {
Expand Down Expand Up @@ -355,7 +355,6 @@ public function getProductsCollection(): \Magento\Catalog\Model\ResourceModel\Pr
$collection = $this->productCollection->create();
$collection->addAttributeToSelect('*')->setStore($this->store);
$collection->addAttributeToFilter('status', ['in' => $this->productStatus->getVisibleStatusIds()]);
$collection->addAttributeToFilter('visibility', ['in' => $this->productVisibility->getVisibleInSiteIds()]);
$collection->addAttributeToFilter('is_saleable', ['eq' => 1]);

return $collection;
Expand Down Expand Up @@ -404,7 +403,7 @@ private function getParentProductId(int $childProductId): int
*/
private function getProduct(bool $parent = true): ProductInterface
{
if ($parent && $parentProductId = $this->getParentProductId($this->product->getId())) {
if ($parent && $parentProductId = $this->getParentProductId((int) $this->product->getId())) {
try {
$parentProduct = $this->productRepository->getById($parentProductId, false, $this->store->getId());
if (in_array($parentProduct->getStatus(), $this->productStatus->getVisibleStatusIds())
Expand Down

0 comments on commit c036c7f

Please sign in to comment.