-
Notifications
You must be signed in to change notification settings - Fork 39
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
[PLUGIN1CC-4024] Magic buy now logic update based on config #514
base: magic_integration_latest
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 I have noticed a few significant issues to address.
$buyNowCartPushAction = $this->config->getBuyNowAction(); | ||
if ($buyNowCartPushAction === '1') { | ||
$quote = $quoteBuilder->createOrUpdateQuote(); | ||
} else { | ||
$quote = $quoteBuilder->createQuote(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to:
$buyNowCartPushAction = $this->config->getBuyNowAction(); | |
if ($buyNowCartPushAction === '1') { | |
$quote = $quoteBuilder->createOrUpdateQuote(); | |
} else { | |
$quote = $quoteBuilder->createQuote(); | |
} | |
$quote = $this->config->getBuyNowAction() | |
? $quoteBuilder->createOrUpdateQuote() | |
: $quoteBuilder->createQuote(); |
@@ -231,10 +236,10 @@ public function execute() | |||
$productImageUrl = $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . 'catalog/product' . $product->getImage(); | |||
} | |||
|
|||
$imagewidth=200; | |||
$imageheight=200; | |||
$imagewidth = 200; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a part of your change, but long-term if we really need to use Magento\Catalog\Helper\Image
, I'd rather use Magento\Catalog\Helper\ImageFactory
than ObjectManager.
ItemBuilderFactory $itemBuilderFactory | ||
) { | ||
Session $session, | ||
CheckoutSession $checkoutSession, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every single time you introduce Session
or CheckoutSession
(or Backend Session) to the class, make sure that in corresponding di.xml
there's a \Proxy
passed through the argument, to make sure that session is not tried to be initialized in CLI or Cron context.
In order to address this requirement, open di.xml
and add:
<type name="Razorpay\Magento\Model\QuoteBuilder">
<arguments>
<argument name="session" xsi:type="object">Magento\Customer\Model\Session\Proxy</argument>
<argument name="checkoutSession" xsi:type="object">Magento\Checkout\Model\Session\Proxy</argument>
</arguments>
</type>
https://developer.adobe.com/commerce/php/development/components/proxies/
|
||
return $quote; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We work in *nix context, make sure to keep empty line at the end of file.
@@ -124,7 +124,19 @@ | |||
</depends> | |||
</field> | |||
|
|||
<field id="activate_magic_mini_cart" translate="label" type="select" sortOrder="27" showInDefault="0" showInWebsite="0" showInStore="0"> | |||
<field id="magic_buy_now_cart_push" translate="label" type="select" sortOrder="27" showInDefault="1" showInWebsite="1" showInStore="1"> | |||
<label>Update Product to Existing Cart on Buy Now </label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<label>Update Product to Existing Cart on Buy Now </label> | |
<label>Update Product to Existing Cart on Buy Now</label> |
</field> | ||
|
||
|
||
<field id="activate_magic_mini_cart" translate="label" type="select" sortOrder="28" showInDefault="0" showInWebsite="0" showInStore="0"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When one of these values is 0
then the attribute is redundant.
<field id="activate_magic_mini_cart" translate="label" type="select" sortOrder="28" showInDefault="0" showInWebsite="0" showInStore="0"> | |
<field id="activate_magic_mini_cart" translate="label" type="select" sortOrder="28"> |
Note :- Please follow the below points while attaching test cases document link below:
- If label
Tested
is added then test cases document URL is mandatory.- Link added should be a valid URL and accessible throughout the org.
- If the branch name contains hotfix / revert by default the BVT workflow check will pass.