0

How can I obtaine sales information using the objectmanager and $ _POST.

I attached my code to tell me if it is correct ?

public function tomval(){
        #fucnion que se encarga de hacer la conexion 
        $objectmanager = \Magento\Framework\App\ObjectManager::getInstance();
        $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
        $connection = $resource->getConnection();
        $day = date(Y,m,d);
        $DeliveryType=  $_POST['DeliveryType'];
        $Address=       $_POST['Address'];
        $Province=  $_POST['Province'];
        $City=  $_POST['City'];
        $PostalCode= $_POST['PostalCode'];
        $Email= $_POST['Email'];

        $Phone= $_POST['Phone'];
        $FirstName= $_POST['FirstName'];
        $LastName=  $_POST['LastName'];
        $PaymentMethod= $_POST['PaymentMethod'];
        $Amount=    $_POST['Amount'];
       /* $Order=   $_POST['']
        $nota=      
*/
1

1 Answer 1

0

I am not sure about what your question.

$objectmanager = \Magento\Framework\App\ObjectManager::getInstance();
$request = $objectManager->get(\Magento\Framework\App\RequestInterface::class);
$post = $request->getPostValue();

Here $post is same as Php $_POST

2
  • What I want to do is to obtain data from the base through the manger object but I can't find how to get it in the json file Commented Feb 5, 2020 at 17:46
  • what your requirement you question is not clear.Clear what you requirement.
    – Amit Bera
    Commented Feb 5, 2020 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.