New answers tagged

0

If your install data script successfully installed your custom attribute, now you just need to override addition information phtml file and set your custom attribute in that. Create vendor/TestModule/view/frontend/layout/customer_account_create.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" ...


0

You should create a plugin that changes the price after product loaded. 1 > Create di.xml file : <config> <type name="Magento\Catalog\Model\Product"> <plugin name="change_product_price" type="VENDOR_NAME\MODULE_NAME\Plugin\Product" sortOrder="1"/> </type> </config> 2 > Change the product price : <?php ...


0

You can try Like This $collection->addAttributeToSelect('*'); $collection->addFieldToFilter('group', ['finset'=> 5]); $collection->load(); Hope it Helps.Happy Coding!


0

At the end I could not get the attributes of the child items, but I solved the problem by creating the products again, and this time gave the attributes (height, width, length and weight) from the beginning to the parent products, because once you add configurable products this attributes gets disabled. So I added the attributes first and then add the ...


0

1) Create this file in app/code/Solwin/Module1/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Catalog\Model\Product"> <plugin name="sl-block-plugin" type="Solwin\...


0

In this case, you need to get the child item. You can use below code to get child item detail and add your logic: foreach( $orderItems as $item){ if ($item->getProductType()=="configurable") { foreach( $item->getChildrenItems() as $chitem){ // child product echo $chitem->getSku(); } } else { ...


0

Try to use below condition if($_product->getResource()->getAttribute('stock_display')->getFrontend()->getValue($_product)){ //Display Block code here }else{ //Don't show anything } Hope this will help you!


1

You can use: $_product->getStockDisplay(); <?php $attr = $_product->getStockDisplay(); ?> OR <?php $attr = $_product->getData('stock_display'); ?> OR <?php $attr = $_product->getAttributeText('stock_display'); ?> if($attr == 1){ show block }else{ don\'t show any thing }


0

The plugin you are using is only valid for product detail page. You can do it by adding plugin on class Magento\Catalog\Model\Product with method afterGetShortDescription(). Hope this helps you.


0

You have to use the id of the option as parameter for setManufacturer. If you don't know the ids you can retrieve first all the options for the manufacturer attribute and create an array where the key is the label and the value is the id. Something like this (all needs to happen in a class) /** * @var \Magento\Catalog\Api\...


0

Here's what exactly you wanted. First, create required files for creating and registering module, 1.Create registration.php on Vendor/Module/ directory <?php use \Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Invigorate_AddInfo', __DIR__); 2.Create composer.json { "name": "invigorate/...


0

create new file customer_account.xml in your layout directory. then add this content <body> <referenceBlock name="customer_account_navigation"> <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-my-link" after="customer-account-navigation-account-link"> <...


2

Check the below files to create a customer account navigation link and add a form for saving custom data as you want. app/code/Vendor/CustomerNavigatio/registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Vendor_CustomerNavigation', __DIR__ ); app/...


0

please check $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); echo $choose_slot_break = $product->getData('choose_slot_break'); hope it works.


0

All products have a created_at attribute containing the date the product was added. You can enable this as a frontend sort option in two ways. If you have access to your database: Find the created_at product attribute in DB table eav_attribute set its column frontend_label to Created At(default is null). Find the created_at product attribute in DB table ...


Top 50 recent answers are included