xbenjii Posted November 25, 2014 Share Posted November 25, 2014 Is there any way to override the auto increment and add my own ID for any resource? I have the following below but it's not using the id. I've also tried $fields->id_product_attribute. public function addProductCombination($schema, $id, $options) { $fields = $schema->children()->children(); $results = []; foreach ($options as $option) { $fields->id = $option->option_id; $fields->id_product = $id; $fields->price = $option->price; $fields->weight = $option->shipping_weight; $fields->associations->product_option_values->product_option_values[0]->id = $this->findType($option->option_types); $fields->minimal_quantity = 1; $opt = [ 'postXml' => $schema->asXML(), 'resource' => 'combinations' ]; try { $results[] = $this->presta->add($opt); } catch (PrestaShopWebserviceException $ex) { die($ex->getMessage()); } } return $results; } Link to comment Share on other sites More sharing options...
xbenjii Posted January 5, 2015 Author Share Posted January 5, 2015 I guess there's no way to do this? Link to comment Share on other sites More sharing options...
vekia Posted January 5, 2015 Share Posted January 5, 2015 i have no idea what you're trying to achieve you want to change the id of the object or what? if so, im affraid that due to the database consistency things - it's not possible Link to comment Share on other sites More sharing options...
xbenjii Posted January 5, 2015 Author Share Posted January 5, 2015 i have no idea what you're trying to achieve you want to change the id of the object or what? if so, im affraid that due to the database consistency things - it's not possible Instead of auto-increment kicking in, I want to force the ID of a product. Link to comment Share on other sites More sharing options...
Richard S Posted January 6, 2015 Share Posted January 6, 2015 (edited) I guess you just want to add additional field to database and object which would be unique to your attribute or product? If that's the case, you just should add additional field to object, make sure it is added to object's structure and use it as simple value. However, you will not probably make it auto_increment in mysql without breaking all tables structure as many errors can show up if default PrestaShop's ids will be changed. Edited January 6, 2015 by Richard S (see edit history) 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