Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do this

Status
Not open for further replies.

selvag3

Programmer
Aug 23, 2012
1
US
$newProductData = array(
'name' => 'name of product',
// websites - Array of website ids to which you want to assign a new product
'websites' => array(1), // array(1,2,3,...)
'short_description' => 'short description',
'description' => 'description',
'status' => 1,
'weight' => 0,
'tax_class_id' => 1,
'categories' => array(3), //3 is the category id
'price' => 12.05
);

This is Php Coding..
How to convert the above data into power builder
 
So this looks like you want to set up an array of 'websites' each with a set of attributes?
The easiest way is to create a non visual object and within it declare however many instance variables to correspond to the attributes and their data types (strings, integers, etc.)
You can then declare an array of these objects and populate their attributes as needed.

So you would have an object called 'nvo_product'.
That object has instance variables like the following
string is_short_description
string is_description
integer ii_status
integer ii_weight
integer ii_tax_class_id
integer ii_category_id
decimal{4} idc_price

In code you create an array of 'nvo_product' objects

nvo_product lnv_product[] // unbounded array
// populate the first element of the array
lnv_product[1].is_short_description = 'short'
lnv_product[1].is_description = 'description'
lnv_product[1].ii_status = 1
lnv_product[1].ii_weight = 0
lnv_product[1].ii_tax_class_id = 1
....

Matt



"Nature forges everything on the anvil of time"
 
another suggestion is to define a "structure object" or a structure within your window or within a userobject

Suppose your structure is named "str_struct" with fields "s_name", "s_websites", "s_categories[3]" etc., then you'd declare a variable of that type as follows:

// local variable declaration (first you have to have defined/created the structure of course)
str_struct lstr_product[] // lstr_product[10] would limit your array up to 10 elements



// and you would access as follows
lstr_product[1].s_name = 'productname whatever'
lstr_product[1].s_websites = 'lstr_product[1].s_categories[1] = "cat1"
lstr_product[1].s_categories[2] = "cat2"
lstr_product[1].s_categories[3] = "cat3"
// .... etc.



regards,
Miguel L.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top