Categories
CMS Drupal Mastering Development

DependentDropdown + AjaxAddMore

I have a custom form in which I’m using both the DependentDropdown and AjaxAddMore form examples from the example module. I’ve simplified the code below to focus on the issue. The dropdowns function and the addmore functions. But when I add an additional facility the rate that was chosen for any previous is lost. The […]

Categories
CMS Drupal Mastering Development

With Drupal 8/9 managed_file dynamically set fileName and #upload_location

In a form I want to bulk upload jpgs renaming them using exif date information and dynamically setting the #upload_location according to the value of a textfield in the same form. I have no problem with accessing the exif date information. What I don’t know how to do, is dynamically set the file name and […]

Categories
Mastering Development

Unable to retrieve the values of document in one to many relationship

I have 2 Schemas. Shop and Product. One shop can have many products. But I also have more than one Shop. Let’s say I have 5 shops, and each of those shops have their own products. I am able to save the products and find their IDs in the Shops respectively. But I am struggling […]

Categories
Mastering Development

nodeJS + mongodb auto-increment: cannot alter req.body during POST

I’m an experienced developer teaching myself nodeJS, I’m having some struggles. I’ve read discussions on the following topic that you will likely refer me to, but they don’t seem to work for me. After much trial and error, I’m in the situation described below. I need to maintain some legacy auto-increment fields (not PK, not […]

Categories
Mastering Development

Get value from custom field on checkout page Woocomerce WordPress

I have created a woocommerce_form_field with some options to be displayed as dropdown menu. add_action( ‘woocommerce_before_checkout_billing_form’, ‘add_checkout_custom_fields’, 20, 1 ); function add_checkout_custom_fields( $checkout) { $domain = ‘woocommerce’; // The domain slug // First Select field (Master) woocommerce_form_field( ‘delivery_one’, array( ‘type’ => ‘select’, ‘label’ => __( ‘Delivery options one’ , $domain), ‘class’ => array (‘form-row-wide’, ‘update_totals_on_change’ […]

Categories
Mastering Development

Argument 1 passed to Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader::getIdValue() must be an object or null, int given

I’m new with Symfony. I’ve followed a couple of tutorials trying to learn dependent selects, so I use a DestinationFormType and a DestinationController to save a Destination. The JS part works well, but now when I try to save the entity throws the next exception: Argument 1 passed to Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader::getIdValue() must be an object or […]

Categories
CMS Magento Mastering Development

Custom category attribute is not being saved – issue

I managed to create my custom attribute: $installer = $setup; $installer->startSetup(); $categorySetup = $this->categorySetupFactory->create([‘setup’ => $setup]); $categorySetup->addAttribute( Category::ENTITY, ‘content_category_page’, [ ‘type’ => ‘int’, ‘label’ => ‘Content Page’, ‘input’ => ‘select’, ‘sort_order’ => 100, ‘source’ => ‘Magento\Catalog\Model\Category\Attribute\Source\Page’, ‘global’ => 2, ‘visible’ => true, ‘required’ => true, ‘user_defined’ => false, ‘default’ => null, ‘group’ => ‘General Information’, […]

Categories
Mastering Development

RegExp to find matching documents in MongoDB for multiple fields

I am trying to create a simple search on website-blog by using regex and find matching documents into an array of objects. It works just fine if I include only one fieldname I get the result, how can I include multiple fields to search within for example title AND content? This row: if(req.query.search) query = […]

Categories
CMS Magento Mastering Development

Install Data is not executed in magento 2

I am trying to create a category attribute: This is my file form Vendor/Module/Setup: use Magento\Catalog\Model\Category; use Magento\Catalog\Setup\CategorySetupFactory; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; class InstallData implements InstallDataInterface { private $categorySetupFactory; public function __construct(CategorySetupFactory $categorySetupFactory) { $this->categorySetupFactory = $categorySetupFactory; } public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); $categorySetup = $this->categorySetupFactory->create([‘setup’ => […]

Categories
CMS Mastering Development Wordpress

Add a checkbox to Stripe payment gateway Woocommerce

I need to add a checkbox like this to my stripe gateway. But, I tried copying the code for paypal and applying it to stripe but the actual box for the checkbox doesn’t appear :/ Example here but everything else does. Here is the code I am working with for paypal and it works fine: […]