Wazzu Posted August 26, 2014 Share Posted August 26, 2014 Hi all. I've been able to create a new shop in a multistore shop using webservices. After creating a shop, I asign an URL to that shop. Finally, I create a new employee and everithing is fine, no errors, all objects are created. Problem is that new newly create employee has access to the main store, not the new multishop I've just created. Question is: how can I make it from webservices so I can assign an employee to a specific multistore? Is it even possible? Thanks in advance. Best regards. Link to comment Share on other sites More sharing options...
shoofra Posted September 30, 2014 Share Posted September 30, 2014 did you resolved this? I am fronting the same at the moment. thank you in advanced Shoofra Link to comment Share on other sites More sharing options...
Wazzu Posted September 30, 2014 Author Share Posted September 30, 2014 Hi, shoofra Unluckly I got no way of doing it so I had to create a new class for the api to manage this First I expanded webservices by creating override\classes\webservice/WebserviceRequest.php <?php class WebserviceRequest extends WebserviceRequestCore { public static function getResources() { $resources=parent::getResources(); $resources['employee_shop'] = array('description' => 'Employees Shop assignation', 'class' => 'EmployeeShop'); ksort($resources); return $resources; } } Then I created a override/classes/EmployeeShop.php file class EmployeeShopCore extends ObjectModel { /** @var int Determine employee id */ public $id_employee; /** @var int Determine shop id */ public $id_shop; /** * @see ObjectModel::$definition */ public static $definition = array( 'table' => 'employee_shop', 'primary' => 'id_employee', 'fields' => array( 'id_employee' => array('type' => self::TYPE_INT, 'required' => true), 'id_shop' => array('type' => self::TYPE_INT, 'required' => true), ), ); protected $webserviceParameters = array( 'fields' => array( 'id_employee' => array('xlink_resource' => 'employees'), 'id_shop' => array('xlink_resource' => 'shops'), ), ); public function add($autodate = true, $null_values = false) { $result = parent::add($autodate, $null_values); } } Finally I ended up by another way, so these code snippets are a work-in-progress, maybe not fully funcitonals Link to comment Share on other sites More sharing options...
Wazzu Posted September 30, 2014 Author Share Posted September 30, 2014 BTW, when you're done, you'll realize you still need to import products, categories, cms, currencies, countries.. and about 40 more items :-( Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now