Categories
Mastering Development

Multiple collection inputs binded to one parameter name?

Let’s say i have two inputs, where i can select one option (and only one), on each of them. But those inputs binds to the same parameter name: <%= f.input :filter, collection: @traffic_columns, include_hidden: false, disabled: true, required: false, label: "Traffic Dimensions", input_html: {type: "text" } %> <%= f.input :filter, collection: @vault_columns, include_hidden: false,label: "Vault", […]

Categories
Mastering Development

Sequelize: find entries with no association

Given the following simple models: class A extends Model {} A.init({ aField: DataTypes.STRING, }, { sequelize }); class B extends Model {} B.init({ bField: DataTypes.STRING, }, { sequelize }); A.hasMany(B); // this creates the B.AId column // populate await A.create({ aField: ‘fooA’, Bs: [{ bField: ‘fooB’ }] }, { include: [B] }); await A.create({ aField: […]

Categories
Mastering Development

Add a custom text field when a custom checkbox is checked in WooCommerce

I working on a solution in woocommerce registration with custom checkbox. The plan is when somebody select the custom checkbox an additional textfield opens and have to be required. the part that works: add_action( ‘woocommerce_after_order_notes’, ‘custom_checkout_field_with_wholesale_option’ ); function custom_checkout_field_with_wholesale_option( $checkout ) { if( current_user_can( ‘wholesale_customer’ ) ) return; // exit if it is "wholesale customer" […]

Categories
CMS Magento Mastering Development

magento 2 in category multi select attribute in option is not show?

:InstallData <?php namespace Vender\Extension\Setup; use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Catalog\Model\Category\Attribute\Backend\Sortby as SortbyBackendModel; use Magento\Catalog\Model\Category\Attribute\Source\Sortby; class InstallData implements InstallDataInterface { private $eavSetupFactory; public function __construct(EavSetupFactory $eavSetupFactory) { $this->eavSetupFactory = $eavSetupFactory; } public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $eavSetup = $this->eavSetupFactory->create([‘setup’ => $setup]); $eavSetup->addAttribute( \Magento\Catalog\Model\Category::ENTITY, ‘choosesubcategoryslider’, [ ‘group’ => ‘Choose […]

Categories
CMS Magento Mastering Development

magento 2 in category multi select attribute in option is not show?

:InstallData <?php namespace Vender\Extension\Setup; use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Catalog\Model\Category\Attribute\Backend\Sortby as SortbyBackendModel; use Magento\Catalog\Model\Category\Attribute\Source\Sortby; class InstallData implements InstallDataInterface { private $eavSetupFactory; public function __construct(EavSetupFactory $eavSetupFactory) { $this->eavSetupFactory = $eavSetupFactory; } public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $eavSetup = $this->eavSetupFactory->create([‘setup’ => $setup]); $eavSetup->addAttribute( \Magento\Catalog\Model\Category::ENTITY, ‘choosesubcategoryslider’, [ ‘group’ => ‘Choose […]

Categories
CMS Magento Mastering Development

magento 2 in category multi select attribute in option is not show?

:InstallData <?php namespace Vender\Extension\Setup; use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\EavSetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Catalog\Model\Category\Attribute\Backend\Sortby as SortbyBackendModel; use Magento\Catalog\Model\Category\Attribute\Source\Sortby; class InstallData implements InstallDataInterface { private $eavSetupFactory; public function __construct(EavSetupFactory $eavSetupFactory) { $this->eavSetupFactory = $eavSetupFactory; } public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $eavSetup = $this->eavSetupFactory->create([‘setup’ => $setup]); $eavSetup->addAttribute( \Magento\Catalog\Model\Category::ENTITY, ‘choosesubcategoryslider’, [ ‘group’ => ‘Choose […]

Categories
CMS Mastering Development Wordpress

How to display custom option field in woocommerce orders in admin panel?

Actually this question has already answerd as i already checked but i am unable to comment on that question as i am using the same code but in my scenrio i am using options field and value is not reflecting in admin panel below is the code that i tried //*Multiple Options Php – Select […]

Categories
Mastering Development

How can i query the data in a sub-document of a document from a sub-document of another document

This is my category schema. For every category document, there is a subdocument of subcategories #category schema const CategorySchema = mongoose.Schema({ name: { type: String, required: true }, subcategories: [{ name: { type: String, required: false }, }], created : { type : Date, default: Date.now() } }); let Categories = mongoose.model(‘categories’, CategorySchema); # selected […]

Categories
CMS Magento Mastering Development

Display custom category attribute on category page in Magento 2

I’ve created a module to add a custom category attribute (heading) to a category page. The attribute displays in the admin and I can save the value. I’m wondering what is the best way to display this on a category page? Example/CategoryHeading/etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Example_CategoryHeading" setup_version="0.0.1"> </module> </config> Example/CategoryHeading/Setup/InstallData.php <?php namespace […]

Categories
CMS Drupal Mastering Development

How can I create the functionality to assign icon per field type in field settings form?

I would like add a new setting for field which would allow to choose a icon for a field same as cardinality or any other settings. /admin/structure/types/manage/[content_Type]/fields/field_[some_field_name] I don’t want it per instance but for a field type e.g. phone number could have phone icon. I also don’t want to play with hard coded templates […]