This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Commerce Stock not correct value in template

I am using best selling product template and inside I am render product with stock information. 

This 

product['#commerce_product'].variations[0].entity.field_stock.value

return me 0.000 but correct value is 3. I dont know why is this doing. Please can somebody help me with this?

Access the paragraph fields in my custom module

I have a Product content type with these fields; title, body, and one entity reference revisions(Paragraph: field_select_module).

I am creating a custom REST API(custom module) to export the fields in the JSON. I am able to print the title and body. Could someone help me to print the paragraph fields which have title and image(Media) and title and image will repeat 3 times. It should be inside this array 'product_list' => array(),

Here is my controller.

Form with fileupload.

Hello,

I have a big problem with file upload. I have a form with 3 fields. One is file field.
When I'm trying to call any function like file_save_upload() I'm always getting errors... cannot call function

How I can make it to work? 

I don't wan't to use file_managed because i want to change filename before saving and I want to store all form datat in my custom database table. Any help would be great.

It's Drupal 9.1.2

Here is my code:

How to get node id by URL path

Hi,

Can anyone tell, how can I get node id of  any page, which I have URL from drupal configuration.

For eg, I have page mysite.com/abc, so how can i find the node if of page abc, without writing any code.

Thanks in advance

#states and non-editable fields

With the #disable property I can make a field not editable
$ form ['field_meal'] ['widget'] [0] ['value'] ['# disabled'] = FALSE;
I have read that there is an option to do this through #states
I don't think that in my case it will be fine, as I have a select on an entityReference field and in relation to some boolean fields of the entityReference I have to make these fields editable or not.
I tried with the callBack and ajax response but I couldn't find any command to make the fields uneditable
I hope I was clear

(D7) Hundreds of PDF uploads to webform directory with no submissions

Hi there,

over the course of about 6 hours this morning, a few hundred PDF files were uploaded into our public 'webform' directory.

Although we do have webforms that allow PDF files, there are no submission records in the database that would explain the uploads.

Watchdog logs show that someone then tried to access each of the files via GET, but were served a 404 for each.

I can't see it having been done via FTP, as we have very strict security.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions