New answers tagged

0

You need to define $installer https://github.com/DominicWatts/AutoShipment/blob/master/Setup/InstallData.php#L35-L36 See how I use $salesSetup to add column to sales_order tables use Magento\Sales\Setup\SalesSetupFactory; /** * InstallData class */ class InstallData implements InstallDataInterface { private $salesSetupFactory; /** * ...


0

Please check gd.ini file in mods-available dir /etc/php/7.1/mods-available If gd.ini not available then run below command apt-get install php7.1-gd will install GD for PHP 7.1


0

You can try editing your env file inside: app → etc And set MAGE_MODE to production


0

The below is the core code in Magento that validates the coupon submission in the cart. As you can see, you might want to check the quote coupon code is the same as what you did submit and that is what will tell you whether the code is valid and successfully applied. $codeLength = strlen($couponCode); $isCodeLengthValid = $codeLength && $codeLength ...


0

A simple mistake, seeing as there was no example code I could follow and I was just going off what I read in the class file, I failed to realize that you needed to run ->save() after closing the RMA. The final line looks like this: $rma->close()->save();


1

$address->getCustomerAddressId() can return null and $addressObject left null. You can try this: $addressObject = null; $customerSession = $objectManager->get('Magento\Customer\Model\Session'); $customerRepository = $objectManager->create('\Magento\Customer\Api\CustomerRepositoryInterface'); $customer = $customerRepository->getById(...


0

for centos 7 (linux) yum install php-xml for ubuntu apt-get install php-xml use sudo if you are not a root user for privileges


0

Issue has been resolved by changing the PHP settings. max_input_vars = 100000 max_input_nesting_level = 800 max_input_time = 18000 Reference :Php max_input_vars prevents attribute options saving in M2 Then run command if Linux (Debian/Ubuntu): sudo service apache2 restart sudo /etc/init.d/apache2 restart


0

You can do it as part of install script /** * Add blank attibute set */ $attibuteSet = new Mage_Eav_Model_Entity_Setup('core_setup'); /* @var $attibuteSet Mage_Eav_Model_Entity_Setup */ $attibuteSet->startSetup(); $attibuteSet->addAttributeSet( Mage_Catalog_Model_Product::ENTITY, 'Custom' ); $attibuteSet->endSetup(); /** * Add ...


0

You cannot define the attribute set when creating the attribute with this method. Change group to undefined and set user_defined as true to create an attribute without setting an attribute set. After creating it, add the attribute to an attribute set in the upgrade or setup script.


0

Wrap your js file with below code: require(['jquery'],function(){ //js file code })(jQuery); }); Make sure the braces are correctly coded.


0

Please check with below possibilities : 1 check with php info max_input_vars are updated or not. may be if you are using multiple php versions, so you assign value to another php.ini also please verify below values : 2 check with your database table core_config_data find path=web/cookie/cookie_domain, if you find row than remove it. I hope its work for ...


1

Finally i fixed the issue.I changed the following code in Codilar/Gst/view/adminhtml/layout/sales_order_invoice_new.xml. I changed as to name inside the reference block. <referenceBlock as="default"> <action method="setTemplate" ifconfig="gst/codilar/status"> <argument name="template" xsi:type="string">Codilar_Gst::order/...


1

Thank you for answering my questions in comments section. You've got a few options. More resource on stack. More CPU. But even the you are going to struggle to get close to numbers you are talking about. Using nginx or maybe varnish will offer more improvements. Redis will help on high traffic stores. So if you've got a lot of traffic on top of large ...


2

You pretty much came to the correct conclusion. If you've got different values you need separate rules. However if you've got same amounts you can generate codes which share rules. The way I explain it is having rules for 10 off and 20 off. Each customer you want to give 10 off you generate a 10 off code. 20 a 20 off code.


2

This is related to Advanced Reporting. You can find this error under Magento_Analytics module. There is a cron which checking the connection vendor/magento/module-analytics/Model/Connector/SignUpCommand.php public function execute() { $result = false; $integrationToken = $this->integrationManager->generateToken(); if ($integrationToken)...


0

Sorry I'm making a mistake by switching parameters, $eavSetup->addAttribute('customer_address', 'customer_tax_exempt_number', [] Here is the right code: <?php namespace CustomerAddress\Attribute\Setup; use Magento\Eav\Model\Config; use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\...


0

You have to include your dependencies in your ModuleName/etc/module.xml file. <sequence> <module name="Magento_Customer" /> </sequence>


0

It seems that you have problems with Products and Categories URLs. Every product need an URL to be displayed in Frontend. Your product was imported without URL. When you re-save that product, Magento will auto generate a new URL and it will be showed. Conclusion: you have to add/update records into url_rewrite table in order to make your products presented ...


0

You need to think more like class, name space and functions so what you like have to go inside a function, in one of your modules: also try to learn about ordercollectionfactory. here is an example <?php namespace 'moduleNameSpace'; class ModelClass extends \Magento\Framework\View\Element\Template { protected $_orderCollectionFactory; public ...


1

CLI version of PHP is different. Ran into this on Inmotion hosting. First run in CLI whereis php which will show all the PHP locations installed Then in root folder of your server there is a file called .bashrc Edit it to contain line like alias php=/opt/imh/imh-php72/root/usr/bin/php with location of php version you want to use in CLI Reconnect to ...


0

I guess, that you want to generate a product link, using the bit.ly API, that can easily be shared using WhatsApp? use the bit.ly-API to generate a link to your product page: https://dev.bitly.com/ then include a link on your product page pointing to this url: https://wa.me/whatsappphonenumber/?text=YOUR_URL_ENCODED_TEXT And you should be done.


-1

Have you tried adding the important keyword? .my-container { width: 100% !important; max-width: 100% !important; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; min-height: 100vh; background: #666; }


0

Please try with below link for share products in whatsapp ( for bitly link - can you share url format ? ) . https://web.whatsapp.com/send?text=www.google.com I hope its work for you.


1

Inside this class vendor/magento/module-offline-shipping/Model/Carrier/Tablerate.php there is a method for price calculation with the name **collectRates**. In this method, Magento will calculate the price based on the conditions that you provided. Override the function and change the calculation according to you.


0

Need to change as per below code config.xml <events> <sales_order_place_after> <observers> <Tbb_StockRegistrar_Model_Observer> <type>model</type> <class>Tbb_StockRegistrar_Model_Observer</class> ...


2

You need to dynamically bring in the form key before or during form submission. You can fetch it using javascript. var $formKey = jQuery.cookie('form_key'); Updated https://github.com/DominicWatts/BackInStock/blob/master/view/frontend/templates/product/view/addtocart.phtml#L78-L82 In this example I have an onclick event that does a form submission and ...


2

Use below commands for changing PHP versions From PHP 7.1 => PHP 7.2 sudo a2dismod php7.1 sudo a2enmod php7.2 sudo service apache2 restart sudo update-alternatives --set php /usr/bin/php7.2 check which PHP version you're using with this command php -v


1

Try following code: $pageSubContain = Mage::getModel('cms/page')->load($pageId); $pageMainContain = $pageSubContain->getContent(); /* @var $helper Mage_Cms_Helper_Data */ $helper = Mage::helper('cms'); $processor = $helper->getPageTemplateProcessor(); $html = $processor->filter($pageMainContain); $response = array( "status" => "1", ...


0

for M2 add memory limit via ssh with below command. for compile command : php -dmemory_limit=5G bin/magento setup:di:compile for deploy command : php -dmemory_limit=5G bin/magento setup:static-content:deploy you can increase value 5G if issue not solved.


1

I was using the M2epro module version 6.4.14 in Magento 1. I was asked to upgrade to a special version of the extension 6.5.0.9 which supports M2epro migration from Magento 1 to 2. You can upgrade to version 6.5.0.9 only form the version 6.4.14, so if you are using any other version, first of all, please upgrade to 6.4.14 and then to 6.5.0.9 https://...


2

No you cannot pass any data from JS to phtml directly. PHTML is executed at server side while JS is executed at client side. If you wanna pass any data to server you need to use either Ajax or Server request via GET/POST method. Inorder to pass data from controller to phtml you could do this in your execute() $name = $this->getRequest()->getParam('...


2

Please check the website ID. Some of the configurations are there for the website with ID 0 which we can conclude from the error message. So check your store_website table. If there is no website with website_id 0, please check your core_config_data table for configurations with scope_id 0. You can manually change those to solve this issue at the go. ...


3

The errors are invalid XML There is a plugin for PHPstorm editor https://github.com/magento/magento2-phpstorm-plugin You can then generate XML URN map to validate against. https://magento.stackexchange.com/a/101524/70343 Or better yet you can scan your code. I was going to type an answer on how to use it but then I came across this https://magento....


2

Add this in your vendor/magento/data-migration-tool/etc/opensource-to-opensource/class-map.xml. Ensure that class-map.xml is specified correctly in config.xml <rename> <from>ultramegamenu/category_attribute_source_dropdown_type</from> <to></to> </rename> Similarly, you can rename all the classes. You can ...


1

The issue here is that the Migration from Magento1 to Magento2 relies heavily on the vanilla setup. It seems that you have customized some EAV Attributes which aren't mapped in your new Magento2 instance. You can either use -a for the CLI Migration command or try to map those fields manually in the respective Migration Folder in your root directory, see ...


1

This error has nothing to do with Plesk it's from the Magento script itself. Whoever wrote it clearly has no idea of PHP OOP. Sorry but it's true. There's nowhere to be found an "use" keyword in the script but you can clearly see that he's trying to use Cli class without specifying the namespace. That's the whole error if you change it to Magento\...


1

First of all, check this below collection and make sure that your reserved order should be unique. If your if condition will be true then, records available othervise, records not available : protected $quoteFactory; public function __construct( \Magento\Quote\Model\QuoteFactory $quoteFactory ){ $this->quoteFactory = $quoteFactory; } public ...


1

Magento 2’s default error handler can be found in {project root}\vendor\magento\framework\App\ErrorHandler.php. You can extend this error handler with your own logic to customize the behavior. <?php namespace Magento\Framework\App; class ErrorHandler{ protected $errorPhrases = [ E_ERROR => 'Error', E_WARNING => 'Warning', ...


1

For the cancel order use below event <event name="order_cancel_after"> <observer name="order_cancel_after" instance="Sm\BackEnd\Observer\NewEmail" /> </event> Also, change the event.xml file path. Move event.xml file from etc/frontend/events.xml to etc/events.xml


1

The extension code shown above works based on event/observer concept. Whenever a new order is placed the above code gets executed. You need to look at the file called events.xml in etc/events.xml. In the events.xml you may need to specify the additional event (in your case it is cancel/completed) and assign the observer. https://devdocs.magento.com/...


0

Please use the following code for server side validation. <models> <validatecaptcha> <class>Addpeople_Validatecaptcha_Model</class> <resourceModel>validatecaptcha_mysql4</resourceModel> </validatecaptcha> <customer> <rewrite> <...


2

Try this Vender/Module/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference type="Vender\Module\Block\Product\ListProduct" for="Magento\Catalog\Block\Product\...


0

Try the below code: $customerId = 2; // your customer ID $customer = Mage::getModel('customer/customer')->load($customerId); // Load the customer with the help of customer model $defaultBillingId = $customer->getDefaultBilling(); // Return the default billing address ID // Load the address by default billing Id will return the default billing ...


0

Just write a observer for event sales_order_creditmemo_save_after. In observer check for condition $order->getTotalRefunded() == $order->getGrandTotal()(Full refund condition). And then send email from here.


1

Use saveAttribute() method to save custom attribute $productRepository=$objectManager->get('\Magento\Catalog\Api\ProductRepositoryInterface'); $product =$productRepository->getById($mypro); $product->setBestPrice(0); $product->getResource()->saveAttribute($product, 'best_price'); Note: Code Tested


0

using This :- $order->getTotalPaid();


2

try Following way... $order = Mage::getSingleton('sales/order')->loadByIncrementId($orderId); $order->getGrandTotal();


0

Basically we get order total amount like this : $order = Mage::getModel("sales/order")->loadByIncrementId($orderId); // get order $order->getGrandTotal();


1

if you are on windows open the folder and give permissions to generated folder to "uncheck" read only and for linux operating systems use chmod -R 755 generated and you will be able to install the magento 2.3.1


Top 50 recent answers are included