I'm trying to send a variable from a phtml to an observer through an event observer. Is that possible?
Note: variables are defined by a script in the phtml.
Edit:
The name of event is "checkout_cart_product_add_after".
In the script I have some like this:
function cambio_telas(event){
telaactual = event.data.tela;
}
And I want to send the var "telaactual" to the observer:
public function execute(\Magento\Framework\Event\Observer $observer) {
$item = $observer->getEvent()->getData('quote_item');
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$additionalOptions = array(
array(
'label' => 'Tela',
'value' => 'tela02'
)
}
In short, I need to apply the variable "currentdata" to value in "$ aditionalOptions"
scriptto get clear idea. – Abhishek Panchal Aug 25 '17 at 21:21