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 #503 from Nosto/release/3.9.0
Browse files Browse the repository at this point in the history
Release/3.9.0 (2)
  • Loading branch information
olsi-qose authored Mar 15, 2019
2 parents e75197e + 4c8f15e commit c30ebea
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
17 changes: 17 additions & 0 deletions app/code/community/Nosto/Tagging/Helper/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,23 @@ public function getFrontPageUrl(Mage_Core_Model_Store $store)
return $url;
}

/**
* Returns the store domain
*
* @param $store
* @return string
*/
public function getActiveDomain($store)
{
$storeFrontUrl = $this->getFrontPageUrl($store);
try {
return Nosto_Helper_UrlHelper::parseDomain($storeFrontUrl);
} catch (\Exception $e) {
Nosto_Tagging_Helper_Log::exception($e);
return '';
}
}

/**
* Adds nostodebug attribute to the given URL
*
Expand Down
3 changes: 2 additions & 1 deletion app/code/community/Nosto/Tagging/Model/Service/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public function confirm(Mage_Sales_Model_Order $mageOrder)
$customerHelper = Mage::helper('nosto_tagging/customer');
$customerId = $customerHelper->getNostoId($mageOrder);
if ($account !== null && $account->isConnectedToNosto()) {
$operation = new Nosto_Operation_OrderConfirm($account);
$urlHelper = Mage::helper('nosto_tagging/url');
$operation = new Nosto_Operation_OrderConfirm($account, $urlHelper->getActiveDomain($store));
$operation->send($order, $customerId);
if ($dataHelper->getUseInventoryLevel($store)
&& $dataHelper->getSendInventoryLevelAfterPurchase($store)
Expand Down
11 changes: 8 additions & 3 deletions app/code/community/Nosto/Tagging/Model/Service/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ protected function update(array $products)
/* @var Mage_Core_Model_App_Emulation $emulation */
$emulation = Mage::getSingleton('core/app_emulation');
$env = $emulation->startEnvironmentEmulation($store->getId());
$urlHelper = Mage::helper('nosto_tagging/url');
$activeDomain = $urlHelper->getActiveDomain($store);
foreach ($productBatches as $productsInStore) {
try {
$operation = new Nosto_Operation_UpsertProduct($account);
$operation = new Nosto_Operation_UpsertProduct($account, $activeDomain);
$operation->setResponseTimeout($this->getApiWaitTimeout());
/* @var $mageProduct Mage_Catalog_Model_Product */
foreach ($productsInStore as $mageProduct) {
Expand Down Expand Up @@ -189,6 +191,8 @@ public function updateOutOfSyncToNosto()
continue;
}
$iterations = 0;
$urlHelper = Mage::helper('nosto_tagging/url');
$activeDomain = $urlHelper->getActiveDomain($store);
$indexedProducts = $this->getOutOfSyncBatch($store);
$totalOutOfSyncCount = $indexedProducts->getSize();
$totalBatchCount = ceil($totalOutOfSyncCount/self::$maxBatchSize);
Expand All @@ -203,7 +207,7 @@ public function updateOutOfSyncToNosto()
);
break;
}
$operation = new Nosto_Operation_UpsertProduct($account);
$operation = new Nosto_Operation_UpsertProduct($account, $activeDomain);
$operation->setResponseTimeout($this->getApiWaitTimeout());
$batchCount = count($indexedProducts);
if ($batchCount === 0) {
Expand Down Expand Up @@ -289,7 +293,8 @@ public function syncIndexedProduct(
&& $nostoProduct instanceof Nosto_Tagging_Model_Meta_Product
&& $nostoHelper->getUseProductApi($store)
) {
$operation = new Nosto_Operation_UpsertProduct($account);
$urlHelper = Mage::helper('nosto_tagging/url');
$operation = new Nosto_Operation_UpsertProduct($account, $urlHelper->getActiveDomain($store));
$operation->setResponseTimeout($this->getApiWaitTimeout());
$operation->addProduct($nostoProduct);
$nostoIndexedProduct->setInSync(1);
Expand Down
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c30ebea

Please sign in to comment.