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 In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraHow 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?
Variable with quotation marks "$()"
What can I do if neighbor is blocking my solar panels intentionally?
What is the padding with red substance inside of steak packaging?
How do spell lists change if the party levels up without taking a long rest?
Using dividends to reduce short term capital gains?
Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?
Sort list of array linked objects by keys and values
How to determine omitted units in a publication
What other Star Trek series did the main TNG cast show up in?
Does Parliament hold absolute power in the UK?
The following signatures were invalid: EXPKEYSIG 1397BC53640DB551
Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time?
Was credit for the black hole image misappropriated?
Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?
Make it rain characters
US Healthcare consultation for visitors
Why not take a picture of a closer black hole?
how can a perfect fourth interval be considered either consonant or dissonant?
60's-70's movie: home appliances revolting against the owners
Can a flute soloist sit?
ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
What aspect of planet Earth must be changed to prevent the industrial revolution?
"... to apply for a visa" or "... and applied for a visa"?
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 In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraHow 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 Apr 9 at 7:47
Рома ЛытарьРома Лытарь
1809
1809
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