How to fix magento 2 getUrL - magento

I fetched product data by using collection factory from (Magento\Catalog\Model\ResourceModel\Product\CollectionFactory). Then passed those data in template by block. Data has been fetched successfully but when i try to edit by
Edit
getUrl doesn't generate a valid link.
i want a Url link this
http://localhost/magento2/admin/catalog/product/edit/id/1/key/bfe08a05118e8a063718ecf5804669494dca697b13782ee7a074d9f42344d28a/
but i am getting like this
http://localhost/magento2/admin/catalog/product/edit/key/bfe08a05118e8a063718ecf5804669494dca697b13782ee7a074d9f42344d28a/
As you can see my link doesn't have any ID in between edit and key.
I think i am missing something. Please help

Related

Using ajax in prestashop custom module, retrieve data from an input field date to a module's FrontController for exploitation and SQL query afterwards

I need your help to understand how to retrieve the data from the product page form (product.tpl) sent by the 'add to cart' button (product-add-to-cart.tpl include).
Indeed, I would like to retrieve the value of a datepicker field, added under the entry dedicated to the quantity of the product page,
in order to save it in the ps_cart_product table.
Despite my research in the cart class and its controller, I can't do it. How to retrieve the value of an entry in the home page of a product?
A null date (0000-00-00) is however well recorded in our new columns date_retrait in ps_cart_product, we manage to recover it as you can see on a screen, but not to record it correctly.
Where can I call $_POST or REQUEST from the input datepicker name = date_retrait
(here it is 2022-07-24 but this is only a test, modified directly in the DB, normally it displays 0000-00-00)
I understood that I had to use Ajax (mymodule\/controller\/front\/ajax.php)
But I don't understand all the steps, what should I add/modify and especially: where (which files with path)?
[product_tpl][1]
[cart_popup][2]
[add to cart][3]
[ps_shoppingcart_js][4]
[1]: https://i.stack.imgur.com/MwLPS.png
[2]: https://i.stack.imgur.com/LjpMe.png
[3]: https://i.stack.imgur.com/3P4Y2.png
[4]: https://i.stack.imgur.com/z0eb4.png

How to read Drupal 8 webform composite element properties in webform handler

Hoping someone might be able to help me out. I have a custom Drupal 8 module which has a webform composite element with some settings/properties that are fields where I can either enter a webtoken to capture some data from the form or simply enter some data for later retrieving on the webform handler side. The issue is that I thought this data would be included in $_POST but it's not so I'm trying figure out how I can retrieve the data after the form is submitted. FYI, I don't even see this data being stored in the "webform_submission_data" table so not sure where it's being saved. If anyone has some sample code it would be greatly appreciated.
My last thought was that this data could be retrieved via \Drupal::configFactory() but that doesn't make sense because the data there is static and if I'm using webtokens for these fields I'm essentially capturing changing data all of the time.
Per screenshot below, I'm trying get the authnet element settings data (charge amount, authorize.net profile) from either a custom handler or even a hook after user submits the form. Note that "first_name_on_card" is indeed available in the $_POST data.

Branch.io - Appending Query Parameters

Trying to append some query parameters to links created via Branch.io, but I can't figure out how to do this in the dashboard. I see from https://docs.branch.io/pages/links/integrate/ that the following is possible.
Short links can have additional data appended to them
e.g. dynamic link https://example.app.link/fzmLEhobLD?content_id=123
Append query strings https://example.app.link/fzmLEhobLD?$custom_data=123&hello=world
Is there a way to do this via Quick Links in the dashboard?
I need to create the link here to test that my Android and iOS apps can read the parameters from the link and take the user to the appropriate page, or redirect the user to the appropriate page on the website - and then bulk create similar links with the query parameters varying (either via the dashboard or the HTTP API).
Have already checked out the following - Deep link with variable query on branch.io - but this didn't seem to address the issue.
When creating a quick link under configure options, you can select the deep linking tab and click on the "+ more data" button which will allow you to add parameters to the quick link.
adding parameters to quick link
You cannot add query params in the dashboard, but you can add link data in the Link Data section. (date of the screenshot: Jan, 2021)
If you need links for different purposes, then you should create multiple links.
On the other hand, if you only need to vary one parameter, then you can reuse one link by passing a different query parameter. For example, you can create a Quick Link to add a user to a user group that looks like this - myapp.link/add, That is a Quick Link, and you can set its params in the Link Data section (e.g. set key type to value new_users
Then, on the backend (or wherever you want to "generate" links), you reuse that one link like this:
myapp.link/add?code=a1 this is inviting user L to group Y
myapp.link/add?code=b2 this is inviting user M to group Z
In your app, you can access both the code param (from query param) and the type param (defined in Link Data) in the same way, usually through a data Map.

Magento Custom Form in create order page

I want to add custom form in create order page in magento admin side.As per my client request i was trying to create measurements form and wanna store data.I am new to magento.Please help me.Attached image for ref.
Already posted same question in Magento Stack Exchange My Question
I created block in layout/sales.xml file and created customform.phtml.Now i'm able to display custom form.Now i want to store data along with other data in this page.
You should add a table (with order id as foreign key) or a new text field to order sales_flat_order table.
After that, you are able to catch this event: sales_order_save_after
Inside this function, you can save data to the custom table or custom field you added.
good luck.

Magento creating invoice redirect to wrong url

When I create an invoice from the order in the backend, this on this url:
http://www.site.com/index.php/safe/sales_order_invoice/new/order_id/4372/
But when the Invoice is about to be created it goes to:
http://www.site.com/shop/safe/sales_order/view/order_id/4372/
You see the (Shop), which is mostly correct because the storefront is named that(We had 2 storefronts once) If I remove the (Shop) part from the url, I'm getting back to the correct page and it shows that the invoice was correctly created. This only happens from the Order itself. If I use Mass action to create invoices from the orders list, it's not giving me any problems.
If anyone else has the problem (Using multi stores)
Please check your database, core_config_data and see if web/secure/base_url etc. is redirecting to the right path. And make sure to check that it's doing so for the right store ID that is giving you the trouble.
My problem was that the secure path for one of my stores, was ruining it.
All works fine now!

Resources