Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #526 from Nosto/release/3.11.1
Browse files Browse the repository at this point in the history
Release/3.11.0
  • Loading branch information
olsi-qose authored Jun 11, 2019
2 parents adb2daf + 7b3173d commit 9adef5a
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 155 deletions.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Report errors and problems
title: ''
labels: bug
assignees: ''

---

**Magento version(s) used**: x.y.z
**Extension version(s) affected**: x.y.z

**Description**
<!-- A clear and concise description of the problem. -->

**How to reproduce**
<!-- Code, config and/or steps needed to reproduce the problem. -->

**Possible Solution**
<!--- Optional: only if you have suggestions on a fix/reason for the bug -->

**Additional context**
<!-- Optional: any other context about the problem: log messages, screenshots, etc. -->
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Documentation Issue
about: Missing, misleading or incomplete documentation issues
title: ''
labels: docs
assignees: ''

---

**Documentation issue**
<!-- Before opening a new issue, please make sure you already checked -->
<!-- our exhaustive wiki documentation at https://github.com/nosto/nosto-magento/wiki -->
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Ideas for new features and improvements
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

### 3.11.0
* Use mock products in category personalisation when preview mode is enabled
* Ignore non-numeric product ids in Graphql responses
* Add inventory level to SKU

### 3.10.0
* Add Nosto category personalization in the default Magento category sorting options

Expand Down
30 changes: 30 additions & 0 deletions app/code/community/Nosto/Tagging/Model/Meta/Sku.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public function loadData(
Mage_Core_Model_Store $store = null
)
{
/** @var Nosto_Tagging_Helper_Data $dataHelper */
$dataHelper = Mage::helper('nosto_tagging');

if ($store === null) {
/** @var Nosto_Tagging_Helper_Data $helper */
$helper = Mage::helper('nosto_tagging');
Expand Down Expand Up @@ -83,6 +86,10 @@ public function loadData(
$this->loadCustomFieldsFromConfigurableAttributes($sku, $parent, $store);
$this->loadCustomFieldsFromAttributeSet($sku, $store);

if ($dataHelper->getUseInventoryLevel($store)) {
$this->amendInventoryLevel($sku);
}

return true;
}

Expand Down Expand Up @@ -173,4 +180,27 @@ protected function buildAvailability(Mage_Catalog_Model_Product $product)

return $availability;
}

/**
* Adds the stock level / inventory level for SKU
*
* @param Mage_Catalog_Model_Product $sku the product sku model.
*
*/
protected function amendInventoryLevel(Mage_Catalog_Model_Product $sku)
{
/* @var Nosto_Tagging_Helper_Stock $stockHelper */
$stockHelper = Mage::helper('nosto_tagging/stock');
try {
$this->setInventoryLevel($stockHelper->getQty($sku));
} catch (\Exception $e) {
Nosto_Tagging_Helper_Log::error(
'Failed to resolve inventory level for SKU %d to tags. Error message was: %s',
array(
$sku->getId(),
$e->getMessage()
)
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
class Nosto_Tagging_Model_Service_Recommendation_Category
extends Nosto_Tagging_Model_Service_Recommendation_Base
{
const NOSTO_PREVIEW_COOKIE = 'nostopreview';

/**
* Returns an array of product ids sorted by relevance
*
Expand All @@ -57,32 +59,35 @@ public function getSortedProductIds(
if (!$featureAccess->canUseGraphql()) {
return $productIds;
}
switch ($type){
case Nosto_Tagging_Model_Category_Config::NOSTO_PERSONALIZED_KEY:
$recoOperation = new Nosto_Operation_Recommendation_CategoryBrowsingHistory(
$nostoAccount,
$nostoCustomerId
);
break;
default:
$recoOperation = new Nosto_Operation_Recommendation_CategoryTopList(
$nostoAccount,
$nostoCustomerId
);
break;
if ($type === Nosto_Tagging_Model_Category_Config::NOSTO_PERSONALIZED_KEY) {
$recoOperation = new Nosto_Operation_Recommendation_CategoryBrowsingHistory(
$nostoAccount,
$nostoCustomerId
);
} else {
$recoOperation = new Nosto_Operation_Recommendation_CategoryTopList(
$nostoAccount,
$nostoCustomerId
);
}
$recoOperation->setCategory($category);

$previewModeCookie = Mage::getModel('core/cookie')
->get(self::NOSTO_PREVIEW_COOKIE);
if ($previewModeCookie !== null && $previewModeCookie === "true") {
$recoOperation->setPreviewMode(true);
}

try {
$result = $recoOperation->execute();
foreach ($result as $item) {
if ($item->getProductId()) {
if ($item->getProductId() && is_numeric($item->getProductId())) {
$productIds[] = $item->getProductId();
}
}
} catch (\Exception $e) {
Nosto_Tagging_Helper_Log::exception($e);
}

return $productIds;
}
}
}
2 changes: 1 addition & 1 deletion app/code/community/Nosto/Tagging/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<config>
<modules>
<Nosto_Tagging>
<version>3.10.0</version>
<version>3.11.0</version>
</Nosto_Tagging>
</modules>
<global>
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"require": {
"php": ">=5.4.0",
"nosto/php-sdk": "3.13.0"
"nosto/php-sdk": "3.15.0"
},
"require-dev": {
"php": ">=7.1.0",
Expand All @@ -37,7 +37,8 @@
"magento/marketplace-eqp": "1.*",
"openmage/magento-mirror": "1.9",
"wimg/php-compatibility": "^8.0",
"mridang/pearify": "0.3"
"mridang/pearify": "0.3",
"vlucas/phpdotenv": ">=2.4.0 <3.0"
},
"scripts": {
"post-install-cmd": "if ! type \"composer\" > /dev/null; then echo \"composer not available in path - you must update the lib files manually\"; else composer dump-autoload --optimize; ./vendor/bin/pearify process .;fi",
Expand Down
Loading

0 comments on commit 9adef5a

Please sign in to comment.