diff --git a/app/code/community/Justuno/M1/Catalog.php b/app/code/community/Justuno/M1/Catalog.php index 1513a9c..97c5d28 100644 --- a/app/code/community/Justuno/M1/Catalog.php +++ b/app/code/community/Justuno/M1/Catalog.php @@ -71,25 +71,21 @@ static function p() {R::p(function(S $s) { # «The parent ID is pulling the sku, it should be pulling the ID like the variant does»: # https://github.com/justuno-com/m1/issues/19 ,'ID' => $p->getId() - /** - * 2019-10-30 - * 1) «MSRP, Price, SalePrice, Variants.MSRP, and Variants.SalePrice all need to be Floats, - * or if that is not possible then Ints»: https://github.com/justuno-com/m1/issues/10 - * 2) «If their isn't an MSRP for some reason just use the salesprice»: - * https://github.com/justuno-com/m1/issues/6 - * 2019-10-31 - * «The MSRP should pull in this order MSRP > Price > Dynamic Price»: - * https://github.com/justuno-com/m1/issues/20 - */ - ,'MSRP' => (float)($p['msrp'] ?: ($p['price'] ?: $p->getPrice())) - /** - * 2019-10-30 - * «MSRP, Price, SalePrice, Variants.MSRP, and Variants.SalePrice all need to be Floats, - * or if that is not possible then Ints»: https://github.com/justuno-com/m1/issues/10 - * 2019-10-31 - * «Price should be Price > Dynamic Price»: https://github.com/justuno-com/m1/issues/21 - */ - ,'Price' => (float)($p['price'] ?: $p->getPrice()) + # 2019-10-30 + # 1) «MSRP, Price, SalePrice, Variants.MSRP, and Variants.SalePrice all need to be Floats, + # or if that is not possible then Ints»: https://github.com/justuno-com/m1/issues/10 + # 2) «If their isn't an MSRP for some reason just use the salesprice»: + # https://github.com/justuno-com/m1/issues/6 + # 2019-10-31 + # «The MSRP should pull in this order MSRP > Price > Dynamic Price»: https://github.com/justuno-com/m1/issues/20 + # 2021-03-24 "Replace `getPrice` with `getFinalPrice`": https://github.com/justuno-com/m1/issues/54 + ,'MSRP' => (float)($p['msrp'] ?: ($p['price'] ?: $p->getFinalPrice())) + # 2019-10-30 + # «MSRP, Price, SalePrice, Variants.MSRP, and Variants.SalePrice all need to be Floats, + # or if that is not possible then Ints»: https://github.com/justuno-com/m1/issues/10 + # 2019-10-31 «Price should be Price > Dynamic Price»: https://github.com/justuno-com/m1/issues/21 + # 2021-03-24 "Replace `getPrice` with `getFinalPrice`": https://github.com/justuno-com/m1/issues/54 + ,'Price' => (float)($p['price'] ?: $p->getFinalPrice()) # 2019-10-30 «ReviewsCount and ReviewSums need to be Ints»: https://github.com/justuno-com/m1/issues/11 ,'ReviewsCount' => (int)$rs->getReviewsCount() # 2019-10-30 @@ -100,7 +96,8 @@ static function p() {R::p(function(S $s) { # 2019-10-30 # «MSRP, Price, SalePrice, Variants.MSRP, and Variants.SalePrice all need to be Floats, # or if that is not possible then Ints»: https://github.com/justuno-com/m1/issues/10 - ,'SalePrice' => (float)$p->getPrice() + # 2021-03-24 "Replace `getPrice` with `getFinalPrice`": https://github.com/justuno-com/m1/issues/54 + ,'SalePrice' => (float)$p->getFinalPrice() ,'Tags' => self::tags($p) ,'Title' => $p['name'] ,'UpdatedAt' => $p['updated_at'] diff --git a/app/code/community/Justuno/M1/Catalog/Variants.php b/app/code/community/Justuno/M1/Catalog/Variants.php index 44da0e1..0304a36 100644 --- a/app/code/community/Justuno/M1/Catalog/Variants.php +++ b/app/code/community/Justuno/M1/Catalog/Variants.php @@ -61,24 +61,23 @@ private static function variant(P $p, P $parent = null, $opts = []) { * https://github.com/justuno-com/m1/issues/35 */ ,'InventoryQuantity' => $p->isDisabled() || ($parent && $parent->isDisabled()) ? -9999 : (int)$si->getQty() - /** - * 2019-10-30 - * 1) «MSRP, Price, SalePrice, Variants.MSRP, and Variants.SalePrice all need to be Floats, - * or if that is not possible then Ints»: https://github.com/justuno-com/m1/issues/10 - * 2) «MSRP was null for some variants but the MSRP wasn't null for the parent»: - * https://github.com/justuno-com/m1/issues/7 - * 3) «If their isn't an MSRP for some reason just use the salesprice»: - * https://github.com/justuno-com/m1/issues/6 - * 2019-10-31 - * «For variant pricing, - * i would want the flow to be the same as the MSRP and SalePrice from the parent above - * but using the variant's pricing of course»: https://github.com/justuno-com/m1/issues/25 - */ - ,'MSRP' => (float)($p['msrp'] ?: ($p['price'] ?: $p->getPrice())) + # 2019-10-30 + # 1) «MSRP, Price, SalePrice, Variants.MSRP, and Variants.SalePrice all need to be Floats, + # or if that is not possible then Ints»: https://github.com/justuno-com/m1/issues/10 + # 2) «MSRP was null for some variants but the MSRP wasn't null for the parent»: + # https://github.com/justuno-com/m1/issues/7 + # 3) «If their isn't an MSRP for some reason just use the salesprice»: https://github.com/justuno-com/m1/issues/6 + # 2019-10-31 + # «For variant pricing, + # i would want the flow to be the same as the MSRP and SalePrice from the parent above + # but using the variant's pricing of course»: https://github.com/justuno-com/m1/issues/25 + # 2021-03-24 "Replace `getPrice` with `getFinalPrice`": https://github.com/justuno-com/m1/issues/54 + ,'MSRP' => (float)($p['msrp'] ?: ($p['price'] ?: $p->getFinalPrice())) # 2019-10-30 # «MSRP, Price, SalePrice, Variants.MSRP, and Variants.SalePrice all need to be Floats, # or if that is not possible then Ints»: https://github.com/justuno-com/m1/issues/10 - ,'SalePrice' => (float)$p->getPrice() + # 2021-03-24 "Replace `getPrice` with `getFinalPrice`": https://github.com/justuno-com/m1/issues/54 + ,'SalePrice' => (float)$p->getFinalPrice() ,'SKU' => $p->getSku() ,'Title' => $p->getName() ]; diff --git a/app/code/community/Justuno/M1/Filter.php b/app/code/community/Justuno/M1/Filter.php index f5b4afb..d0c0d19 100644 --- a/app/code/community/Justuno/M1/Filter.php +++ b/app/code/community/Justuno/M1/Filter.php @@ -1,4 +1,5 @@ format('U')); }; $c->addFieldToFilter('updated_at', ['from' => $d($since), 'to' => $d('2035-01-01 23:59:59')]); diff --git a/app/code/community/Justuno/M1/etc/config.xml b/app/code/community/Justuno/M1/etc/config.xml index e1369f7..f4da107 100644 --- a/app/code/community/Justuno/M1/etc/config.xml +++ b/app/code/community/Justuno/M1/etc/config.xml @@ -4,7 +4,7 @@ Dmitry Fedyuk https://www.upwork.com/fl/mage2pro - 1.6.6 + 1.6.8