Magento API Product Create with Dropdown Attributes - api

I am attempting to load products using the Magento Core API product.create method.
Magento Enterprise 1.10
I am actually having great success with the exception of inserting values for dropdown attributes. It's my understanding that you simply add the attribute code and it's associated value as part of the "Params" array when you call the product.create method. I have set up the attributes as dropdowns so they can be included as filter, and I have added the options or "values" before trying to insert the products via the API. No matter what I do the value is not selected after a successful product upload.
Here are examples of my attempted syntax:
'resolution' => '3000',
'resolution' => 1,
'resolution' => array(1),
'resolution' => array('3000'),
'resolution' => 3000,
Values of YES/NO are accepted for boolean attributes, and I have no problem passing values to regular text fields. Any insight would be greatly appreciated.

Ok - so after much trial and error - it appears that you must enter the Attribute Option ID as the value when passing information to dropdown attributes.
You can use the product_attribute.options method along with the attribute ID to get these IDs - or just check your database.
Soo - if attribute 'test-dropdown' has a dropdown option of 'orange' and that option's ID is '220':
'test-dropdown' => 220,

Related

GA4 does not recognize the ecommerce 'items' parameter

To collect e-commerce data, I created a Ga4 data layer with GTM.
value, shipping, tax and items. as below ('item' parameter is just test)
But my GA4 doesn't recognize the 'items' parameter ONLY. Look at the picture below
all of other parameters are doing well, but not 'items'
GA4 does not recognize the ecommerce 'items' parameter.
I can't find a solution.
Do you know why?
One way that works for only one item in the items array, is by defining a datalayer variable for each component of the items array.
Example defining a datalayer variable for each component of the items array
Dont forget to check the last parameter configuration on the image. Ecommerce; check Send ecommerce data, and select Datalayer.
Hernan
Perhaps you are missing the "[]" when you define the variable "items" in the dataLayer.
When this happens, the variable items is recognized as an "object" and you need an "array". You can check this debugging with tag assitant in variables section.
This happens to me many times and you can either correct the data Layer of define a custom java script variables to add the "[]" to the variable.
items: [{ item_id: 'xxxxx', item_name: 'yyyy' , ... ]}
Good luck!
Andrés

How to filter with "_links" properties params on API.v3 in openproject

I just learned to use "hypermedia rest API" on openproject
I want to use "filter" param with "_links" properties on API but not know-how
Example:
http:/<my_domain>/target/api/v3/projects/design/work_packages?filters=[{"updatedAt":{"operator":"<>d","values":["2017-06-10T22:00:00Z","2017-07-05T22:00:00Z"]}, "_links":{"type":{"title":{"operator":"=","values":["Box"]}}}]
==> My Question:
i not known use to "_links":{"type":{"title":{"operator":"=","values":["Box"]} params filter. Now, result is not filter for "_links"
And show me books name to learn API for to beginner
? (https://www.oreilly.com/library/view/restful-web-clients/9781491921890/ch04.html#callout_hal_clients_CO1-1) -> is this ok?
Help me, please!
Thanks!
Image for my api
What I understood you wanting to achieve is getting all work packages in the project "design" that have been updated last within a certain time interval and that are of the type "Box".
The filters in OpenProject do not differentiate between native properties (like updatedAt) and linked resources (like type) when it comes to the structure of the filters. The syntax is always
{"<name of the filter>": {"operator": "<operator>": "values": [<list of values>]}}
When it comes to the filter values however, there is a difference. For linked resource the client is expected to use the id whereas native value like an integer, string or date is required for the native properties.
For your request the above requires the client to issue the following query:
GET http://domain/target/api/v3/projects/design/work_packages?filters=[{"updatedAt":{"operator":"<>d","values":["2017-06-10T22:00:00Z","2017-07-05T22:00:00Z"]}}, {"type":{"operator":"=", "values":["10"]}}]
I took the id of 10 for the type "Box" out of the screenshot you provided.
To get the filter values of all available filter you can call
POST http://domain/target/api/v3/queries/form
with a body of
{"name":"default","_links":{"project":{"href":"/api/v3/projects/design"}}}
The response will list all available filters in the _embedded/schema/_embedded/filtersSchema array.

Which Magento Soap V2 method should I use for external links?

I am working on a script that imports all product information from a Magento 1.9.3.1 website.
I cant seem to find a method which allows me to get the external links data which is associated with every product.
(See screenshot)
Does anyone know which method I need to use?
A list of methods can be found here:
http://devdocs.magento.com/guides/m1x/api/soap/introduction.html#Introduction-APIMethods
I think I have used all catalog related methods but none of them seem to return the data I need.
You can use this method: http://devdocs.magento.com/guides/m1x/api/soap/catalog/catalogProduct/catalog_product.update.html
From your screenshots, these look like custom attributes. Obtain their codes from Catalog > Attributes > Manage Attributes. Then, in the catalog_product.update call, include them in additonal_attributes as an array or arrays.
Example:
'additional_attributes' => array(
array('key' => 'ready_link', 'value'=> '...'),
array('key' => 'itunes_link', 'value'=> '...'),
)

Catalyst Framework HTML::Formhandler shows vadiate errors, when using HTML GET to Access the Site

I have an HTML::Formhandler Form on my Catalyst Framework. The Problem is, that I get an error-message in the Form, when I load the Form-Site with an HTML GET-Requelst.
has_field 'name' => (type => 'Text', required => 1);
So if I load the Site via: localhost:3000/form no errors occurs.
But if I load the Site via localhost:3000/form?foo=bar the form says: "Field required".
Any Idea how to solve this?
By default HTML::FormHandler determines whether to validate a from by the existence of params. If you don't want to do that, you can use the 'posted' flag in the ->process statement. If you want the query parameter to provide a default to the form, you need to pass it in via an init_object: init_object => { foo => bar }.

How to display custom fields in rally?

I have a ruby script that is trying to pull up some custom fields from Rally, the filter works just fine ( the filter contains one of the custom fields i want to pull up) but when I try to display it, it doesn't show up in the list (the value returned for all custom fields is blank, while appropriate values are returned for FormattedID, Name, Description).
Here's the link [link]http://pastebin.ubuntu.com/6124958/
Please see this post.
Do you fetch the fields?
What version of WS API are you using? If it is v2.0 is c_ prepended to the name of the field in the code?
How is the field spelled in your code and how that spelling compares to Name and Display Name of the field in UI?
There is another reason why custom fields might not appear (other than the versioning and 'c_' issues nickm mentioned). I just found this out after a ton of head banging. The Rally SDK's ui stuff will filter out all fields that are hidden (such as _ref, or other 'hidden' custom fields) so you cannot view them in your apps in grids, charts, etc. For example, when constructing a Rally.ui.grid.Grid, a class called Rally.ui.grid.ColumnBuilder is constructed and it executes a command on the columns of the chart that look like this:
_removeHiddenColumns: function (columns) {
return _.filter(columns, function (column) {
return !column.modelField || !column.modelField.hidden;
});
},
As you can see, if you try to display any fields that are hidden (like _ref for example) in a grid, the column gets removed. So, although you may be fetching the custom fields, they will not show up unless those fields are not 'hidden'.