magento-2.0

Magento 2 - REST API PUT product

一个人想着一个人 提交于 2020-01-23 06:19:05
问题 When I try to update a product, created via the REST V1 API, only the values are updated for de default website. Unfortunattely I can't find any possibility to send website id's within te json. Does anyone have experienced this before? The data I send for the update to /V1/products/123456: {"product":{"sku":"123456","name":"D4D0123299","price":21,"type_id":"simple","custom_attributes":[],"extension_attributes":{"stock_item":{"use_config_manage_stock":1}}}}" Linking the product to specific

Magento 2 Redirecting to Payment Gateway Error

给你一囗甜甜゛ 提交于 2019-12-31 03:51:10
问题 i have convert my Magento 1 payment module using a converter. I guess i need to modify the codes to suit Magento 2. And I am stuck at the checkout process, redirecting to the Payment gateway. Below is my error when magento is trying to redirect to http://localhost:8083/mm/pdcptb/pdcptb/redirect/ There has been an error processing your request Exception printing is disabled by default for security reasons. Error log record number: 979987430 The console in the firebug shows: "NetworkError: 503

Add/remove image programmatically to product Magento2

僤鯓⒐⒋嵵緔 提交于 2019-12-21 02:47:08
问题 I am facing problem to add/remove image to product programmatically. 回答1: Use following code to add/remove image from product in Magento2. // Instance of object manager $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); *Remove Images From Product*/ $productId = ; // Id of product $product = $objectManager->create('Magento\Catalog\Model\Product')->load($productId); $productRepository = $objectManager->create('Magento\Catalog\Api\ProductRepositoryInterface');

Changes to CSS and JavaScript applies only after deploying static content

时光怂恿深爱的人放手 提交于 2019-12-13 18:38:54
问题 I installed Magento 2 from the Magento site. I have activated the developer mode by {project directory}>php bin/magento setup:mode:set developer Then I have installed my custom theme and finally I deployed my static content by {project directory}>php bin/magento setup:static-content:deploy My problem is I have to delete pub/static directory and deploy static content every time to apply the css and javacript changes. The static content deploy process is slow and taking so much time that it is

Css not working after installation in Magento 2

偶尔善良 提交于 2019-12-12 18:35:04
问题 I have Installed Magento 2. Everything completed successfully but css is not loading. I tried these commands php bin/magento cache:flush php bin/magento indexer:reindex php bin/magento setup:static-content:deploy Please help me 回答1: You should Provide Some permissions run this command sudo find . -type d -exec chmod -R 777 {} \; && sudo find . -type f -exec chmod -R 777 {} \; && sudo chmod u+x bin/magento 回答2: Please, before doing anything go to magento2 basedir and do: nano vendor/magento

Magento Open Source 2.3 - CSS and JS not loading

狂风中的少年 提交于 2019-12-12 17:11:17
问题 I installed Magento 2.3 successfully but when type http://localhost/Magento2/, I get a blank page like this: and these are the errors found in the console: The same issue is also faced on the admin panel. My current version of PHP is 7.2.14. 回答1: You cannot use http://localhost/ as domain name with Magento 2, you should at least use http://localhost.com/ . Change your vHost in Docker/XAMP/MAMP/WAMP... to match your new domain name, for instance http://localhost.com/ ; Edit your hosts file

Magento 2.0.2 installation on shared server - Stuck at 66%

久未见 提交于 2019-12-12 03:54:38
问题 I've been having a nightmare with Magento 2 installation on shared server. The thing is that I don't have problems with shared server. I can get as much resources and config as Magento needs. But it gets stuck on 66% and this is Console log: Module 'Magento_Directory': Installing data.. [ERROR] exception 'Exception' with message 'Warning: Error while sending QUERY packet. PID=47710 in /home/gottstor/public_html/store/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228'

Magento 2 static cache

被刻印的时光 ゝ 提交于 2019-12-12 02:37:05
问题 When I would change something in template, I need flush static cache(pub/static) because I didn't saw any changes in front end, but after that this folders has some empty folder and in front end I have some error ReferenceError: require is not defined and I need use this command c:\xampp\php\php.exe -f d:\projects\localsites\magento2.local\magento\bin\magento -- setup:static-content:deploy to generate static content. Maybe I do something wrong? 回答1: When you developing something for magento2

How to get product information from product id in magento2 or magento2.0?

≡放荡痞女 提交于 2019-12-11 10:08:57
问题 How to get all product details by product id in magento2? I want to display a single product detail with the image on the homepage. Any help would be appreciated. 回答1: For this purpose, it's better to use Service Layer in Magento 2. protected $_productRepository; public function __construct( ... ... \Magento\Catalog\Model\ProductRepository $productRepository, ... ) { $this->_productRepository = $productRepository; ... ... } public function getProductById($id) { return $this->

How to add Custom file upload function in magento 2

拈花ヽ惹草 提交于 2019-12-11 02:07:10
问题 Am created file upload functionality through custom module in Magento 2 category tab.i don't know how to save the file in database.please can any one tell me how to do that? 回答1: add use Magento\Framework\UrlInterface; add use Magento\Framework\Filesystem; ... $imageName = $this->uploadFileAndGetName('input_name', $this->fileSystem->getDirectoryWrite(DirectoryList::MEDIA)->getAbsolutePath($subdir_of_your_choice.'/image')); $your_model->setImage($imageName); 回答2: You don't save the file in DB,