How to display a popup on the product page at the touch of a button, add to the basket? Magento 2 The 2019 Stack Overflow Developer Survey Results Are InHow to add filtering to custom table field column in Customers admin grid in Magento2?I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't exist__construct() argument error when overriding 2 custom modules from same core moduleSet custom price of product when adding to cart code not workingWhy Getting categories and names on product view page Magento 2 fails?Magento 2: Add a product to the cart programmaticallyMagento 2: After custom cookie is created all pages default to home pageMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?
How to notate time signature switching consistently every measure
Worn-tile Scrabble
Loose spokes after only a few rides
Multiply Two Integer Polynomials
Geography at the pixel level
Return to UK after being refused entry years previously
What is the accessibility of a package's `Private` context variables?
Pokemon Turn Based battle (Python)
Aging parents with no investments
Are there any other methods to apply to solving simultaneous equations?
How to type this arrow in math mode?
Where to refill my bottle in India?
Falsification in Math vs Science
How to answer pointed "are you quitting" questioning when I don't want them to suspect
What is the meaning of the verb "bear" in this context?
What to do when moving next to a bird sanctuary with a loosely-domesticated cat?
Why can Shazam fly?
What do hard-Brexiteers want with respect to the Irish border?
How are circuits which use complex ICs normally simulated?
Does the shape of a die affect the probability of a number being rolled?
Is there a symbol for a right arrow with a square in the middle?
I see my dog run
For what reasons would an animal species NOT cross a *horizontal* land bridge?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
How to display a popup on the product page at the touch of a button, add to the basket? Magento 2
The 2019 Stack Overflow Developer Survey Results Are InHow to add filtering to custom table field column in Customers admin grid in Magento2?I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't exist__construct() argument error when overriding 2 custom modules from same core moduleSet custom price of product when adding to cart code not workingWhy Getting categories and names on product view page Magento 2 fails?Magento 2: Add a product to the cart programmaticallyMagento 2: After custom cookie is created all pages default to home pageMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
There is an event that checks if the goods in the basket when we go to the product page. If there is an attribute in the goods that allows to deliver the goods on the day of the order, if this attribute is included in the product, then it returns "1" if it is disabled, then there is nothing.
Now how to show the popup when you click on "add to cart" on the product page if there is already a product in the basket with the possibility of delivery today, and the second product that we want to add does not have this possibility.
And on the pop-up there should be two buttons, "Continue" or "Cancel". If the user clicks "Continue" then we add the item to the basket, and if the user clicks "Cancel", then we close the popup and there is nothing to add to the basket.
Observer->DayDelivery.php
namespace RonisSameDayDeliveryObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoCatalogModelResourceModelProductCollectionFactory;
class DayDelivery implements ObserverInterface
protected $resultPageFactory;
/**
* @var MagentoCheckoutModelCart
*/
protected $_cart;
protected $_productCollectionFactory;
protected $_resultJsonFactory;
/**
* [__construct description]
* @param MagentoFrameworkAppActionContext $context [description]
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory [description]
* @param MagentoCheckoutModelCart $cart [description]
*/
public function __construct(
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoCheckoutModelCart $cart,
CollectionFactory $productCollectionFactory
)
$this->resultPageFactory = $resultPageFactory;
$this->_cart = $cart;
$this->_resultJsonFactory = $resultJsonFactory;
$this->_productCollectionFactory = $productCollectionFactory;
public function execute(MagentoFrameworkEventObserver $observer)
$writer = new ZendLogWriterStream(BP . '/var/log/samDayDelivery.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$cartProductIds = $this->_cart->getQuoteProductIds();
$productCollection = $this->_productCollectionFactory->create();
if (!$cartProductIds)
return false;
else
$productCollection->addFieldToFilter('entity_id', ['in' => [$cartProductIds]]);
$productCollection->addAttributeToSelect('allow_same_day_delivery');
foreach ($productCollection as $item)
$id = $item->getId();
$check = $item->getData('allow_same_day_delivery');
$logger->info('Delivery sam day id: ' . $id . ' status ' . $check);
// $result = $this->_resultJsonFactory->create()->setData(['Shipment check' => $check]);
// return $result;
magento2 checkout json
add a comment |
There is an event that checks if the goods in the basket when we go to the product page. If there is an attribute in the goods that allows to deliver the goods on the day of the order, if this attribute is included in the product, then it returns "1" if it is disabled, then there is nothing.
Now how to show the popup when you click on "add to cart" on the product page if there is already a product in the basket with the possibility of delivery today, and the second product that we want to add does not have this possibility.
And on the pop-up there should be two buttons, "Continue" or "Cancel". If the user clicks "Continue" then we add the item to the basket, and if the user clicks "Cancel", then we close the popup and there is nothing to add to the basket.
Observer->DayDelivery.php
namespace RonisSameDayDeliveryObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoCatalogModelResourceModelProductCollectionFactory;
class DayDelivery implements ObserverInterface
protected $resultPageFactory;
/**
* @var MagentoCheckoutModelCart
*/
protected $_cart;
protected $_productCollectionFactory;
protected $_resultJsonFactory;
/**
* [__construct description]
* @param MagentoFrameworkAppActionContext $context [description]
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory [description]
* @param MagentoCheckoutModelCart $cart [description]
*/
public function __construct(
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoCheckoutModelCart $cart,
CollectionFactory $productCollectionFactory
)
$this->resultPageFactory = $resultPageFactory;
$this->_cart = $cart;
$this->_resultJsonFactory = $resultJsonFactory;
$this->_productCollectionFactory = $productCollectionFactory;
public function execute(MagentoFrameworkEventObserver $observer)
$writer = new ZendLogWriterStream(BP . '/var/log/samDayDelivery.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$cartProductIds = $this->_cart->getQuoteProductIds();
$productCollection = $this->_productCollectionFactory->create();
if (!$cartProductIds)
return false;
else
$productCollection->addFieldToFilter('entity_id', ['in' => [$cartProductIds]]);
$productCollection->addAttributeToSelect('allow_same_day_delivery');
foreach ($productCollection as $item)
$id = $item->getId();
$check = $item->getData('allow_same_day_delivery');
$logger->info('Delivery sam day id: ' . $id . ' status ' . $check);
// $result = $this->_resultJsonFactory->create()->setData(['Shipment check' => $check]);
// return $result;
magento2 checkout json
add a comment |
There is an event that checks if the goods in the basket when we go to the product page. If there is an attribute in the goods that allows to deliver the goods on the day of the order, if this attribute is included in the product, then it returns "1" if it is disabled, then there is nothing.
Now how to show the popup when you click on "add to cart" on the product page if there is already a product in the basket with the possibility of delivery today, and the second product that we want to add does not have this possibility.
And on the pop-up there should be two buttons, "Continue" or "Cancel". If the user clicks "Continue" then we add the item to the basket, and if the user clicks "Cancel", then we close the popup and there is nothing to add to the basket.
Observer->DayDelivery.php
namespace RonisSameDayDeliveryObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoCatalogModelResourceModelProductCollectionFactory;
class DayDelivery implements ObserverInterface
protected $resultPageFactory;
/**
* @var MagentoCheckoutModelCart
*/
protected $_cart;
protected $_productCollectionFactory;
protected $_resultJsonFactory;
/**
* [__construct description]
* @param MagentoFrameworkAppActionContext $context [description]
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory [description]
* @param MagentoCheckoutModelCart $cart [description]
*/
public function __construct(
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoCheckoutModelCart $cart,
CollectionFactory $productCollectionFactory
)
$this->resultPageFactory = $resultPageFactory;
$this->_cart = $cart;
$this->_resultJsonFactory = $resultJsonFactory;
$this->_productCollectionFactory = $productCollectionFactory;
public function execute(MagentoFrameworkEventObserver $observer)
$writer = new ZendLogWriterStream(BP . '/var/log/samDayDelivery.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$cartProductIds = $this->_cart->getQuoteProductIds();
$productCollection = $this->_productCollectionFactory->create();
if (!$cartProductIds)
return false;
else
$productCollection->addFieldToFilter('entity_id', ['in' => [$cartProductIds]]);
$productCollection->addAttributeToSelect('allow_same_day_delivery');
foreach ($productCollection as $item)
$id = $item->getId();
$check = $item->getData('allow_same_day_delivery');
$logger->info('Delivery sam day id: ' . $id . ' status ' . $check);
// $result = $this->_resultJsonFactory->create()->setData(['Shipment check' => $check]);
// return $result;
magento2 checkout json
There is an event that checks if the goods in the basket when we go to the product page. If there is an attribute in the goods that allows to deliver the goods on the day of the order, if this attribute is included in the product, then it returns "1" if it is disabled, then there is nothing.
Now how to show the popup when you click on "add to cart" on the product page if there is already a product in the basket with the possibility of delivery today, and the second product that we want to add does not have this possibility.
And on the pop-up there should be two buttons, "Continue" or "Cancel". If the user clicks "Continue" then we add the item to the basket, and if the user clicks "Cancel", then we close the popup and there is nothing to add to the basket.
Observer->DayDelivery.php
namespace RonisSameDayDeliveryObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoCatalogModelResourceModelProductCollectionFactory;
class DayDelivery implements ObserverInterface
protected $resultPageFactory;
/**
* @var MagentoCheckoutModelCart
*/
protected $_cart;
protected $_productCollectionFactory;
protected $_resultJsonFactory;
/**
* [__construct description]
* @param MagentoFrameworkAppActionContext $context [description]
* @param MagentoFrameworkViewResultPageFactory $resultPageFactory [description]
* @param MagentoCheckoutModelCart $cart [description]
*/
public function __construct(
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory,
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $resultPageFactory,
MagentoCheckoutModelCart $cart,
CollectionFactory $productCollectionFactory
)
$this->resultPageFactory = $resultPageFactory;
$this->_cart = $cart;
$this->_resultJsonFactory = $resultJsonFactory;
$this->_productCollectionFactory = $productCollectionFactory;
public function execute(MagentoFrameworkEventObserver $observer)
$writer = new ZendLogWriterStream(BP . '/var/log/samDayDelivery.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$cartProductIds = $this->_cart->getQuoteProductIds();
$productCollection = $this->_productCollectionFactory->create();
if (!$cartProductIds)
return false;
else
$productCollection->addFieldToFilter('entity_id', ['in' => [$cartProductIds]]);
$productCollection->addAttributeToSelect('allow_same_day_delivery');
foreach ($productCollection as $item)
$id = $item->getId();
$check = $item->getData('allow_same_day_delivery');
$logger->info('Delivery sam day id: ' . $id . ' status ' . $check);
// $result = $this->_resultJsonFactory->create()->setData(['Shipment check' => $check]);
// return $result;
magento2 checkout json
magento2 checkout json
asked yesterday
Рома ЛытарьРома Лытарь
1789
1789
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269315%2fhow-to-display-a-popup-on-the-product-page-at-the-touch-of-a-button-add-to-the%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269315%2fhow-to-display-a-popup-on-the-product-page-at-the-touch-of-a-button-add-to-the%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown