I am trying to add some custom Features in Prestashop v. 1.6.
I have managed to import Pre-defined values, using the ID's of the Features, but now I have a large list of Features that I want to import, but this time I don't have ID's for them, and I want them imported onto the Customized value inside Prestashop Features.
This is the code for assigning features inside my importer:
foreach ($customProductObject->features as $feature) {
Product::addFeatureProductImport($product->id, $feature['id'], $feature['value']);
}
This is the code I use for assigning a Feature to it's respective ID inside Prestashop.
$features[] = ['id' => 11, 'value' => 192];
The 11 is the ID of a Feature in Prestashop (In my case: SIZE) and 192 is the ID of the Value (In my case: LARGE).
My question is this: How can I do this if I want to assign a value of a feature, but it is not stored in an already Pre-defined Value inside Prestashop?
Example: I want to assign a new feature (In my case: Colour, with id 12), with a custom value (In my case: red, blue, etc), but for which I don't have an ID, because it isn't stored in a Pre-defined value inside Prestashop, it will be a Customized value, inserted directly from a feed.
I tried this, with no success:
$features[] = ['id' => 12, 'value' => 'red'];
Related
I have one module with objects that have the attribute customer ID.
I have new module, with updated data, which was an import from PDF to DOORS using ReqMan.
Now I want to update the first module with data from the new module. The customer ID attribute is equal in both modules, but I cannot find a way in DOORS to do a sort of VLOOKUP to look for the customer ID and update the Object Text on the base module.
Preferably I would like to do it without DXL.
(modify the following instructions as needed - I describe my favorite settings here)
Use spreadsheet import and export, preferably Tab separated.
For export, create a view which does NOT contain Absolute Number nor the main column, but all the data you want to modify plus customer ID. Ensure that the labels of the columns are identical to the attribute names.
In the generated text file, you can change the attributes for existing rows and you can add new rows with customer IDs that do not yet exist in the module. Make sure that the first line contains the attribute names.
After you updated your text file, open the module and choose File -> Import -> Spreadsheet with the following settings :
Import to attributes: by column labes
Import options: Update existing objects
Update: All Objects
Data separator: Tab
Input file: the full path to your .tsv file
Advanced: check that the columns in the first row correspond to your attribute names
set the correct encoding
press Import
there should be no question "create new attribute?"
In the dialog "Select key", select "customer ID" as the "column/attribute that uniquely identifies the objects".
press "Select"
check the result, save the module only if everything looks correct.
Object ob, ob1
Module m = current // First module
string s="/Training Car Project/Stakeholder Requirements" //Give full path of your second module
Module mod=read(s,false)
for ob in m do
{
for ob1 in mod do
{
if((ob."customer ID""" = ob1."customer ID""") && (ob."Object Text""" != ob1."Object Text"""))
{
ob."Object Text""" = ob1."Object Text"""
}
}
}
I have an issue where some of our orders are being imported directly into Netsuite, and there is information from the first line item, that I need to copy into the transaction record (i.e. custom field on sales order)
I want to set this up so that it is automatic, I don't have access to the system that is used to bring the orders into Netsuite, and I only JUST got suitescript access and everything I read about that is way above my head..
I know basic HTML and some of the scripting formulas from Netsuite and that's all.
I was hoping there would be a CUSTOM FIELD FORMULA or some other similar way that I can just easily source the information directly from the first item in the item sublist?
This would be quite trivial to implement using SuiteScript. The example below assumes you want to copy the Memo field (description) from the first line item to the body Memo field. The basic idea would be something like the below (untested code):
function userEventBeforeSubmit(type){
if (type === 'create') {
var record = nlapiGetNewRecord();
var memo = record.getLineItemValue('item', 'memo', 1);
record.setFieldValue('memo', memo);
}
}
If want to accomplish this via custom fields etc. it is possible using "Custom Fields with Values Derived from Summary Search Results".
To do this create a Saved Search as follows:
Type: Transaction
Criteria: [none]
Results: Formula (Text), Summary
Type = Maximum, Formula: DECODE({line}, 1, {memo}, NULL)
Available Filters: Internal ID
Then create a Custom Transaction Body Field as follows:
Type: Free Form Text
Store Value: F
Validation & Filtering > Search: [Saved Search from previous step]
As this is a dynamically calculated field (Store Value = F), it would be available when viewing the record, but not in Saved Searches and lists. To remove this limitation, you can create a Workflow that would copy this field to another one that is stored.
How does one go about creating a new product with variations via the API?
Let's say I want to create a brand new product with 2 types of variation: Size (S, M, L) and Color (Red, Green).
It sounds like to do this, I need to use the SKU endpoint instead of the normal product endpoint. But to create a product SKU, I need to call https://developer.bigcommerce.com/api/stores/v2/products/skus#update-a-product-sku . To call that API, I need a product ID... so clearly I need to make the product first.
To make the product I call https://developer.bigcommerce.com/api/stores/v2/products#create-a-product . I want inventory_tracking=sku, but I get an error on a new product saying I cannot do inventory_tracking=sku without skus being enabled. So I guess I need to make a simple product first and update it later?
So I am trying to do something like this as my workflow
1) Create a new product with inventory tracking = simple
2) Create a new Option for Size via a post to /options
3) Add the values, S, M, L via posts to /options/option id from #2/values
4) Create a new Option for Color via a post to /options
5) Add the values Red, Green via posts to /options/option id from #4/values
6) Post to the skus endpoint 6 times, one per combination of Size / Color. For each I list a SKU, Price, option_value_id, product_option_id
{
"sku": "SKU-RED-SMALL",
"price": 5.00,
"weight": 1.00,
"options": [
{
"option_value_id": id-for-red,
"product_option_id": id-for-color
},
{
"option_value_id": id-for-small,
"product_option_id": id-for-size
},
],
}
7) I go back and update the product inventory_tracking to be SKU
This is the best plan I can figure out to get a single product listed.. but at #6 I am hitting an error "The field 'product_option_id' is invalid." I am guessing it could be because I created an "option" instead of a "product_option", but I do not see a way to create product_options.
Clearly there has to be an easier way? What is the best course to create this single listing with variations via the API?
Hopefully this helps clarify some of the workflow for how you create variants for something like small, medium, large, and red, blue, green. Colors are an option and sizes are an option. Both of these have to be assigned to an option set which is then associated with a product.
Create your option(s).
Create option values associated with the option above.
Create an option set.
Create option set options (associating the option set with the option you created above).
I recently started experimenting with the REST API for SharePoint 2013 Foundation and I am trying to return all entries in a list. My GET request returns the data I am looking for, but the IDs used to identify the columns in the list are not helpful for identifying what the information is (see images below). The column IDs between 'Title' and 'ID', in the second image, are a jumble of characters.
SharePoint List View
Response Data
Is there any way to configure the list to use the column names as IDs? Also, is there some significance to the characters currently used as IDs?
You will need to make a second request to get a listing of columns that includes the InternalName and the Title which is what you are trying to reference:
You can use this REST call:
_api/web/lists/GetByTitle('Project Details')/fields
or you can use CSOM:
using (ClientContext context = new ClientContext(url))
{
List list = context.Web.Lists.GetByTitle("Project Details");
context.Load(list, l => l.Fields);
context.ExecuteQuery();
foreach(Field field in list.Fields)
{
Console.WriteLine(field.Title);
Console.WriteLine(field.InternalName);
}
}
SharePoint automatically generates the InternalName and it is a read-only field, at least using REST. It'll be easier to get the Field Data to correlate the InternalName to the Title than changing the values.
The column you are referring to, between Title and Id, is the ID of the content type associated to the item. It is not a column ID.
The SharePoint REST API is OData compliant, so you can use the $select parameter to query for the neccesary fields.
http://server/site/_api/web/lists('guid')/items?$select=Column1,Column2
Please be aware though, lookup fields need to be expanded as well, otherwise you get only the Id of the lookup item.
http://server/site/_api/web/lists('guid')/items?$select=LookupColumn&$expand=LookupColumn/Title
I need to be able to store something like this:
where the green is a template type, the gray is a field container type, and the white is field. (That being, a field has a label and some text, both mediumtext for simplicity; and a field container can store other field containers or text, and a template is a top-level field.)
Now, let's say I want to allow users to create any number of these structures, but it is unlikely to be more than say 10. And, of course, we need to be able to link data to it.
This is all to be able to store in a database an associative array that looks for the above like, in pseudo code:
my_template = {
page_info => { description => 'hello!!!' },
id => 0,
content => { background_url => '12121.jpg', text => ...
}
Having an easy way to add a field to all data using the template when the template changes (say, we add a keywords to page_info) would be a big plus.
I can't figure this out at all, thanks a lot!
There are several different ways to store heirarchical data structures (trees) in MySQL. You can for example choose:
Adjacency list
Nested sets
Path enumeration
Closure table
See Bill Karwin's presentation for more details on the pros and cons of each.