New answers tagged

0

I know this isn't the answer to your problem but when I want to update just 1 attribute I m usually do this: public function updateOrderWithCustomAttributes($orderId,$sentToSage){ $connection = $this->getConnection('core_write'); $sql = "UPDATE `sales_order` SET sent_to_sage = ? WHERE entity_id = ? "; $connection->query($sql, ...


0

I've compared your mentioned files with my module and there is only one difference I've found in InstallData.php. I'm sharing my module file with you. Hope it'll help you to find your fix. <?php namespace Vendor\Module\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\...


0

I solved the issue, i changed the file Vendor\Module\Setup\UpgradeData.php and execute php bin/magento setup:upgrade Vendor\Module\Setup\UpgradeData.php namespace Vendor\Module\Setup; use Magento\Customer\Model\Customer; use Magento\Customer\Setup\CustomerSetup; use \Magento\Framework\Setup\UpgradeDataInterface; use \Magento\Framework\Setup\...


1

You define what forms appear in as part of setup. Have you missed this part? https://github.com/DominicWatts/EmailCC/blob/master/Setup/InstallData.php <?php namespace Xigen\CC\Setup; use Magento\Customer\Model\Customer; use Magento\Customer\Setup\CustomerSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\...


0

Here's an example one I've used on a client site before. This adds a simple quote & order attribute that gets populated by the customer in the frontend and then transferred over from the quote to the order (see the etc/config.xml example underneath for that part) The install script: <?php /* @var $installer Mage_Core_Model_Resource_Setup */ $...


1

You can follow these steps to create Product File Type Attribute in Magento 2 https://webkul.com/blog/create-and-manage-product-file-type-attribute-in-magento-2/


1

So I found the issue with the custom customer attribute. My process was : Create all my attributes with install/updrage scripts in my magento mpdules Use the Magento migration tool to migrate from Magento 1 & 2 Test my code The issue is that after the migration my attributes lost the used_in_forms value, were not assigned to any website. I had to add ...


0

I have created a script and able to get value after save here is my script hope this helps <?php use Magento\Framework\App\Bootstrap; require '../../app/bootstrap.php'; $bootstrap = Bootstrap::create(BP, $_SERVER); $obj = $bootstrap->getObjectManager(); $state = $obj->get('Magento\Framework\App\State'); ...


0

You can create below script and run it on your website to update the attribute value for selected products. require_once('app/Mage.php'); umask(0); Mage::app('default'); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $productCollection = Mage::getModel('catalog/product')->getCollection(); $skus = array('comma seprated SKUs for ...


0

I did a script about Customer attribute in the past. My script worked perfectly so I put it on my gist. Take a look, maybe it will help you. https://gist.github.com/0-Sony/252311391be9e434a53e522709cc11be Hope it helps


0

Please change user_defined to true in UpgradeData.php as like below $customerSetup->addAttribute( Customer::ENTITY, 'exported_to_erp_at', [ 'type' => 'varchar', 'label' => 'Exported to erp at', 'input' => 'text', 'required' => false, ...


0

If it's just a one time endeavour for a single Magento install, I'd use the admin backend to create the custom attribute, for simplicity's sake. However, if you want to create the same custom attribute in multiple projects or plan to work with other developers who will make use of this attribute, it's better to create the attribute programmatically in a ...


0

If you do a GET to - /rest/V1/products/*SKU*/options/ It will display the product options. You can narrow it down a particular option by doing - /rest/V1/products/*SKU*/options/*OPTION_ID* Found in the Swagger documentation.


1

Use the following code $weight = $product->getResource()->getAttribute('weight_spices')->getFrontend()->getValue($product);


0

If the Year of manufacturing is an attribute why don't you try to get the value like this: $_product->getAttributeText("year_of_manufacturing"); instead of looping all the options.


Top 50 recent answers are included