Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function execute()
- {
- if (!$this->session->isLoggedIn())
- {
- $resultRedirect = $this->resultRedirectFactory->create();
- $resultRedirect->setPath('customer/account/login');
- return $resultRedirect;
- }
- else
- {
- $resultPage = $this->resultPageFactory->create();
- $resultPage->getConfig()->getTitle()->set(__('My Wallet'));
- return $resultPage;
- $vat_exempt_name = $this->getRequest()->getPost('vat_exempt_name');
- //.............To Create Product...........//
- $objectManager = MagentoFrameworkAppObjectManager::getInstance(); // instance of object manager
- $product = $objectManager->create('MagentoCatalogModelProduct');
- $product->setSku('my-sku28'); // Set your sku here
- $product->setName('Sample Simple Product28'); // Name of Product
- $product->setAttributeSetId(4); // Attribute set id
- $product->setStatus(1); // Status on product enabled/ disabled 1/0
- $product->setWebsiteIds(array(1));
- $product->setWeight(10); // weight of product
- $product->setVisibility(4); // visibilty of product (catalog / search / catalog, search / Not visible individually)
- $product->setTaxClassId(0); // Tax class id
- $product->setTypeId('simple'); // type of product (simple/virtual/downloadable/configurable)
- $product->setPrice($vat_exempt_name); // price of product
- $product->setStockData(
- array(
- 'use_config_manage_stock' => 0,
- 'manage_stock' => 1,
- 'is_in_stock' => 1,
- 'qty' => 99999
- )
- );
- $product = $product->save();
- }
- }
- <table>
- <tr>
- <th>Enter Amount to be Added in wallet (USD)</th>
- </tr>
- <tr>
- <td><input type="text" class="input-text watch-keyup" id="vat_exempt_name" name="vat_exempt_name" value="200"></td>
- </tr>
- <tr>
- <td><button type="button">Add Money to Wallet</button></td>
- </tr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement