Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Upsells and Cross-sells to items() #7222 #9

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ public function search($filters = null, $store = null)
}

/**
* Retrieve list of products with basic info (id, sku, type, set, name)
* Retrieve list of products with the following info -:
* id: Magento Product Id
* sku: Product Sku
* type: Product Type (simple, downloadable, virtual, etc)
* set: Product Set
* name: Product Name
* up_sells: Array of up_sell Ids
* cross_sells: Array of cross_sell Ids
*
* @param array $filters
* @param string|int $store
Expand Down Expand Up @@ -88,9 +95,21 @@ public function items($filters = null, $store = null)
'name' => $product->getName(),
'set' => $product->getAttributeSetId(),
'type' => $product->getTypeId(),
'category_ids' => $product->getCategoryIds()
);
}
'category_ids' => $product->getCategoryIds(),
'up_sells' => array(),
'cross_sells' => array(),
);

// Get UpSells
foreach ($product->getUpSellProductCollection() as $up_sell) {
array_push($result['up_sells'], $up_sell->getId())
}

// Get CrossSells
foreach ($product->getCrossSellProducts() as $cross_sell) {
array_push($result['cross_sells'], $cross_sell->getId())
}
}

return $result;
}
Expand Down Expand Up @@ -322,4 +341,4 @@ public function delete($productId)

return true;
}
} // Class Mage_Catalog_Model_Product_Api End
} // Class Mage_Catalog_Model_Product_Api End