Jump to content

Adding a product with configurable options through the Internal API


ericdstrom

Recommended Posts

Hello, I'm working on a module and need to create a new product either on or around the time of activation. This product needs to have some configurable options associated with it. The problem I'm having is that the API documentation only says that you can specify configoption1, configoption2, etc. It doesn't actually give what the proper syntax is for specifying these things. If anyone has any idea what the proper array structure for this would be, it would be a huge help. Thanks!

Link to comment
Share on other sites

Even the documentation there is a little vague on custom options and custom fields.

"customfields this variable contains a sub-array of all the custom fields defined for the product, with the key being the custom field name - $params[‘customfields’][‘Field Name’]"

It shows how those variables get passed to each function, but doesn't allow you an area to define these options, or am I missing something here?

Link to comment
Share on other sites

function template_ConfigOptions() {
# Should return an array of the module options for each product - maximum of 24
   $configarray = array(	 "Package Name" => array( "Type" => "text", "Size" => "25", ),	 "Web Space Quota" => array( "Type" => "text", "Size" => "5", "Description" => "MB" ),	 "FTP Access" => array( "Type" => "yesno", "Description" => "Tick to grant access" ),     "Subdomains" => array( "Type" => "dropdown", "Options" => "1,2,5,10,25,50,Unlimited"),	);
return $configarray;
}

i got this from template.php

 

download the complete code from here

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated