Additional API functions - feature request

  • Posts: 250
  • Thank you received: 7
8 years 6 months ago #240591

-- url of the page with the problem -- : www.artistpapers.co.uk
-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1

Hi,

The API is great if you want to interact with actions initiated within Hikashop, but I've got a situation where I would like to instigate an action from outside of Hikashop.

In my case I want to create a new user from RSForms, creating the Joomla user is easy but getting the address into Hikashop is tricky, it would be perfect therefore if there was a "Create New User" API function.

Thanks for listening!

Ian

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 6 months ago #240606

Hi,

Well, there kind of is. But there is no documentation about it.
You can load the HikaShop main helper, then initiliaze the address model, populate an object, and save it:

if(!defined('DS'))
	define('DS',DIRECTORY_SEPARATOR);
if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php'))
	return true;
$addressClass = hikashop_get('class.address');
$address = new stdClass();
$address->address_user_id = hikashop_loadUser();
$address->addres_firstname = $my_firstname;
$address->addres_lastname = $my_lastname;
$address->addres_city = $my_city;
.....
$addressClass->save($address);

The following user(s) said Thank You: iedwards

Please Log in or Create an account to join the conversation.

  • Posts: 250
  • Thank you received: 7
8 years 6 months ago #240664

Thank you Nicolas, that's perfect, I will use that this morning.

Regards,

Ian

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum